Mathematic Expressions Library
0.1
The core math data structures and manipulators
|
A compact math expression engine. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "types.h"
#include "errors.h"
#include "symbolic.h"
#include "expression.h"
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... | |
size_t | number_len (size_t str_len, char *str) |
void | str_cpy (char *dest, const char *src, size_t count) |
Same as strncpy, but throws an error if a null character is reached in src. More... | |
expression_t | string_to_expression (size_t str_len, char const *str) |
Convert String to an Expression. More... | |
A compact math expression engine.
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.
size_t number_len | ( | size_t | str_len, |
char * | str | ||
) |
void str_cpy | ( | char * | dest, |
const char * | src, | ||
size_t | count | ||
) |
Same as strncpy, but throws an error if a null character is reached in src.
dest | Destination string buffer. |
src | Source string buffer. |
count | The number of bytes to copy. |
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