diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2008-08-15 12:43:50 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2008-08-15 12:43:50 +0000 |
commit | d5794e4d7582091dc76f62e3db7a1adcfc517400 (patch) | |
tree | 778c0007c48f61b6a9657f55b242be71d23b3409 /lib/sbin/parameter_parser.pl | |
parent | 0bc91a905a95d4d153587891bc7f9928c370c60e (diff) |
bugfix for comparing a parameter's default value against its allowed parameter
range(s) with closed intervals
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4501 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/parameter_parser.pl')
-rw-r--r-- | lib/sbin/parameter_parser.pl | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/lib/sbin/parameter_parser.pl b/lib/sbin/parameter_parser.pl index 4eb0c7d1..220acf1f 100644 --- a/lib/sbin/parameter_parser.pl +++ b/lib/sbin/parameter_parser.pl @@ -634,11 +634,18 @@ sub CheckParameterDefault for ($i=1; $i<=$nranges; $i++) { $range = $parameter_db{"\U$thorn $variable\E range $i range"}; - $range =~ /^([\s\*0-9]*):([\s\*0-9]*)/; - $min = $1; - $max = $2; - $foundit = 1 if (($min =~ /^\s*[\*\s]*\s*$/ || $default >= $min) && - ($max =~ /^\s*[\*\s]*\s*$/ || $default <= $max)); + $range =~ /^([\(]?)([\s\*0-9]*):([\s\*0-9]*)([\)]?)/; + $lower_bounds_excluded = $1 eq '('; + $min = $2; + $max = $3; + $upper_bounds_excluded = $4 eq ')'; + $foundit = 1 if ($min =~ /^\s*[\*\s]*\s*$/ or + ($lower_bounds_excluded ? $default > $min : + $default >= $min)) + and + ($max =~ /^\s*[\*\s]*\s*$/ or + ($upper_bounds_excluded ? $default < $max : + $default <= $max)); } if ($nranges > 0 && $foundit == 0) { @@ -655,11 +662,18 @@ sub CheckParameterDefault for ($i=1; $i<=$nranges; $i++) { $range = $parameter_db{"\U$thorn $variable\E range $i range"}; - $range =~ /^([\s\*0-9\.eE+-]*):([\s\*0-9\.eE+-]*)/; - $min = $1; - $max = $2; - $foundit = 1 if (($min =~ /^\s*[\*\s]*\s*$/ || $default >= $min) && - ($max =~ /^\s*[\*\s]*\s*$/ || $default <= $max)); + $range =~ /^([\(]?)([\s\*0-9\.eE+-]*):([\s\*0-9\.eE+-]*)([\)]?)/; + $lower_bounds_excluded = $1 eq '('; + $min = $2; + $max = $3; + $upper_bounds_excluded = $4 eq ')'; + $foundit = 1 if ($min =~ /^\s*[\*\s]*\s*$/ or + ($lower_bounds_excluded ? $default > $min : + $default >= $min)) + and + ($max =~ /^\s*[\*\s]*\s*$/ or + ($upper_bounds_excluded ? $default < $max : + $default <= $max)); } if ($nranges > 0 && $foundit == 0) { |