X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=parser.h;h=80fbd984ca68fe213910df0496f3a7d112908f74;hb=686c4bc2a512a57b6c672792b6b44e2d61458dfb;hp=c746aaf4dfe757d00fc8dd223484046660536070;hpb=3b4b0bbecb130cc76d4cd16d00518f70d11f0820;p=calc.git diff --git a/parser.h b/parser.h index c746aaf..80fbd98 100644 --- a/parser.h +++ b/parser.h @@ -1,16 +1,24 @@ #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, + Cos, Sin, Atan, Log, Exp, - Sig + Store, Recall, Disp, + Quit, Help, + Ans, E, Pi, + Equal, Diff, Ge, Le, Gt, Lt, + And, Or, Not } func_t; /* keyword type */ @@ -20,7 +28,7 @@ typedef struct _keyword_t { func_t func; int nbops; int offset; - int prio; + float prio; } keyword_t; /* calculus element type */ @@ -30,7 +38,7 @@ typedef struct _element_t { func_t func; int nbops; struct _element_t *ops[MAX_OPERANDS]; - float value; + double value; int prio; } element_t; @@ -38,6 +46,8 @@ 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);