39 for (
int i = 0; arithmetic_functions[i].name != 0; ++i) {
40 table.
put_symbol(arithmetic_functions[i].name, arithmetic_functions[i].func);
43 for (
int i = 0; predefined_constants[i].name != 0; ++i) {
44 table.
put_symbol(predefined_constants[i].name, predefined_constants[i].val);
65 char *p =
const_cast<char *
>(
m_src.c_str()) +
m_pos;
70 while ((c ==
' ') || (c ==
'\t'))
76 if (c ==
'\0')
return 0;
84 IN_INT, IN_FRAC, IN_EXP, IN_EXP_DIGIT
89 for (i = 0; ; c = p[++i]) {
90 if (state == IN_INT) {
92 }
else if (c ==
'.') {
94 }
else if (c ==
'e') {
99 }
else if (state == IN_FRAC) {
101 }
else if (c ==
'e') {
106 }
else if ((state == IN_EXP) || (state == IN_EXP_DIGIT)) {
108 }
else if ((state == IN_EXP) && ((c ==
'+') || (c ==
'-'))) {
109 state = IN_EXP_DIGIT;
121 char *symbol = strdup(p);
123 char *symbol = strndup(p, i + 1);
140 for (i = 0; isalnum(p[i]) || p[i] ==
'.'; ++i) {
145 char *symbol = strdup(p);
147 char *symbol = strndup(p, i + 1);
170 parser.set_debug_level(
m_trace);
172 int retv = parser.parse();
194 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)
double(* function_t)(double)
void set_result(double result)
int next_token(semantic_type &yylval)