char *format = NULL;
char *minform = NULL;
+workspace_t *programs = NULL;
+
/* compare codes */
int codecmp (char *ref, char *str)
{ "|", Or, 2, 1, -2}
};
-#define NB_FUNCTIONS 26
+#define NB_FUNCTIONS 31
keyword_t functions[NB_FUNCTIONS] = {
{ "sqrt", Sqr, 1, 4, 5},
{ "pow", Pow, 2, 3, 5},
{ "!", Not, 1, 1, 6},
{ "cond", Cond, 3, 4, 5},
{ "while", While, 2, 5, 5},
- { "print", Print, 1, 5, 5}
+ { "print", Print, 1, 5, 5},
+ { "prog", Prog, 3, 4, 9},
+ { "call", Call, 10, 4, 5},
+ { "ls", List, 0, 2, 9},
+ { "edit", Edit, 1, 4, 9},
+ { "del", Del, 1, 3, 9}
};
#define NB_CONSTANTS 3
case While: func = "While"; break;
case Prog: func = "Program"; break;
case Print: func = "Print"; break;
+ case Prog: func = "Program"; break;
+ case Call: func = "Call"; break;
+ case List: func = "List"; break;
+ case Edit: func = "Edit"; break;
+ case Del: func = "Del"; break;
}
fprintf (stdout, "Function: %s\n", func);
exit (0);
}
+/* program function */
+
+void prog (int id, int nbmems, element_t *root)
+{ }
+
+double call (int id, int nbobs, element_t **ops)
+{
+ return 0;
+}
+
+void list ()
+{ }
+
+void edit (int id)
+{ }
+
+void del (int id)
+{ }
+
/* help message */
void help (void)
case Lt:
case And:
case Or:
+ case Prog:
if (root->ops[1]) {
op1 = evaluate_element (root->ops[1], nextmask);
} else if (root->func != Store) {
case Not:
case Mem:
case Cond:
+ case Call:
+ case List:
+ case Edit:
+ case Del:
if (root->ops[0]) {
op0 = evaluate_element (root->ops[0], 0);
} else {
case While: return while_do (root->ops[0], root->ops[1]);
case Prog: return program_do (root->ops, root->nbops);
case Print: return print (op0);
+ case Prog: prog ((int)op0, (int)op1, root->ops[2]); break;
+ case Call: return call ((int)op0, root->nbops + 1, root->ops + 1);
+ case List: list (); break;
+ case Edit: edit ((int)op0); break;
+ case Del: del (int (op0)); break;
}
return 0;
Ans, E, Pi,
Equal, Diff, Ge, Le, Gt, Lt,
And, Or, Not,
- Cond, While, Prog, Print
+ Cond, While, Prog, Print,
+ Prog, Call, List, Edit, Del
} func_t;
/* keyword type */
#define ERROR_OP ((element_t *)(-1))
+/* workspace type */
+
+typedef struct _workspace_t {
+ int id;
+ double answer;
+ double *storage;
+ element_t *root;
+} workspace_t;
+
/* parser function */
void delelement (element_t *root);