--- a/src/server/util/object.h Sat Oct 31 15:01:07 2015 +0100 +++ b/src/server/util/object.h Sat Oct 31 16:39:12 2015 +0100 @@ -90,67 +90,9 @@ int index; // used by NSAPIContext to link expression with result }; -enum OperandType { - EXPR_OP_NULL = 0, // no operand - EXPR_OP_STRING, // string literal - EXPR_OP_INTEGER, // integer literal - EXPR_OP_VAR, // variable - EXPR_OP_FUNC, // function, - EXPR_OP_EXPRESSION // operand is an expression -}; - -enum Operator { - OP_NOOP = 0, - OP_NOT, // not, ! - OP_AND, // and, && - OP_OR, // or, || - OP_XOR, // xor, ^ - OP_WILDCARD, // = - OP_REGEX, // =~ - OP_NREGEX, // !~ - OP_ADD, // + - OP_SUB, // - - OP_CAT, // . - OP_DEF, // defined - OP_DEXISTS, // -d - OP_FDEXISTS, // -e - OP_FEXISTS, // -f - OP_LEXISTS, // -l - OP_READABLE, // -r - OP_FSIZE, // -s - OP_UMAP, // -U - OP_LESS, // < - OP_LESSEQ, // <= - OP_GREATER, // > - OP_GREATEREQ, // >= - OP_STRLESS, // lt - OP_STRLESSEQ, // le - OP_STRGREATER, // gt - OP_STRGREATEREQ, // ge - OP_EQUAL, // == - OP_NOTEQUAL, // != - OP_STREQUAL, // eq - OP_STRNOTEQUAL, // ne -}; - -enum VarType { - VAR_NULL = 0, - VAR_STRING, - VAR_INTEGER, - VAR_BOOL -}; - struct Expression { - // type of the operands - OperandType optype[2]; - // operand data - void *opdata[2]; - // operator - Operator expr_operator; - // logical connective to next expression - Operator next_operator; - // next expression - Expression *next; + // TODO + int n; }; @@ -227,22 +169,9 @@ Condition* condition_from_str(pool_handle_t *pool, char *expr, size_t len); Expression* expression_from_str(pool_handle_t *pool, char *expr, size_t len); -Operator expr_operator(char *token, size_t len); - -/* - * get the type of the token - * - * returns - * 0: operand - * 1: operator - */ -int expr_token_type(char *token, size_t len); -void expr_set_op(pool_handle_t *pool, OperandType *type, void **val, char *token, size_t len); - int condition_evaluate(Condition *condition, Session *sn, Request *rq); -int expression_evaluate(Expression *ex, Session *sn, Request *rq); -int expr_get_var(char *var, Session *sn, Request *rq, void **val, VarType *t); + #ifdef __cplusplus }