X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=parser.h;h=9ce4fd098695f8b0b3f497a82eec664ed375ec66;hb=e2a309f921968691af1566000dd694f191eca857;hp=522adba9dec018d88493f1e6e977cadce30e835c;hpb=2a5ec9d1e2e19f934a02d0b697b01ae12ebc313f;p=calc.git diff --git a/parser.h b/parser.h index 522adba..9ce4fd0 100644 --- a/parser.h +++ b/parser.h @@ -1,49 +1,17 @@ #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, - Log, Exp, - Abs, Ceil, Floor, - Store, Recall, Inc, Dec, Disp, - Quit, Help, - Ans, E, Pi, - Equal, Diff, Ge, Le, Gt, Lt, - And, Or, Not, - Cond, While, Prog, Print -} func_t; - -/* keyword type */ - -typedef struct _keyword_t { - char *keyword; - func_t func; - int nbops; - int offset; - float prio; -} keyword_t; - -/* calculus element type */ +/* completion functions */ -typedef struct _element_t { - func_t func; - int nbops; - struct _element_t **ops; - double value; - int prio; -} element_t; +char **generate_completion_list (); -#define ERROR_OP ((element_t *)(-1)) +void free_completion_list (char **list); /* parser function */ @@ -55,20 +23,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: */