diff options
-rw-r--r-- | lib/sbin/parameter_parser.pl | 2 | ||||
-rw-r--r-- | src/include/utili_Expression.h | 1 | ||||
-rw-r--r-- | src/util/Expression.c | 4 |
3 files changed, 6 insertions, 1 deletions
diff --git a/lib/sbin/parameter_parser.pl b/lib/sbin/parameter_parser.pl index a3b74db9..2ea61d62 100644 --- a/lib/sbin/parameter_parser.pl +++ b/lib/sbin/parameter_parser.pl @@ -754,7 +754,7 @@ sub CheckExpression my ($expression) = @_; my $retcode; - if($expression =~ m,^[-\d/*()+xy^]+$, && + if($expression =~ m,^[-\d/*()+xy^!<>=]+$, && $expression =~ m/\bx\b/ && $expression =~ m/\by\b/ && $expression !~ m/\wx/ && diff --git a/src/include/utili_Expression.h b/src/include/utili_Expression.h index b501ebad..148151a3 100644 --- a/src/include/utili_Expression.h +++ b/src/include/utili_Expression.h @@ -30,6 +30,7 @@ typedef enum {OP_NONE, OP_DIV, OP_TIMES, OP_POWER, + OP_NOT, OP_ACOS, OP_ASIN, OP_ATAN, diff --git a/src/util/Expression.c b/src/util/Expression.c index 9b6156ef..a9728878 100644 --- a/src/util/Expression.c +++ b/src/util/Expression.c @@ -109,6 +109,7 @@ static struct {"*", binary, 4,OP_TIMES}, {"^", binary, 5,OP_POWER}, /* Unary Operators - these must have the highest precedence. */ + {"!", unary, 6, OP_NOT}, {"acos", unary, 6, OP_ACOS}, {"asin", unary, 6, OP_ASIN}, {"atan", unary, 6, OP_ATAN}, @@ -998,6 +999,9 @@ static int EvaluateUnary(uExpressionValue *retval, #define EVALUATEUNARY(retval, val) \ switch(opcode) \ { \ + case OP_NOT : \ + (retval) = !(val); \ + break; \ case OP_ACOS : \ (retval) = acos(val); \ break; \ |