41 for (
int i = 0; arithmetic_functions[i].name != 0; ++i) {
42 table.
put_symbol(arithmetic_functions[i].name, arithmetic_functions[i].func);
45 for (
int i = 0; predefined_constants[i].name != 0; ++i) {
46 table.
put_symbol(predefined_constants[i].name, predefined_constants[i].val);
68 char *p =
const_cast<char *
>(
m_src.c_str()) +
m_pos;
73 while ((c ==
' ') || (c ==
'\t'))
79 if (c ==
'\0')
return 0;
87 IN_INT, IN_FRAC, IN_EXP, IN_EXP_DIGIT
92 for (i = 0; ; c = p[++i]) {
93 if (state == IN_INT) {
95 }
else if (c ==
'.') {
97 }
else if (c ==
'e') {
102 }
else if (state == IN_FRAC) {
104 }
else if (c ==
'e') {
109 }
else if ((state == IN_EXP) || (state == IN_EXP_DIGIT)) {
111 }
else if ((state == IN_EXP) && ((c ==
'+') || (c ==
'-'))) {
112 state = IN_EXP_DIGIT;
124 char *symbol = strdup(p);
126 char *symbol = strndup(p, i + 1);
143 for (i = 0; isalnum(p[i]) || p[i] ==
'.'; ++i) {
148 char *symbol = strdup(p);
150 char *symbol = strndup(p, i + 1);
174 parser.set_debug_level(
m_trace);
176 int retv = parser.parse();
197 int retv = parser.
parse();
function_t get_symbol_function(const std::string &name) const
bool put_symbol(const std::string &name, const double value)
void error(const std::string &msg)
double get_symbol_value(const std::string &name) const
function_t get_symbol_function(char const *name)
void general(const char *format,...)
static SymbolTable global_symbol_table
int yylex(EvalExpr::semantic_type *yylval, EvalExpr &driver)
void set_debug_level(debug_level_type l)
Set the current debugging level.
EvalExpr class for algebraic expression in parameter strings.
void paranoiac(const char *format,...)
double get_symbol_value(char const *name)
void set_result(double result)
int next_token(semantic_type &yylval)
double(* function_t)(double)