/* look for number */
- if (((*str >= '0') && (*str <= '9')) ||
- (*str == '.') || (*str == '+') || (*str == '-')) {
- VERBOSE (DEBUG, fprintf (stdout, "start processing value\n"));
- char *pt;
- double value = strtod (str, &pt);
- VERBOSE (INFO, fprintf (stdout, "Value: %f\n", value));
- if (str != pt) {
- if ((root == NULL) || (root->prio == 6)) {
- new = newelement (Val, 1, 5);
- new->value = value;
- if (root == NULL) {
- root = new;
- } else {
- for (i = 0; i < root->nbops; i++) {
- if (root->ops[i] == NULL) {
- root->ops[i] = new;
- found = 1;
- break;
- }
- }
- if (!found) {
- delelement (new);
- delelement (root);
- return ERROR_OP;
+ VERBOSE (DEBUG, fprintf (stdout, "start processing value\n"));
+ char *pt;
+ double value = (ibase == 10) ? strtod (str, &pt) : strtoul (str, &pt, ibase);
+ VERBOSE (INFO, fprintf (stdout, "Value: %f\n", value));
+ if (str != pt) {
+ if ((root == NULL) || (root->prio == 6)) {
+ new = newelement (Val, 1, 5);
+ new->value = value;
+ if (root == NULL) {
+ root = new;
+ } else {
+ for (i = 0; i < root->nbops; i++) {
+ if (root->ops[i] == NULL) {
+ root->ops[i] = new;
+ found = 1;
+ break;
}
}
- str = pt;
- } else if ((*str == '+') || (*str == '-')) {
- if ((prio) && (prio > 1)) {
- VERBOSE (DEBUG, fprintf (stdout, "stop because operator priority\n"));
- *next = str;
- return root;
- }
- if (subparser (&root, &str, Add, 2, 1) == ERROR_OP) {
+ if (!found) {
+ delelement (new);
delelement (root);
return ERROR_OP;
}
- } else {
+ }
+ str = pt;
+ } else if ((*str == '+') || (*str == '-')) {
+ if ((prio) && (prio > 1)) {
+ VERBOSE (DEBUG, fprintf (stdout, "stop because operator priority\n"));
+ *next = str;
+ return root;
+ }
+ if (subparser (&root, &str, Add, 2, 1) == ERROR_OP) {
delelement (root);
return ERROR_OP;
}
- found = 1;
+ } else {
+ delelement (root);
+ return ERROR_OP;
}
- VERBOSE (DEBUG, fprintf (stdout, "stop processing value\n"));
+ found = 1;
}
+ VERBOSE (DEBUG, fprintf (stdout, "stop processing value\n"));
/* error */