Merge pull request #1368 in FS/freeswitch from ~LAZEDO/freeswitch:feature/FS-10597 to master
* commit '72335514eed8e08f45d6d6ca61b7c605c7524af0': FS_10597: [mod_expr] add logic AND & OR
This commit is contained in:
commit
030612b3ec
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue