partial while feature
[calc.git] / parser.h
index 8038a9db00c8549bcd2e137d7b7eaed1754c8ca9..49acc2080005a8c4cef2f635c71010889f71d09a 100644 (file)
--- a/parser.h
+++ b/parser.h
@@ -1,15 +1,25 @@
 #ifndef __PARSER_H__
 #define __PARSER_H__
 
+/* global variables */
+
+extern double answer;
+
 /* function type */
 
 typedef enum {
-    Val = 0,
+    Val = 0, Sig,
     Add, Sub,
     Mul, Div, Mod,
     Pow, Sqr,
-    Cos, Sin, Atn,
-    Log, Exp
+    Cos, Sin, Atan,
+    Log, Exp,
+    Store, Recall, Inc, Dec, Disp,
+    Quit, Help,
+    Ans, E, Pi,
+    Equal, Diff, Ge, Le, Gt, Lt,
+    And, Or, Not,
+    Cond, While
 } func_t;
 
 /* keyword type */
@@ -19,7 +29,7 @@ typedef struct _keyword_t {
     func_t func;
     int nbops;
     int offset;
-    int prio;
+    float prio;
 } keyword_t;
 
 /* calculus element type */
@@ -29,7 +39,7 @@ typedef struct _element_t {
     func_t func;
     int nbops;
     struct _element_t *ops[MAX_OPERANDS];
-    float value;
+    double value;
     int prio;
 } element_t;
 
@@ -37,11 +47,13 @@ typedef struct _element_t {
 
 /* parser function */
 
+void delelement (element_t *root);
+
 element_t *parser (char *str, char **next, int prio);
 
 void print_element (element_t *root, int level);
 
-double evaluate_element (element_t *root);
+double evaluate_element (element_t *root, char mask);
 
 #endif /* __PARSER_H__ */