fix bracket evaluation
[calc.git] / parser.h
index 8d8a5d4350aa4c7b75d829a42ecad9e9b203aaca..bf28113c83ae94be6923d3e1a233db7fbb3a3436 100644 (file)
--- a/parser.h
+++ b/parser.h
@@ -1,70 +1,12 @@
 #ifndef __PARSER_H__
 #define __PARSER_H__
 
+#include "element.h"
+
 /* global variables */
 
 extern double answer;
 
-/* function type */
-
-typedef enum {
-    Val = 0, Sig,
-    Add, Sub,
-    Mul, Div, Mod,
-    Pow, Sqr,
-    Cos, Sin, Tan, Acos, Asin, Atan,
-    Ln, Log, Exp,
-    Erfc, Erf,
-    Abs, Ceil, Floor,
-    Store, Recall, Inc, Dec, Disp, Mem, Clear,
-    Quit, Help,
-    Ans, E, Pi,
-    Equal, Diff, Ge, Le, Gt, Lt,
-    And, Or, Not,
-    Cond, While, Code, Print,
-    Prog, Arg, Call, List, Edit, Del,
-    Get, Length, Pop, Push, Put, Set, Show
-} func_t;
-
-/* keyword type */
-
-typedef struct _keyword_t {
-    char *keyword;
-    func_t func;
-    int nbops;
-    int offset;
-    float prio;
-} keyword_t;
-
-/* calculus element type */
-
-typedef struct _element_t {
-    func_t func;
-    int nbops;
-    struct _element_t **ops;
-    double value;
-    int prio;
-    int hidden;
-    char *string;
-} element_t;
-
-#define ERROR_OP ((element_t *)(-1))
-
-/* workspace type */
-
-typedef struct _workspace_t {
-    int id;
-    double answer;
-    double *storage;
-    int storage_size;
-    double *argument;
-    int argument_size;
-    element_t *root;
-    double *stack;
-    int stack_size;
-    char *string;
-} workspace_t;
-
 /* parser function */
 
 void delelement (element_t *root);
@@ -75,20 +17,6 @@ void print_element (element_t *root, int level);
 
 double evaluate_element (element_t *root, char mask);
 
-/* completion functions */
-
-char **generate_completion_list ();
-
-void free_completion_list (char **list);
-
-/* print function */
-
-void set_format (char *prompt, int precision);
-
-void free_format ();
-
-double print (double value);
-
 #endif /* __PARSER_H__ */
 
 /* vim: set ts=4 sw=4 et: */