SIP-router core :: rvalue expressionsModule: SIP-router core. More...
#include "rvalue.h"#include <stdlib.h>
Go to the source code of this file.
Definition in file rvalue.c.
| #define rval_get_int_handle_ret | ( | ret, | ||
| txt, | ||||
| rve | ||||
| ) |
do { \ if (unlikely((ret)<0)) { \ RVE_LOG(L_WARN, rve, txt); \ (ret)=0; \ } \ }while(0)
check if the return code is an rval_get_int error and if so handle the error (e.g. print a log message, ignore the error by setting ret to 0 a.s.o.)
| ret | - retcode as returned by rval_get_int() (might be changed) | |
| txt | - warning message txt (no pointer allowed) | |
| rve | - rval_expr, used to access the config. pos |
Definition at line 1050 of file rvalue.c.
Referenced by rval_expr_eval(), rval_expr_eval_int(), and rval_expr_eval_rvint().
| #define RVE_LOG | ( | lev, | ||
| rve, | ||||
| txt | ||||
| ) |
| static int bool_rvstrop2 | ( | enum rval_expr_op | op, | |
| int * | res, | |||
| struct rvalue * | rv1, | |||
| struct rvalue * | rv2 | |||
| ) | [inline, static] |
Warning: rv1 & rv2 must be RV_STR
Definition at line 1449 of file rvalue.c.
References _str::len, RV_RE_F, RVE_DIFF_OP, RVE_EQ_OP, RVE_MATCH_OP, RVE_STRDIFF_OP, RVE_STREQ_OP, and _str::s.
Referenced by rval_str_lop2().

| static int fix_match_rve | ( | struct rval_expr * | rve | ) | [static] |
Definition at line 2976 of file rvalue.c.
References fix_rval_expr(), RV_RE_ALLOCED_F, RV_RE_F, rval_destroy(), rval_expr_eval(), rval_get_str(), rve_guess_type(), rve_is_constant(), and rve_replace_with_val().

| int fix_rval_expr | ( | void * | p | ) |
fixes action, bexprs, resolves selects, pvars and optimizes simple sub expressions (e.g. 1+2).
| p | - pointer to a rval_expr |
Definition at line 3778 of file rvalue.c.
Referenced by fix_match_rve().

| static int int_intop1 | ( | int * | res, | |
| enum rval_expr_op | op, | |||
| int | v | |||
| ) | [inline, static] |
Definition at line 1337 of file rvalue.c.
References RVE_BNOT_OP, RVE_BOOL_OP, RVE_LNOT_OP, and RVE_UMINUS_OP.
Referenced by rval_expr_eval_int(), and rval_intop1().

| static int int_intop2 | ( | int * | res, | |
| enum rval_expr_op | op, | |||
| int | v1, | |||
| int | v2 | |||
| ) | [inline, static] |
Definition at line 1364 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, and RVE_PLUS_OP.
Referenced by rval_expr_eval(), rval_expr_eval_int(), rval_expr_eval_rvint(), and rval_intop2().

| static int int_rve_defined | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| int * | res, | |||
| struct rval_expr * | rve | |||
| ) | [inline, static] |
| h | run action context | |
| msg | SIP message | |
| res | - set to 1 defined, 0 not defined | |
| rve | rvalue expression |
Definition at line 1884 of file rvalue.c.
References rv_defined(), and RVE_RVAL_OP.
Referenced by rval_expr_eval_int().


| static int int_strop1 | ( | int * | res, | |
| enum rval_expr_op | op, | |||
| str * | s1 | |||
| ) | [inline, static] |
Definition at line 1497 of file rvalue.c.
References _str::len, RVE_STREMPTY_OP, and RVE_STRLEN_OP.
Referenced by rval_int_strop1().

| struct rval_expr* mk_rval_expr1 | ( | enum rval_expr_op | op, | |
| struct rval_expr * | rve1, | |||
| struct cfg_pos * | pos | |||
| ) | [read] |
rval_expr ret= op rve1
| op | - rval expr. unary operator | |
| rve1 | - rval expr. on which the operator will act. | |
| pos | configuration position |
Definition at line 2591 of file rvalue.c.
References RVE_BNOT_OP, RVE_BOOL_OP, RVE_DEFINED_OP, RVE_INT_OP, RVE_LNOT_OP, RVE_STR_OP, RVE_STREMPTY_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
| struct rval_expr* mk_rval_expr2 | ( | enum rval_expr_op | op, | |
| struct rval_expr * | rve1, | |||
| struct rval_expr * | rve2, | |||
| struct cfg_pos * | pos | |||
| ) | [read] |
from 2 other rval exprs, using op ret = rve1 op rve2
| op | - rval expr. operator | |
| rve1 | - rval expr. on which the operator will act. | |
| rve2 | - rval expr. on which the operator will act. | |
| pos | configuration position |
Definition at line 2632 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_PLUS_OP, RVE_STRDIFF_OP, and RVE_STREQ_OP.
| struct rval_expr* mk_rval_expr_v | ( | enum rval_type | rv_type, | |
| void * | val, | |||
| struct cfg_pos * | pos | |||
| ) | [read] |
create a RVE_RVAL_OP rval_expr, containing a single rval of the given type
| rv_type | - rval type | |
| val | - rval value | |
| pos | - config position |
Definition at line 2526 of file rvalue.c.
References rval_init().

| static int rv_defined | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| int * | res, | |||
| struct rvalue * | rv, | |||
| struct rval_cache * | cache | |||
| ) | [inline, static] |
| h | run action context | |
| msg | SIP message | |
| res | set to the result 1 is defined, 0 not defined | |
| rv | rvalue | |
| cache | rvalue cache |
Definition at line 1819 of file rvalue.c.
Referenced by int_rve_defined().

| struct rvalue* rval_convert | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| enum rval_type | type, | |||
| struct rvalue * | v, | |||
| struct rval_cache * | c | |||
| ) | [read] |
Convert a rvalue to another rvalue, of a specific type. The result is read-only in most cases (can be a reference to another rvalue, can be checked by using rv_chg_in_place()) and _must_ be rval_destroy()'ed.
| h | run action context | |
| msg | SIP mesasge | |
| type | - type to convert to | |
| v | - rvalue to convert | |
| c | - rval_cache (cached v value if known/filled by another function), can be 0 (unknown/not needed) |
Definition at line 1294 of file rvalue.c.
References rval_cache_clean(), rval_cache_init, rval_get_int(), rval_get_tmp_str(), rval_new(), and rval_new_str().
Referenced by rval_expr_eval(), rval_int_strop1(), rval_intop1(), rval_intop2(), rval_str_add2(), and rval_str_lop2().


| void rval_destroy | ( | struct rvalue * | rv | ) |
frees a rval_new(), rval_convert() or rval_expr_eval() returned rval.
Note: it will be freed only when refcnt reaches 0
Definition at line 130 of file rvalue.c.
References RV_RE_F, RV_RV_ALLOCED_F, and rv_unref.
Referenced by exp_optimize_left(), exp_optimize_right(), fix_match(), fix_match_rve(), lval_assign(), rval_expr_eval(), rval_expr_eval_int(), rval_expr_eval_new(), rval_expr_eval_rvint(), rval_int_strop1(), rval_intop1(), rval_intop2(), rval_str_add2(), rval_str_lop2(), rve_destroy(), rve_opt_01(), and rve_replace_with_val().

| struct rvalue* rval_expr_eval | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| struct rval_expr * | rve | |||
| ) | [read] |
| h | run action context | |
| msg | SIP message | |
| rve | rvalue expression |
Definition at line 2314 of file rvalue.c.
References int_intop2(), rval_cache_clean(), rval_cache_init, rval_convert(), rval_destroy(), rval_expr_eval(), rval_expr_eval_int(), rval_get_btype(), rval_get_int(), rval_get_int_handle_ret, rval_new(), rval_str_add2(), RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
Referenced by fix_match(), fix_match_rve(), lval_assign(), rval_expr_eval(), rval_expr_eval_int(), rval_expr_eval_new(), and rval_expr_eval_rvint().


| int rval_expr_eval_int | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| int * | res, | |||
| struct rval_expr * | rve | |||
| ) |
*res=(int)eval(rve)
Definition at line 1903 of file rvalue.c.
References int_intop1(), int_intop2(), int_rve_defined(), rval_cache_clean(), rval_cache_init, rval_destroy(), rval_expr_eval(), rval_expr_eval_int(), rval_expr_eval_rvint(), rval_get_int(), rval_get_int_handle_ret, rval_int_strop1(), rval_str_lop2(), RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
Referenced by fix_switch(), rval_expr_eval(), rval_expr_eval_int(), and rval_expr_eval_rvint().


| struct rvalue* rval_expr_eval_new | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| struct rval_expr * | rve | |||
| ) | [read] |
like rval_expr_eval, but always returns a new rvalue (never a reference to an exisiting one). WARNING: result must be rval_destroy()'ed if non-null (it might be a reference to another rval). The result can be modified only if rv_chg_in_place() returns true.
Definition at line 2501 of file rvalue.c.
References rval_destroy(), rval_expr_eval(), and rval_new().
Referenced by rve_opt_01().


| int rval_expr_eval_rvint | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| struct rvalue ** | res_rv, | |||
| int * | res_i, | |||
| struct rval_expr * | rve, | |||
| struct rval_cache * | cache | |||
| ) |
| h | run action context | |
| msg | SIP message | |
| res_rv | pointer to rvalue result, if non-null it means the expression evaluated to a non-int (str), which will be stored here. | |
| res_i | pointer to int result, if res_rv==0 and the function returns success => the result is an int which will be stored here. | |
| rve | expression that will be evaluated. | |
| cache | write-only value cache, it might be filled if non-null and empty (rval_cache_init()). If non-null, it _must_ be rval_cache_clean()'ed when done. |
Definition at line 2169 of file rvalue.c.
References int_intop2(), rval_cache_clean(), rval_cache_init, rval_destroy(), rval_expr_eval(), rval_expr_eval_int(), rval_expr_eval_rvint(), rval_get_btype(), rval_get_int(), rval_get_int_handle_ret, rval_str_add2(), RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
Referenced by rval_expr_eval_int(), and rval_expr_eval_rvint().


| static enum rval_type rval_get_btype | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| struct rvalue * | rv, | |||
| struct rval_cache * | val_cache | |||
| ) | [inline, static] |
Given a rvalue it tries to determinte its basic type. Fills val_cache if non-null and empty (can be used in other rval* function calls, to avoid re-resolving avps or pvars). It must be rval_cache_clean()'en when no longer needed.
| h | run action context | |
| msg | SIP message | |
| rv | target rvalue | |
| val_cache | write-only value cache, might be filled if non-null, it _must_ be rval_cache_clean()'en when done. |
Definition at line 389 of file rvalue.c.
References rval_cache::avp_val, and rval_cache::pval.
Referenced by rval_expr_eval(), and rval_expr_eval_rvint().

| int rval_get_int | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| int * | i, | |||
| struct rvalue * | rv, | |||
| struct rval_cache * | cache | |||
| ) |
*i=(int)rv if rv == undefined select, avp or pvar, return 0. if an error occurs while evaluating a select, avp or pvar, behave as for the undefined case (and return success).
| h | - script context handle | |
| msg | - sip msg | |
| i | - pointer to int, where the conversion result will be stored | |
| rv | - rvalue to be converted | |
| cache | - cached rv value (read-only), can be 0 |
Definition at line 889 of file rvalue.c.
References rval_cache::avp_val, _str::len, rval_cache::pval, run_actions_safe(), and _str::s.
Referenced by rval_convert(), rval_expr_eval(), rval_expr_eval_int(), rval_expr_eval_rvint(), and rve_replace_with_ct_rv().


| int rval_get_str | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| str * | s, | |||
| struct rvalue * | rv, | |||
| struct rval_cache * | cache | |||
| ) |
*s=(str)rv The result is pkg malloc'ed (so it should be pkg_free()'ed when finished.
Definition at line 1250 of file rvalue.c.
References _str::len, rval_cache_clean(), rval_cache_init, rval_get_tmp_str(), and _str::s.
Referenced by fix_match(), fix_match_rve(), and rve_replace_with_ct_rv().


| int rval_get_tmp_str | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| str * | tmpv, | |||
| struct rvalue * | rv, | |||
| struct rval_cache * | cache, | |||
| struct rval_cache * | tmp_cache | |||
| ) |
get the string value of an rv in a tmp variable
if an error occurs while evaluating a select, avp or pvar, behave as for the undefined case (and return success). The result points either inside the passed rv, inside new_cache or inside an avp. new_cache must be non zero, initialized previously and it _must_ be rval_cache_clean(...)'ed when done. WARNING: it's not intended for general use. It might return a pointer inside rv so the result _must_ be treated as read-only. rv and new_cache must not be released/freed until the result is no longer needed. For general use see rval_get_str().
| h | - script context handle | |
| msg | - sip msg | |
| tmpv | - str return value (pointer to a str struct that will be be filled with the conversion result) | |
| rv | - rvalue to be converted | |
| cache | - cached rv value (read-only), can be 0 | |
| tmp_cache | - used for temporary storage (so that tmpv will not point to possible freed data), it must be non-null, initialized and cleaned afterwards. |
Definition at line 1102 of file rvalue.c.
References rval_cache::avp_val, rval_cache::i2s, _str::len, rval_cache::pval, run_actions_safe(), _str::s, and sint2strbuf().
Referenced by rval_convert(), and rval_get_str().


| void rval_init | ( | struct rvalue * | rv, | |
| enum rval_type | t, | |||
| union rval_val * | v, | |||
| int | flags | |||
| ) |
inits a rvalue structure-
Note: not needed if the structure is allocate with one of the rval_new* functions
Definition at line 208 of file rvalue.c.
Referenced by mk_rval_expr_v(), and rve_replace_with_val().

| static int rval_int_strop1 | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| int * | res, | |||
| enum rval_expr_op | op, | |||
| struct rvalue * | l, | |||
| struct rval_cache * | c1 | |||
| ) | [inline, static] |
Integer operation on rval evaluated as string, can use cached rvalues (c1 & c2).
| h | run action context | |
| msg | SIP message | |
| res | will be set to the result | |
| op | rvalue expression operation | |
| l | rvalue | |
| c1 | rvalue cache |
Definition at line 1781 of file rvalue.c.
References int_strop1(), rval_convert(), and rval_destroy().
Referenced by rval_expr_eval_int().


| static struct rvalue* rval_intop1 | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| enum rval_expr_op | op, | |||
| struct rvalue * | v | |||
| ) | [static, read] |
Definition at line 1519 of file rvalue.c.
References int_intop1(), rval_convert(), rval_destroy(), and rval_new().

| static struct rvalue* rval_intop2 | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| enum rval_expr_op | op, | |||
| struct rvalue * | l, | |||
| struct rvalue * | r | |||
| ) | [static, read] |
Definition at line 1562 of file rvalue.c.
References int_intop2(), rval_convert(), rval_destroy(), and rval_new().

| struct rvalue* rval_new | ( | enum rval_type | t, | |
| union rval_val * | v, | |||
| int | extra_size | |||
| ) | [read] |
| t | rvalue type | |
| v | rvalue value | |
| extra_size | extra space to allocate (so that future string operation can reuse the space) |
Definition at line 351 of file rvalue.c.
References rval_new_empty(), and rval_new_str().
Referenced by rval_convert(), rval_expr_eval(), rval_expr_eval_new(), rval_intop1(), rval_intop2(), and rval_str_add2().


| struct rvalue* rval_new_empty | ( | int | extra_size | ) | [read] |
allocates a new rval (should be freed by rval_destroy()).
| extra_size | - extra space to allocate (e.g.: so that future string operation can reuse the space) |
Definition at line 230 of file rvalue.c.
Referenced by rval_new(), rval_new_re(), and rval_new_str().

| struct rvalue* rval_new_re | ( | str * | s | ) | [read] |
It acts as rval_new_str, but also compiles a RE from the str and sets v->re.regex.
| s | - pointer to str, must be non-null, zero-term'ed and a valid RE. |
Definition at line 279 of file rvalue.c.
References _str::len, rval_new_empty(), and _str::s.

| struct rvalue* rval_new_str | ( | str * | s, | |
| int | extra_size | |||
| ) | [read] |
| s | - pointer to str, must be non-null | |
| extra_size | - extra space to allocate (so that future string operation can reuse the space) |
Definition at line 256 of file rvalue.c.
References _str::len, rval_new_empty(), and _str::s.
Referenced by rval_convert(), and rval_new().


| static struct rvalue* rval_str_add2 | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| struct rvalue * | l, | |||
| struct rval_cache * | c1, | |||
| struct rvalue * | r, | |||
| struct rval_cache * | c2 | |||
| ) | [static, read] |
r (returns a rvalue). Can use cached rvalues (c1 & c2).
Definition at line 1618 of file rvalue.c.
References _str::len, RV_CNT_ALLOCED_F, rval_convert(), rval_destroy(), rval_new(), and _str::s.
Referenced by rval_expr_eval(), and rval_expr_eval_rvint().


| static int rval_str_lop2 | ( | struct run_act_ctx * | h, | |
| struct sip_msg * | msg, | |||
| int * | res, | |||
| enum rval_expr_op | op, | |||
| struct rvalue * | l, | |||
| struct rval_cache * | c1, | |||
| struct rvalue * | r, | |||
| struct rval_cache * | c2 | |||
| ) | [inline, static] |
Can use cached rvalues (c1 & c2).
Definition at line 1737 of file rvalue.c.
References bool_rvstrop2(), rval_convert(), and rval_destroy().
Referenced by rval_expr_eval_int().


| char* rval_type_name | ( | enum rval_type | type | ) |
| int rve_check_type | ( | enum rval_type * | type, | |
| struct rval_expr * | rve, | |||
| struct rval_expr ** | bad_rve, | |||
| enum rval_type * | bad_t, | |||
| enum rval_type * | exp_t | |||
| ) |
| type | filled with the type of the expression (RV_INT, RV_STR or RV_NONE if it's dynamic) | |
| rve | checked expression | |
| bad_rve | set on failure to the subexpression for which the type check failed | |
| bad_t | set on failure to the type of the bad subexpression | |
| exp_t | set on failure to the expected type for the bad subexpression |
Definition at line 690 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, rve_check_type(), RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, rve_guess_type(), RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
Referenced by rve_check_type().


| void rve_destroy | ( | struct rval_expr * | rve | ) |
Definition at line 156 of file rvalue.c.
References rval_destroy(), rve_destroy(), and RVE_RVAL_OP.
Referenced by fix_match(), fix_switch(), rve_destroy(), rve_opt_01(), and rve_replace_with_val().


| enum rval_type rve_guess_type | ( | struct rval_expr * | rve | ) |
Definition at line 482 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, rve_guess_type(), RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
Referenced by fix_match_rve(), rve_check_type(), and rve_guess_type().


| int rve_has_side_effects | ( | struct rval_expr * | rve | ) |
returns true if the expression can have side-effect
Definition at line 617 of file rvalue.c.
References rve_is_constant().
Referenced by fix_match(), and fix_switch().


| int rve_is_constant | ( | struct rval_expr * | rve | ) |
Definition at line 550 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, rve_is_constant(), RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
Referenced by fix_match(), fix_match_rve(), fix_switch(), rve_has_side_effects(), rve_is_constant(), and rve_opt_01().


| static int rve_op_is_assoc | ( | enum rval_expr_op | op | ) | [static] |
Definition at line 2683 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
| static int rve_op_is_commutative | ( | enum rval_expr_op | op | ) | [static] |
Definition at line 2738 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
| static int rve_op_unary | ( | enum rval_expr_op | op | ) | [static] |
Definition at line 627 of file rvalue.c.
References RVE_BAND_OP, RVE_BLSHIFT_OP, RVE_BNOT_OP, RVE_BOOL_OP, RVE_BOR_OP, RVE_BRSHIFT_OP, RVE_BXOR_OP, RVE_CONCAT_OP, RVE_DEFINED_OP, RVE_DIFF_OP, RVE_DIV_OP, RVE_EQ_OP, RVE_GT_OP, RVE_GTE_OP, RVE_IDIFF_OP, RVE_IEQ_OP, RVE_INT_OP, RVE_IPLUS_OP, RVE_LAND_OP, RVE_LNOT_OP, RVE_LOR_OP, RVE_LT_OP, RVE_LTE_OP, RVE_MATCH_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_NONE_OP, RVE_PLUS_OP, RVE_RVAL_OP, RVE_STR_OP, RVE_STRDIFF_OP, RVE_STREMPTY_OP, RVE_STREQ_OP, RVE_STRLEN_OP, and RVE_UMINUS_OP.
Referenced by rve_replace_with_val().

| static int rve_opt_01 | ( | struct rval_expr * | rve, | |
| enum rval_type | rve_type | |||
| ) | [static] |
Note: internal use only from rve_optimize It should be called after ct optimization, for non-contant expressions (the left or right side is not constant).
Definition at line 3056 of file rvalue.c.
References rval_destroy(), rval_expr_eval_new(), RVE_BAND_OP, RVE_BOR_OP, RVE_CONCAT_OP, rve_destroy(), RVE_DIV_OP, RVE_EQ_OP, RVE_INT_OP, RVE_IPLUS_OP, rve_is_constant(), RVE_LAND_OP, RVE_LOR_OP, RVE_MINUS_OP, RVE_MOD_OP, RVE_MUL_OP, RVE_PLUS_OP, rve_replace_with_ct_rv(), RVE_RVAL_OP, RVE_STR_OP, and RVE_STREQ_OP.

| static int rve_optimize | ( | struct rval_expr * | rve | ) | [static] |
| static int rve_replace_with_ct_rv | ( | struct rval_expr * | rve, | |
| struct rvalue * | rv | |||
| ) | [static] |
| rve | - expression to be replaced (in-place) | |
| rv | - pointer to the replacement _constant_ rvalue structure |
Definition at line 2937 of file rvalue.c.
References rval_get_int(), rval_get_str(), and rve_replace_with_val().
Referenced by rve_opt_01().


| static int rve_replace_with_val | ( | struct rval_expr * | rve, | |
| enum rval_type | type, | |||
| union rval_val * | v, | |||
| int | flags | |||
| ) | [static] |
| rve | expression to be replaced (in-place) | |
| type | rvalue type | |
| v | pointer to a rval_val union containing the replacement value. | |
| flags | value flags (how it was alloc'ed, e.g.: RV_CNT_ALLOCED_F) |
Definition at line 2904 of file rvalue.c.
References rval_destroy(), rval_init(), rve_destroy(), rve_op_unary(), and RVE_RVAL_OP.
Referenced by fix_match_rve(), and rve_replace_with_ct_rv().


1.7.1