Blender
V3.3
|
Go to the source code of this file.
Typedefs | |
typedef struct ExprPyLike_Parsed | ExprPyLike_Parsed |
typedef enum eExprPyLike_EvalStatus | eExprPyLike_EvalStatus |
Enumerations | |
enum | eExprPyLike_EvalStatus { EXPR_PYLIKE_SUCCESS = 0 , EXPR_PYLIKE_DIV_BY_ZERO , EXPR_PYLIKE_MATH_ERROR , EXPR_PYLIKE_INVALID , EXPR_PYLIKE_FATAL_ERROR } |
Functions | |
void | BLI_expr_pylike_free (struct ExprPyLike_Parsed *expr) |
bool | BLI_expr_pylike_is_valid (struct ExprPyLike_Parsed *expr) |
bool | BLI_expr_pylike_is_constant (struct ExprPyLike_Parsed *expr) |
bool | BLI_expr_pylike_is_using_param (struct ExprPyLike_Parsed *expr, int index) |
ExprPyLike_Parsed * | BLI_expr_pylike_parse (const char *expression, const char **param_names, int param_names_len) |
eExprPyLike_EvalStatus | BLI_expr_pylike_eval (struct ExprPyLike_Parsed *expr, const double *param_values, int param_values_len, double *r_result) |
typedef enum eExprPyLike_EvalStatus eExprPyLike_EvalStatus |
Expression evaluation return code.
typedef struct ExprPyLike_Parsed ExprPyLike_Parsed |
Opaque structure containing pre-parsed data for evaluation.
Definition at line 1 of file BLI_expr_pylike_eval.h.
Expression evaluation return code.
Enumerator | |
---|---|
EXPR_PYLIKE_SUCCESS | |
EXPR_PYLIKE_DIV_BY_ZERO | |
EXPR_PYLIKE_MATH_ERROR | |
EXPR_PYLIKE_INVALID | |
EXPR_PYLIKE_FATAL_ERROR |
Definition at line 18 of file BLI_expr_pylike_eval.h.
eExprPyLike_EvalStatus BLI_expr_pylike_eval | ( | struct ExprPyLike_Parsed * | expr, |
const double * | param_values, | ||
int | param_values_len, | ||
double * | r_result | ||
) |
Evaluate the expression with the given parameters. The order and number of parameters must match the names given to parse.
Definition at line 151 of file expr_pylike_eval.c.
References ExprOp::arg, BLI_array_alloca, BLI_expr_pylike_is_valid(), CLAMP_MAX, CLAMP_MIN, ExprOp::dval, EXPR_PYLIKE_DIV_BY_ZERO, EXPR_PYLIKE_FATAL_ERROR, EXPR_PYLIKE_INVALID, EXPR_PYLIKE_MATH_ERROR, EXPR_PYLIKE_SUCCESS, FAIL_IF, ExprOp::ival, ExprPyLike_Parsed::max_stack, OPCODE_CMP_CHAIN, OPCODE_CONST, OPCODE_FUNC1, OPCODE_FUNC2, OPCODE_FUNC3, OPCODE_JMP, OPCODE_JMP_AND, OPCODE_JMP_ELSE, OPCODE_JMP_OR, OPCODE_MAX, OPCODE_MIN, OPCODE_PARAMETER, ExprPyLike_Parsed::ops, and ExprPyLike_Parsed::ops_count.
Referenced by driver_evaluate_simple_expr(), expr_pylike_const_test(), expr_pylike_error_test(), TEST(), and verify_eval_result().
void BLI_expr_pylike_free | ( | struct ExprPyLike_Parsed * | expr | ) |
Free the parsed data; NULL argument is ok.
Definition at line 111 of file expr_pylike_eval.c.
References MEM_freeN, and NULL.
Referenced by BKE_driver_invalidate_expression(), driver_compile_simple_expr(), and fcurve_free_driver().
bool BLI_expr_pylike_is_constant | ( | struct ExprPyLike_Parsed * | expr | ) |
Check if the parsed expression always evaluates to the same value.
Definition at line 123 of file expr_pylike_eval.c.
References NULL, ExprOp::opcode, OPCODE_CONST, ExprPyLike_Parsed::ops, and ExprPyLike_Parsed::ops_count.
Referenced by expr_pylike_const_test(), and parse_for_eval().
bool BLI_expr_pylike_is_using_param | ( | struct ExprPyLike_Parsed * | expr, |
int | index | ||
) |
Check if the parsed expression uses the parameter with the given index.
Definition at line 128 of file expr_pylike_eval.c.
References ExprOp::arg, ExprOp::ival, NULL, ExprOp::opcode, OPCODE_PARAMETER, ExprPyLike_Parsed::ops, and ExprPyLike_Parsed::ops_count.
Referenced by driver_check_simple_expr_depends_on_time(), and TEST().
bool BLI_expr_pylike_is_valid | ( | struct ExprPyLike_Parsed * | expr | ) |
Check if the parsing result is valid for evaluation.
Definition at line 118 of file expr_pylike_eval.c.
References NULL, and ExprPyLike_Parsed::ops_count.
Referenced by BKE_driver_has_simple_expression(), BLI_expr_pylike_eval(), driver_try_evaluate_simple_expr(), expr_pylike_const_test(), expr_pylike_parse_fail_test(), parse_for_eval(), and TEST().
ExprPyLike_Parsed* BLI_expr_pylike_parse | ( | const char * | expression, |
const char ** | param_names, | ||
int | param_names_len | ||
) |
Compile the expression and return the result.
Parse the expression for evaluation later. Returns non-NULL even on failure; use is_valid to check.
Definition at line 1052 of file expr_pylike_eval.c.
References BLI_assert, ExprPyLike_Parsed::max_stack, MEM_callocN, MEM_freeN, MEM_mallocN, ExprPyLike_Parsed::ops, ExprPyLike_Parsed::ops_count, parse_expr(), parse_next_token(), and state.
Referenced by driver_compile_simple_expr_impl(), expr_pylike_const_test(), expr_pylike_parse_fail_test(), parse_for_eval(), and TEST().