libamxp
1.4.0
Patterns C Implementation
|
#include <sys/resource.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <regex.h>
#include <amxc/amxc.h>
#include <amxc/amxc_macros.h>
#include "amxp_expr_priv.h"
#include "amxp_expr.tab.h"
Go to the source code of this file.
Data Structures | |
struct | _amxp_expr_vfunc |
struct | _amxp_expr_bfunc |
struct | _amxp_regexp |
Macros | |
#define | _GNU_SOURCE |
#define | REGEXP_STORE_SIZE 40 |
Typedefs | |
typedef struct _amxp_expr_vfunc | amxp_expr_vfunc_t |
typedef struct _amxp_expr_bfunc | amxp_expr_bfunc_t |
typedef struct _amxp_regexp | amxp_regexp_t |
Functions | |
static void | amxp_regexp_clean (amxc_llist_it_t *it) |
static amxp_regexp_t * | amxp_regexp_get (const char *regexp_str) |
static CONSTRUCTOR void | amxp_regexp_store_init (void) |
static DESTRUCTOR void | amxp_regexp_store_cleanup (void) |
static void | amxp_expr_vfunc_hit_free (UNUSED const char *key, amxc_htable_it_t *it) |
static void | amxp_expr_bfunc_hit_free (UNUSED const char *key, amxc_htable_it_t *it) |
static ssize_t | amxp_expr_string_reader (amxp_expr_t *expr, void *buf, size_t max_size) |
static bool | amxp_expr_match_regexp (amxp_expr_t *expr, amxc_var_t *lvalue, amxc_var_t *rvalue) |
static bool | amxp_expr_string_check (const char *lstr, size_t llength, const char *rstr, size_t rlength, amxp_expr_comp_t comperator) |
static bool | amxp_expr_string_head_tail_check (amxc_var_t *lvalue, amxc_var_t *rvalue, amxp_expr_comp_t comperator) |
static bool | amxp_expr_in_list (amxc_var_t *lvalue, amxc_var_t *rvalue) |
static bool | amxp_expr_in_string (amxc_var_t *lvalue, amxc_var_t *rvalue) |
static bool | amxp_expr_equals_ignorecase (amxc_var_t *lvalue, amxc_var_t *rvalue) |
static bool | amxp_expr_is_simple_type (amxc_var_t *value) |
static bool | amxp_expr_are_simple_types (amxc_var_t *lvalue, amxc_var_t *rvalue) |
static bool | amxp_expr_in (amxp_expr_t *expr, amxc_var_t *lvalue, amxc_var_t *rvalue) |
static bool | amxp_expr_comperator (int result, amxp_expr_comp_t type) |
static amxp_expr_status_t | _value_first_of (UNUSED amxp_expr_t *expr, amxc_var_t *args, amxc_var_t *ret) |
static bool | _bool_is_empty (UNUSED amxp_expr_t *expr, amxc_var_t *args) |
static bool | _bool_contains (amxp_expr_t *expr, amxc_var_t *args) |
static bool | amxp_expr_is_safe_value (const char *string) |
static amxp_expr_status_t | amxp_expr_parse (amxp_expr_t *expr) |
void | amxp_expr_msg (amxp_expr_t *expr, const char *format,...) |
int | amxp_expr_printf (const char *format,...) |
bool | amxp_expr_compare (amxp_expr_t *expr, amxc_var_t *lvalue, amxc_var_t *rvalue, amxp_expr_comp_t comperator) |
amxp_expr_status_t | amxp_expr_call_value_func (amxp_expr_t *expr, const char *func, amxc_var_t *args, amxc_var_t *ret) |
bool | amxp_expr_call_bool_func (amxp_expr_t *expr, const char *func, amxc_var_t *args) |
amxp_expr_status_t | amxp_expr_get_field (amxp_expr_t *expr, amxc_var_t *value, const char *path) |
amxp_expr_status_t | amxp_expr_new (amxp_expr_t **expr, const char *expression) |
Allocates and initializes an expression. More... | |
void | amxp_expr_delete (amxp_expr_t **expr) |
Deletes a previously allocated expression structure. More... | |
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... | |
amxp_expr_status_t | amxp_expr_buildf_new (amxp_expr_t **expr, const char *expr_fmt,...) |
amxp_expr_status_t | amxp_expr_init (amxp_expr_t *expr, const char *expression) |
Initializes an expression structure. More... | |
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_buildf (amxp_expr_t *expr, const char *expr_fmt,...) |
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... | |
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... | |
CONSTRUCTOR_LVL (101) | |
DESTRUCTOR_LVL (101) | |
Variables | |
static amxc_htable_t | value_funcs |
static amxc_htable_t | bool_funcs |
static amxc_htable_t | regexp_store |
static amxc_llist_t | regexp_store_list |
#define _GNU_SOURCE |
Definition at line 56 of file amxp_expression_main.c.
#define REGEXP_STORE_SIZE 40 |
Definition at line 73 of file amxp_expression_main.c.
typedef struct _amxp_expr_bfunc amxp_expr_bfunc_t |
typedef struct _amxp_expr_vfunc amxp_expr_vfunc_t |
typedef struct _amxp_regexp amxp_regexp_t |
|
static |
Definition at line 412 of file amxp_expression_main.c.
|
static |
Definition at line 389 of file amxp_expression_main.c.
|
static |
Definition at line 367 of file amxp_expression_main.c.
|
static |
Definition at line 297 of file amxp_expression_main.c.
|
static |
Definition at line 129 of file amxp_expression_main.c.
amxp_expr_status_t amxp_expr_buildf | ( | amxp_expr_t * | expr, |
const char * | expr_fmt, | ||
... | |||
) |
Definition at line 755 of file amxp_expression_main.c.
amxp_expr_status_t amxp_expr_buildf_new | ( | amxp_expr_t ** | expr, |
const char * | expr_fmt, | ||
... | |||
) |
Definition at line 685 of file amxp_expression_main.c.
bool amxp_expr_call_bool_func | ( | amxp_expr_t * | expr, |
const char * | func, | ||
amxc_var_t * | args | ||
) |
Definition at line 586 of file amxp_expression_main.c.
amxp_expr_status_t amxp_expr_call_value_func | ( | amxp_expr_t * | expr, |
const char * | func, | ||
amxc_var_t * | args, | ||
amxc_var_t * | ret | ||
) |
Definition at line 567 of file amxp_expression_main.c.
bool amxp_expr_compare | ( | amxp_expr_t * | expr, |
amxc_var_t * | lvalue, | ||
amxc_var_t * | rvalue, | ||
amxp_expr_comp_t | comperator | ||
) |
Definition at line 519 of file amxp_expression_main.c.
|
static |
Definition at line 340 of file amxp_expression_main.c.
|
static |
Definition at line 275 of file amxp_expression_main.c.
amxp_expr_status_t amxp_expr_get_field | ( | amxp_expr_t * | expr, |
amxc_var_t * | value, | ||
const char * | path | ||
) |
Definition at line 606 of file amxp_expression_main.c.
|
static |
Definition at line 303 of file amxp_expression_main.c.
|
static |
Definition at line 236 of file amxp_expression_main.c.
|
static |
Definition at line 254 of file amxp_expression_main.c.
|
static |
Definition at line 443 of file amxp_expression_main.c.
|
static |
Definition at line 292 of file amxp_expression_main.c.
|
static |
Definition at line 145 of file amxp_expression_main.c.
void amxp_expr_msg | ( | amxp_expr_t * | expr, |
const char * | format, | ||
... | |||
) |
Definition at line 504 of file amxp_expression_main.c.
|
static |
Definition at line 462 of file amxp_expression_main.c.
int amxp_expr_printf | ( | const char * | format, |
... | |||
) |
Definition at line 511 of file amxp_expression_main.c.
|
static |
Definition at line 185 of file amxp_expression_main.c.
|
static |
Definition at line 206 of file amxp_expression_main.c.
|
static |
Definition at line 135 of file amxp_expression_main.c.
|
static |
Definition at line 123 of file amxp_expression_main.c.
|
static |
Definition at line 95 of file amxp_expression_main.c.
|
static |
Definition at line 102 of file amxp_expression_main.c.
|
static |
Definition at line 118 of file amxp_expression_main.c.
|
static |
Definition at line 113 of file amxp_expression_main.c.
CONSTRUCTOR_LVL | ( | 101 | ) |
Definition at line 861 of file amxp_expression_main.c.
DESTRUCTOR_LVL | ( | 101 | ) |
Definition at line 867 of file amxp_expression_main.c.
|
static |
Definition at line 91 of file amxp_expression_main.c.
|
static |
Definition at line 92 of file amxp_expression_main.c.
|
static |
Definition at line 93 of file amxp_expression_main.c.
|
static |
Definition at line 90 of file amxp_expression_main.c.