]> git.sur5r.net Git - cc65/blob - src/cc65/expr.h
Move the expression test code into separate modules.
[cc65] / src / cc65 / expr.h
1 /*
2  * expr.h
3  *
4  * Ullrich von Bassewitz, 21.06.1998
5  */
6
7
8
9 #ifndef EXPR_H
10 #define EXPR_H
11
12
13
14 /* cc65 */
15 #include "datatype.h"
16 #include "exprdesc.h"
17
18
19
20 /*****************************************************************************/
21 /*                                   code                                    */
22 /*****************************************************************************/
23
24
25
26 void PushAddr (ExprDesc* lval);
27 /* If the expression contains an address that was somehow evaluated,
28  * push this address on the stack. This is a helper function for all
29  * sorts of implicit or explicit assignment functions where the lvalue
30  * must be saved if it's not constant, before evaluating the rhs.
31  */
32
33 void ConstSubExpr (int (*F) (ExprDesc*), ExprDesc* Expr);
34 /* Will evaluate an expression via the given function. If the result is not
35  * a constant, a diagnostic will be printed, and the value is replaced by
36  * a constant one to make sure there are no internal errors that result
37  * from this input error.
38  */
39
40 void CheckBoolExpr (ExprDesc* lval);
41 /* Check if the given expression is a boolean expression, output a diagnostic
42  * if not.
43  */
44
45 void ExprLoad (unsigned flags, int k, ExprDesc *lval);
46 /* Put the result of an expression into the primary register */
47
48 void Store (ExprDesc* lval, const type* StoreType);
49 /* Store the primary register into the location denoted by lval. If StoreType
50  * is given, use this type when storing instead of lval->Type. If StoreType
51  * is NULL, use lval->Type instead.
52  */
53
54 int hie0 (ExprDesc *lval);
55 /* Parse comma operator. */
56
57 int evalexpr (unsigned flags, int (*f) (ExprDesc*), ExprDesc* lval);
58 /* Will evaluate an expression via the given function. If the result is a
59  * constant, 0 is returned and the value is put in the lval struct. If the
60  * result is not constant, ExprLoad is called to bring the value into the
61  * primary register and 1 is returned.
62  */
63
64 int expr (int (*func) (ExprDesc*), ExprDesc *lval);
65 /* Expression parser; func is either hie0 or hie1. */
66
67 void expression1 (ExprDesc* lval);
68 /* Evaluate an expression on level 1 (no comma operator) and put it into
69  * the primary register
70  */
71
72 void expression (ExprDesc* lval);
73 /* Evaluate an expression and put it into the primary register */
74
75 void ConstExpr (ExprDesc* lval);
76 /* Get a constant value */
77
78 void ConstIntExpr (ExprDesc* Val);
79 /* Get a constant int value */
80
81 void intexpr (ExprDesc* lval);
82 /* Get an integer expression */
83
84 int hie10 (ExprDesc* lval);
85 /* Handle ++, --, !, unary - etc. */
86
87 int hie1 (ExprDesc* lval);
88 /* Parse first level of expression hierarchy. */
89
90 void DefineData (ExprDesc* lval);
91 /* Output a data definition for the given expression */
92
93
94
95 /* End of expr.h */
96
97 #endif
98
99
100
101