Blender V4.3
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 (const struct ExprPyLike_Parsed *expr)
 
bool BLI_expr_pylike_is_constant (const struct ExprPyLike_Parsed *expr)
 
bool BLI_expr_pylike_is_using_param (const 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

typedef struct ExprPyLike_Parsed ExprPyLike_Parsed

Opaque structure containing pre-parsed data for evaluation.

Definition at line 16 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 19 of file BLI_expr_pylike_eval.h.

Function Documentation

◆ BLI_expr_pylike_eval()

◆ BLI_expr_pylike_free()

void BLI_expr_pylike_free ( struct ExprPyLike_Parsed * expr)

Free the parsed data; NULL argument is ok.

Definition at line 112 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 ( const struct ExprPyLike_Parsed * expr)

Check if the parsed expression always evaluates to the same value.

Referenced by expr_pylike_const_test(), and parse_for_eval().

◆ BLI_expr_pylike_is_using_param()

bool BLI_expr_pylike_is_using_param ( const struct ExprPyLike_Parsed * expr,
int index )

Check if the parsed expression uses the parameter with the given index.

Referenced by driver_check_simple_expr_depends_on_time(), and TEST().

◆ BLI_expr_pylike_is_valid()

bool BLI_expr_pylike_is_valid ( const 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 1057 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(), TEST(), and TEST().