diff --git a/src/mod/applications/mod_expr/exprilfs.h b/src/mod/applications/mod_expr/exprilfs.h index 05abb5f12b..f89eadfadc 100644 --- a/src/mod/applications/mod_expr/exprilfs.h +++ b/src/mod/applications/mod_expr/exprilfs.h @@ -946,3 +946,35 @@ case EXPR_NODEFUNC_MANY: break; } + +/* logical and */ +case EXPR_NODEFUNC_LOGICAL_AND: +{ + err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); + + if (!err) + err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2); + + if (!err) { + *val = (EXPRTYPE) (((unsigned int)d1) & ((unsigned int)d2)); + } else + return err; + + break; +} + +/* or */ +case EXPR_NODEFUNC_LOGICAL_OR: +{ + err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); + + if (!err) + err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2); + + if (!err) { + *val = (EXPRTYPE) (((unsigned int)d1) | ((unsigned int)d2)); + } else + return err; + + break; +} diff --git a/src/mod/applications/mod_expr/exprinit.c b/src/mod/applications/mod_expr/exprinit.c index 82eadafe10..387aaee534 100644 --- a/src/mod/applications/mod_expr/exprinit.c +++ b/src/mod/applications/mod_expr/exprinit.c @@ -82,6 +82,8 @@ int exprFuncListInit(exprFuncList * flist) EXPR_ADDFUNC_TYPE("not", EXPR_NODEFUNC_NOT, 1, 1, 0, 0); EXPR_ADDFUNC_TYPE("for", EXPR_NODEFUNC_FOR, 4, -1, 0, 0); EXPR_ADDFUNC_TYPE("many", EXPR_NODEFUNC_MANY, 1, -1, 0, 0); + EXPR_ADDFUNC_TYPE("land", EXPR_NODEFUNC_LOGICAL_AND, 2, 2, 0, 0); + EXPR_ADDFUNC_TYPE("lor", EXPR_NODEFUNC_LOGICAL_OR, 2, 2, 0, 0); return EXPR_ERROR_NOERROR; } diff --git a/src/mod/applications/mod_expr/exprpriv.h b/src/mod/applications/mod_expr/exprpriv.h index 08d9fc0ddc..a11dc52c97 100644 --- a/src/mod/applications/mod_expr/exprpriv.h +++ b/src/mod/applications/mod_expr/exprpriv.h @@ -97,7 +97,9 @@ extern "C" { EXPR_NODEFUNC_OR, EXPR_NODEFUNC_NOT, EXPR_NODEFUNC_FOR, - EXPR_NODEFUNC_MANY + EXPR_NODEFUNC_MANY, + EXPR_NODEFUNC_LOGICAL_AND, + EXPR_NODEFUNC_LOGICAL_OR }; /* Forward declarations */