Blender  V3.3
Typedefs | Enumerations | Functions
BLI_expr_pylike_eval.h File Reference

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_ParsedBLI_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 Documentation

◆ eExprPyLike_EvalStatus

Expression evaluation return code.

◆ ExprPyLike_Parsed

Opaque structure containing pre-parsed data for evaluation.

Definition at line 1 of file BLI_expr_pylike_eval.h.

Enumeration Type Documentation

◆ eExprPyLike_EvalStatus

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.

Function Documentation

◆ BLI_expr_pylike_eval()

eExprPyLike_EvalStatus BLI_expr_pylike_eval ( struct ExprPyLike_Parsed expr,
const double param_values,
int  param_values_len,
double r_result 
)

◆ BLI_expr_pylike_free()

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().

◆ BLI_expr_pylike_is_constant()

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().

◆ BLI_expr_pylike_is_using_param()

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().

◆ BLI_expr_pylike_is_valid()

bool BLI_expr_pylike_is_valid ( struct ExprPyLike_Parsed expr)

◆ BLI_expr_pylike_parse()

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().