]> git.sur5r.net Git - cc65/blob - src/cc65/expr.h
Renamed exprhs to ExprLoad
[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 void expression1 (ExprDesc* lval);
65 /* Evaluate an expression on level 1 (no comma operator) and put it into
66  * the primary register
67  */
68
69 void expression (ExprDesc* lval);
70 /* Evaluate an expression and put it into the primary register */
71
72 void ConstExpr (ExprDesc* lval);
73 /* Get a constant value */
74
75 void ConstIntExpr (ExprDesc* Val);
76 /* Get a constant int value */
77
78 void intexpr (ExprDesc* lval);
79 /* Get an integer expression */
80
81 int hie10 (ExprDesc* lval);
82 /* Handle ++, --, !, unary - etc. */
83
84 int hie1 (ExprDesc* lval);
85 /* Parse first level of expression hierarchy. */
86
87 void DefineData (ExprDesc* lval);
88 /* Output a data definition for the given expression */
89
90 void Test (unsigned Label, int Invert);
91 /* Evaluate a boolean test expression and jump depending on the result of
92  * the test and on Invert.
93  */
94
95 void TestInParens (unsigned Label, int Invert);
96 /* Evaluate a boolean test expression in parenthesis and jump depending on
97  * the result of the test * and on Invert.
98  */
99
100
101
102 /* End of expr.h */
103
104 #endif
105
106
107
108