Skip to main content

expr_context_new_empty

Function expr_context_new_empty 

Source
#[unsafe(no_mangle)]
pub extern "C" fn expr_context_new_empty() -> *mut ExprContext
Expand description

Create a new evaluation context without any pre-registered functions

This creates a context with no built-in functions or constants. Note that basic operators (+, -, *, /, %, <, >, <=, >=, ==, !=) are still available as they are handled by the parser, not the function registry.

§Returns

Pointer to new empty context, or NULL on allocation failure

§Safety

The returned pointer must be freed with expr_context_free()

§Example

ExprContext* ctx = expr_context_new_empty();
// Must register all functions manually
expr_context_add_function(ctx, "+", 2, add_func);
expr_context_add_function(ctx, "*", 2, mul_func);