Rev 990 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 990 | Rev 7516 | ||
---|---|---|---|
1 | #pragma once |
1 | #pragma once |
2 | 2 | ||
3 | // error codes |
3 | // error codes |
4 | #define ERR_BADFUNCTION -1 |
4 | #define ERR_BADFUNCTION -1 |
5 | #define ERR_BADNUMER -2 |
5 | #define ERR_BADNUMER -2 |
6 | #define ERR_GENERAL -3 |
6 | #define ERR_GENERAL -3 |
7 | #define ERR_NOBRACKET -4 |
7 | #define ERR_NOBRACKET -4 |
8 | #define ERR_BADVARIABLE -5 |
8 | #define ERR_BADVARIABLE -5 |
9 | #define ERR_OVERFLOW -6 |
9 | #define ERR_OVERFLOW -6 |
10 | #define ERR_BADPARAM -7 |
10 | #define ERR_BADPARAM -7 |
11 | 11 | ||
12 | typedef double variable_callback(char *s); |
12 | typedef double variable_callback(char *s); |
13 | 13 | ||
14 | void set_exp(char *exp); |
14 | void set_exp(char *exp); |
15 | // puts the token back to line |
15 | // puts the token back to line |
16 | void putback(double *hold); |
16 | void putback(double *hold); |
17 | // gets the expression. This function is used externally |
17 | // gets the expression. This function is used externally |
18 | int get_exp(double *hold); |
18 | int get_exp(double *hold); |
19 | 19 | ||
20 | // logic binary |
20 | // logic binary |
21 | void level1(double *hold); |
21 | void level1(double *hold); |
22 | 22 | ||
23 | // unary ! |
23 | // unary ! |
24 | void level1_5(double *hold); |
24 | void level1_5(double *hold); |
25 | 25 | ||
26 | // works with +- |
26 | // works with +- |
27 | void level2(double *hold); |
27 | void level2(double *hold); |
28 | // works with */% |
28 | // works with */% |
29 | void level3(double *hold); |
29 | void level3(double *hold); |
30 | // works with ^ |
30 | // works with ^ |
31 | void level4(double *hold); |
31 | void level4(double *hold); |
32 | // works with () |
32 | // works with () |
33 | void level5(double *hold); |
33 | void level5(double *hold); |
34 | // works with elementary tokens |
34 | // works with elementary tokens |
35 | void level6(double *hold); |
35 | void level6(double *hold); |
36 | // gets value of number, function or variable |
36 | // gets value of number, function or variable |
37 | void primitive(double *hold); |
37 | void primitive(double *hold); |
38 | // performs arithmetical operation |
38 | // performs arithmetical operation |
39 | void arith(char op, double *r, double *h); |
39 | void arith(char op, double *r, double *h); |
40 | 40 | ||
41 | void logic(char *op, double *r, double *h); |
41 | void logic(char *op, double *r, double *h); |
42 | 42 | ||
43 | 43 | ||
44 | // performs unary (one-operand) operation |
44 | // performs unary (one-operand) operation |
45 | void unary(char op, double *r); |
45 | void unary(char op, double *r); |
46 | // gets variable value by name |
46 | // gets variable value by name |
47 | extern variable_callback *find_var; |
47 | extern variable_callback *find_var; |
48 | 48 | ||
49 | extern double rand_seed; |
49 | extern double rand_seed; |
50 | 50 | ||
51 | // stops execution of parser and return error code |
51 | // stops execution of parser and return error code |
52 | void serror(int code); |
52 | void serror(int code); |
53 | // checks the function table to see if such a function exists |
53 | // checks the function table to see if such a function exists |
54 | int look_up(char *s); |
54 | int look_up(char *s); |
55 | 55 | ||
56 | bool strcmp(char *s1, char *s2); |
56 | bool strcmp(char *s1, char *s2); |
57 | bool strncmp(char *s1, char *s2, int n); |
57 | bool strncmp(char *s1, char *s2, int n); |
58 | 58 | ||
- | 59 | unsigned int chrnum(char* text, char symbol); |
|
- | 60 | ||
59 | extern double epsilon; |
61 | extern double epsilon; |
60 | 62 | ||
61 | 63 | ||
62 | int isdelim(char c); |
64 | int isdelim(char c); |
63 | int isdigit(char c); |
65 | int isdigit(char c); |
64 | int isalpha2(char c); |
66 | int isalpha2(char c); |
65 | int iswhite(char c); |
67 | int iswhite(char c); |