49 for (
int i = 0; arithmetic_functions[i].name != 0; ++i) {
50 table.
put_symbol(arithmetic_functions[i].name, arithmetic_functions[i].func);
53 for (
int i = 0; predefined_constants[i].name != 0; ++i) {
54 table.
put_symbol(predefined_constants[i].name, predefined_constants[i].val);
76 char *p =
const_cast<char *
>(
m_src.c_str()) +
m_pos;
81 while ((c ==
' ') || (c ==
'\t'))
87 if (c ==
'\0')
return 0;
95 IN_INT, IN_FRAC, IN_EXP, IN_EXP_DIGIT
100 for (i = 0; ; c = p[++i]) {
101 if (state == IN_INT) {
103 }
else if (c ==
'.') {
105 }
else if (c ==
'e') {
110 }
else if (state == IN_FRAC) {
112 }
else if (c ==
'e') {
117 }
else if ((state == IN_EXP) || (state == IN_EXP_DIGIT)) {
119 }
else if ((state == IN_EXP) && ((c ==
'+') || (c ==
'-'))) {
120 state = IN_EXP_DIGIT;
132 char *symbol = strdup(p);
134 char *symbol = strndup(p, i + 1);
151 for (i = 0; isalnum(p[i]) || p[i] ==
'.'; ++i) {
156 char *symbol = strdup(p);
158 char *symbol = strndup(p, i + 1);
183 int retv = parser.
parse();