]> git.sur5r.net Git - cc65/blob - src/cc65/expr.h
Move the assignment parser into a separate module.
[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 unsigned assignadjust (type* lhst, ExprDesc* rhs);
41 /* Adjust the type of the right hand expression so that it can be assigned to
42  * the type on the left hand side. This function is used for assignment and
43  * for converting parameters in a function call. It returns the code generator
44  * flags for the operation.
45  */
46
47 void exprhs (unsigned flags, int k, ExprDesc *lval);
48 /* Put the result of an expression into the primary register */
49
50 void Store (ExprDesc* lval, const type* StoreType);
51 /* Store the primary register into the location denoted by lval. If StoreType
52  * is given, use this type when storing instead of lval->Type. If StoreType
53  * is NULL, use lval->Type instead.
54  */
55
56 void expression1 (ExprDesc* lval);
57 /* Evaluate an expression on level 1 (no comma operator) and put it into
58  * the primary register
59  */
60
61 void expression (ExprDesc* lval);
62 /* Evaluate an expression and put it into the primary register */
63
64 int evalexpr (unsigned flags, int (*f) (ExprDesc*), ExprDesc* lval);
65 /* Will evaluate an expression via the given function. If the result is a
66  * constant, 0 is returned and the value is put in the lval struct. If the
67  * result is not constant, exprhs is called to bring the value into the
68  * primary register and 1 is returned.
69  */
70
71 void ConstExpr (ExprDesc* lval);
72 /* Get a constant value */
73
74 void ConstIntExpr (ExprDesc* Val);
75 /* Get a constant int value */
76
77 void intexpr (ExprDesc* lval);
78 /* Get an integer expression */
79
80 void boolexpr (ExprDesc* lval);
81 /* Get a boolean expression */
82
83 void test (unsigned label, int cond);
84 /* Generate code to perform test and jump if false. */
85
86 int hie10 (ExprDesc* lval);
87 /* Handle ++, --, !, unary - etc. */
88
89 int hie1 (ExprDesc* lval);
90 /* Parse first level of expression hierarchy. */
91
92 int hie0 (ExprDesc* lval);
93 /* Parse comma operator (highest level of expression hierarchy) */
94
95 void DefineData (ExprDesc* lval);
96 /* Output a data definition for the given expression */
97
98
99
100 /* End of expr.h */
101
102 #endif
103
104
105
106