X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=parser.h;h=4907c67699a74dc69f5655065e5165df7ae8b072;hb=c7cbb833c65805634f6e9832b49e4a4680a4a4a6;hp=409b4d43c16d4860c549d3f2af0cf63b2b5560e1;hpb=94b4e517849129fca159355365a7fb01db21d2da;p=calc.git diff --git a/parser.h b/parser.h index 409b4d4..4907c67 100644 --- a/parser.h +++ b/parser.h @@ -12,14 +12,16 @@ typedef enum { Add, Sub, Mul, Div, Mod, Pow, Sqr, - Cos, Sin, Atan, + Cos, Sin, Tan, Acos, Asin, Atan, Log, Exp, - Store, Recall, Disp, + 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 + Cond, While, Prog, Print, + Prog, Call, List, Edit, Del } func_t; /* keyword type */ @@ -34,17 +36,26 @@ typedef struct _keyword_t { /* calculus element type */ -#define MAX_OPERANDS 10 typedef struct _element_t { func_t func; int nbops; - struct _element_t *ops[MAX_OPERANDS]; + struct _element_t **ops; double value; int prio; + int hidden; } element_t; #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); @@ -55,6 +66,20 @@ 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: */