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