add commands deg, grad and rad
[calc.git] / element.h
CommitLineData
a24bd519
LM
1#ifndef __ELEMENT_H__
2#define __ELEMENT_H__
3
4/* global variables */
5
6/* function type */
7
8typedef 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,
bdcb95da 17 Store, Recall, Inc, Dec, Disp, Memory, Clear,
a24bd519
LM
18 Quit, Help,
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,
e2a309f9 25 Max, Mean, Median, Min, Order, Prod, Sum, Variance,
807bdeba 26 Precision, Base, Deg, Grad, Rad
a24bd519
LM
27} func_t;
28
29/* keyword type */
30
31typedef 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
41typedef 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
55element_t *newelement (func_t function, int nbops, int prio);
56void delelement (element_t *root);
57element_t *dupelement (element_t *root);
58
59#endif /* __ELEMENT_H__ */
60
61/* vim: set ts=4 sw=4 et: */