libamxp  1.4.0
Patterns C Implementation
amxp_expression.h File Reference

Ambiorix expression parser and evaluate API header file. More...

Go to the source code of this file.

Data Structures

struct  _amxp_expr
 

Typedefs

typedef struct _amxp_expr amxp_expr_t
 
typedef enum _expr_status amxp_expr_status_t
 Expression status/error codes. More...
 
typedef ssize_t(* amxp_expr_reader_t) (amxp_expr_t *expr, void *buf, size_t max_size)
 Expression reader function. More...
 
typedef amxp_expr_status_t(* amxp_expr_get_field_t) (amxp_expr_t *expr, amxc_var_t *value, const char *path, void *priv)
 Field fetcher function signature. More...
 
typedef amxp_expr_status_t(* amxp_expr_value_func_t) (amxp_expr_t *expr, amxc_var_t *args, amxc_var_t *ret)
 Callback function that can "calculate" a value. More...
 
typedef bool(* amxp_expr_bool_func_t) (amxp_expr_t *expr, amxc_var_t *args)
 Callback function that evaluates to true or false. More...
 
typedef struct _amxp_expr_node amxp_expr_node_t
 

Enumerations

enum  _expr_status {
  amxp_expr_status_ok , amxp_expr_status_unknown_error , amxp_expr_status_syntax_error , amxp_expr_status_field_not_found ,
  amxp_expr_status_invalid_regexp , amxp_expr_status_invalid_value , amxp_expr_status_function_not_found
}
 Expression status/error codes. More...
 

Functions

amxp_expr_status_t amxp_expr_new (amxp_expr_t **expr, const char *expression)
 Allocates and initializes an expression. More...
 
amxp_expr_status_t amxp_expr_buildf_new (amxp_expr_t **expr, const char *expr_fmt,...) __attribute__((format(printf
 Allocates and initializes an expression with format-string and safety checks. More...
 
amxp_expr_status_t amxp_expr_status_t amxp_expr_vbuildf_new (amxp_expr_t **expr, const char *expr_fmt, va_list args)
 va_list version of amxp_expr_buildf_new More...
 
void amxp_expr_delete (amxp_expr_t **expr)
 Deletes a previously allocated expression structure. More...
 
amxp_expr_status_t amxp_expr_buildf (amxp_expr_t *expr, const char *expr_fmt,...) __attribute__((format(printf
 Initializes an expression structure. More...
 
amxp_expr_status_t amxp_expr_status_t amxp_expr_vbuildf (amxp_expr_t *expr, const char *expr_fmt, va_list args)
 va_list version of amxp_expr_buildf More...
 
amxp_expr_status_t amxp_expr_init (amxp_expr_t *expr, const char *expression)
 Initializes an expression structure. More...
 
void amxp_expr_clean (amxp_expr_t *expr)
 Clean-up the expression structure. More...
 
void amxp_expr_dump_tree (amxp_expr_t *expr)
 Dumps the binary tree in dot formatted text file to stdout. More...
 
bool amxp_expr_evaluate (amxp_expr_t *expr, amxp_expr_get_field_t fn, void *priv, amxp_expr_status_t *status)
 Evaluates an expression. More...
 
bool amxp_expr_eval (amxp_expr_t *expr, amxp_expr_status_t *status)
 Evaluates an expression. More...
 
bool amxp_expr_eval_var (amxp_expr_t *expr, const amxc_var_t *const data, amxp_expr_status_t *status)
 Evaluates an expression against a composite variant. More...
 
int amxp_expr_find_var_paths (const amxc_var_t *const var, amxc_llist_t *paths, const char *path)
 Search matching variant paths in a composite variant. More...
 
int amxp_expr_find_var_values (const amxc_var_t *const var, amxc_htable_t *values, const char *path)
 Search matching variant paths in a composite variant. More...
 
amxc_var_t * amxp_expr_find_var (const amxc_var_t *const var, const char *path)
 Search a matching variant and returns a pointer to that variant. More...
 
amxp_expr_status_t amxp_expr_get_field_var (amxp_expr_t *expr, amxc_var_t *value, const char *path, void *priv)
 Variant field fetcher implementation. More...
 
bool amxp_expr_eval_set (amxp_expr_t *expr, const amxc_set_t *const data, amxp_expr_status_t *status)
 Evaluates an expression against a set. More...
 
amxp_expr_status_t amxp_expr_get_field_set (amxp_expr_t *expr, amxc_var_t *value, const char *path, void *priv)
 Flag field fetcher implementation for sets. More...
 
int amxp_expr_add_value_fn (const char *fn_name, amxp_expr_value_func_t fn)
 Adds a value calculation function. More...
 
int amxp_expr_add_bool_fn (const char *fn_name, amxp_expr_bool_func_t fn)
 Adds a boolean evaluation function. More...
 
const char * amxp_expr_get_string (amxp_expr_t *expr)
 Returns the string representation of the given expression. More...
 

Detailed Description

Ambiorix expression parser and evaluate API header file.

Definition in file amxp_expression.h.

Typedef Documentation

◆ amxp_expr_node_t

Definition at line 240 of file amxp_expression.h.

◆ amxp_expr_t

typedef struct _amxp_expr amxp_expr_t

Definition at line 1 of file amxp_expression.h.