]> git.sur5r.net Git - cc65/blob - src/cc65/expr.h
Fixed _textcolor definition.
[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 ExprWithCheck (void (*Func) (ExprDesc*), ExprDesc* Expr);
27 /* Call an expression function with checks. */
28
29 void MarkedExprWithCheck (void (*Func) (ExprDesc*), ExprDesc* Expr);
30 /* Call an expression function with checks and record start and end of the
31 ** generated code.
32 */
33
34 void PushAddr (const ExprDesc* Expr);
35 /* If the expression contains an address that was somehow evaluated,
36 ** push this address on the stack. This is a helper function for all
37 ** sorts of implicit or explicit assignment functions where the lvalue
38 ** must be saved if it's not constant, before evaluating the rhs.
39 */
40
41 void Store (ExprDesc* Expr, const Type* StoreType);
42 /* Store the primary register into the location denoted by lval. If StoreType
43 ** is given, use this type when storing instead of lval->Type. If StoreType
44 ** is NULL, use lval->Type instead.
45 */
46
47 int evalexpr (unsigned flags, void (*Func) (ExprDesc*), ExprDesc* Expr);
48 /* Will evaluate an expression via the given function. If the result is a
49 ** constant, 0 is returned and the value is put in the Expr struct. If the
50 ** result is not constant, LoadExpr is called to bring the value into the
51 ** primary register and 1 is returned.
52 */
53
54 void Expression0 (ExprDesc* Expr);
55 /* Evaluate an expression via hie0 and put the result into the primary register */
56
57 void ConstExpr (void (*Func) (ExprDesc*), ExprDesc* Expr);
58 /* Will evaluate an expression via the given function. If the result is not
59 ** a constant of some sort, a diagnostic will be printed, and the value is
60 ** replaced by a constant one to make sure there are no internal errors that
61 ** result from this input error.
62 */
63
64 void BoolExpr (void (*Func) (ExprDesc*), ExprDesc* Expr);
65 /* Will evaluate an expression via the given function. If the result is not
66 ** something that may be evaluated in a boolean context, a diagnostic will be
67 ** printed, and the value is replaced by a constant one to make sure there
68 ** are no internal errors that result from this input error.
69 */
70
71 void ConstAbsIntExpr (void (*Func) (ExprDesc*), ExprDesc* Expr);
72 /* Will evaluate an expression via the given function. If the result is not
73 ** a constant numeric integer value, a diagnostic will be printed, and the
74 ** value is replaced by a constant one to make sure there are no internal
75 ** errors that result from this input error.
76 */
77
78 void hie10 (ExprDesc* lval);
79 /* Handle ++, --, !, unary - etc. */
80
81 void hie8 (ExprDesc* Expr);
82 /* Process + and - binary operators. */
83
84 void hie1 (ExprDesc* lval);
85 /* Parse first level of expression hierarchy. */
86
87 void hie0 (ExprDesc* Expr);
88 /* Parse comma operator. */
89
90
91
92 /* End of expr.h */
93
94 #endif