| 1 | #ifndef __ELEMENT_H__ |
| 2 | #define __ELEMENT_H__ |
| 3 | |
| 4 | /* global variables */ |
| 5 | |
| 6 | /* function type */ |
| 7 | |
| 8 | typedef enum { |
| 9 | Val = 0, Sig, |
| 10 | Add, Sub, |
| 11 | Mul, Div, Mod, |
| 12 | Pow, Sqr, |
| 13 | Cos, Sin, Tan, Acos, Asin, Atan, |
| 14 | Ln, Log, Exp, |
| 15 | Erfc, Erf, |
| 16 | Abs, Ceil, Floor, |
| 17 | Store, Recall, Inc, Dec, Disp, Memory, Clear, |
| 18 | Quit, Help, History, |
| 19 | Ans, E, Pi, |
| 20 | Equal, Diff, Ge, Le, Gt, Lt, |
| 21 | And, Or, Not, |
| 22 | Cond, While, Code, Print, |
| 23 | Prog, Arg, Call, List, Edit, Del, |
| 24 | Get, Length, Pop, Push, Put, Set, Show, |
| 25 | Max, Mean, Median, Min, Order, Prod, Sum, Variance, |
| 26 | Precision, Base, Deg, Grad, Rad, |
| 27 | } func_t; |
| 28 | |
| 29 | /* keyword type */ |
| 30 | |
| 31 | typedef struct _keyword_t { |
| 32 | char *keyword; |
| 33 | func_t func; |
| 34 | int nbops; |
| 35 | int offset; |
| 36 | float prio; |
| 37 | } keyword_t; |
| 38 | |
| 39 | /* calculus element type */ |
| 40 | |
| 41 | typedef struct _element_t { |
| 42 | func_t func; |
| 43 | int nbops; |
| 44 | struct _element_t **ops; |
| 45 | double value; |
| 46 | int prio; |
| 47 | int hidden; |
| 48 | char *string; |
| 49 | } element_t; |
| 50 | |
| 51 | #define ERROR_OP ((element_t *)(-1)) |
| 52 | |
| 53 | /* functions */ |
| 54 | |
| 55 | element_t *newelement (func_t function, int nbops, int prio); |
| 56 | void delelement (element_t *root); |
| 57 | element_t *dupelement (element_t *root); |
| 58 | |
| 59 | #endif /* __ELEMENT_H__ */ |
| 60 | |
| 61 | /* vim: set ts=4 sw=4 et: */ |