Mathematic Expressions Library
0.1
The core math data structures and manipulators
|
A compact math expression engine. More...
Go to the source code of this file.
Data Structures | |
struct | expression_data_tree |
Expression data container for the expanded expression. More... | |
union | expression_data |
Expression data container. More... | |
struct | expression |
The stored representation of mathematical expressions. More... | |
Macros | |
#define | EXP_BUF_SIZE 256 |
Typedefs | |
typedef char | exp_buf[EXP_BUF_SIZE] |
Enumerations | |
enum | expression_type { EXP_VALUE, EXP_TREE, EXP_SYMBOLIC } |
Expression types. More... | |
Functions | |
expression_t | expression_new (void) |
New blank expression. More... | |
expression_t | expression_new_value (value_t val) |
expression_t | expression_new_tree (char op, expression_t left, expression_t right) |
expression_t | expression_new_sym (sym_t sym) |
void | expression_free (expression_t exp) |
Free an expression. More... | |
value_t | expression_evaluate (expression_t exp) |
void | expression_to_string (char *dst_str, expression_t src_exp) |
Expression to String. More... | |
expression_t | string_to_expression (size_t str_len, char const *str) |
Convert String to an Expression. More... | |
A compact math expression engine.
#define EXP_BUF_SIZE 256 |
typedef char exp_buf[EXP_BUF_SIZE] |
enum expression_type |
Expression types.
This is an enumeration of expression_t's types. Specific types correspond to specific data containers in expression_data.
Enumerator | |
---|---|
EXP_VALUE | Contains a simple numeric values and undefines. |
EXP_TREE | An expression over an operation and sub-expression. |
EXP_SYMBOLIC | Symbolic named references. |
value_t expression_evaluate | ( | expression_t | exp | ) |
void expression_free | ( | expression_t | exp | ) |
Free an expression.
exp | The expression to free |
expression_t expression_new | ( | void | ) |
New blank expression.
This function creates the most basic empty expression.
expression_t expression_new_sym | ( | sym_t | sym | ) |
expression_t expression_new_tree | ( | char | op, |
expression_t | left, | ||
expression_t | right | ||
) |
expression_t expression_new_value | ( | value_t | val | ) |
void expression_to_string | ( | char * | dst_str, |
expression_t | src_exp | ||
) |
Expression to String.
expression_t string_to_expression | ( | size_t | str_len, |
char const * | str | ||
) |
Convert String to an Expression.
Parses a string into an expression.
str_len | Length of given string |
str | String to parse |
< Store original index
< Used to explore the presence of a symbol parameter