]> git.sur5r.net Git - cc65/blob - src/cc65/exprdesc.h
Move the assignment parser into a separate module.
[cc65] / src / cc65 / exprdesc.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                exprdesc.h                                 */
4 /*                                                                           */
5 /*                      Expression descriptor structure                      */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2002      Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@cc65.org                                                 */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef EXPRDESC_H
37 #define EXPRDESC_H
38
39
40                      
41 /* cc65 */
42 #include "datatype.h"
43
44
45
46 /*****************************************************************************/
47 /*                                   Data                                    */
48 /*****************************************************************************/
49
50
51
52 /* Defines for the flags field of the expression descriptor */
53 #define E_MREG          0x0110U /* Special: Expression is primary register */
54 #define E_MGLOBAL       0x0080U /* Reference to static variable */
55 #define E_MLOCAL        0x0040U /* Reference to local variable (stack offset) */
56 #define E_MCONST        0x0020U /* Constant value */
57 #define E_MEXPR         0x0010U /* Result is in primary register */
58 #define E_MEOFFS        0x0011U /* Base is in primary register, const offset */
59
60 #define E_MCTYPE        0x0007U /* Type of a constant */
61 #define E_TCONST        0x0000U /* Constant */
62 #define E_TGLAB         0x0001U /* Global label */
63 #define E_TLIT          0x0002U /* Literal of some kind */
64 #define E_TLOFFS        0x0003U /* Constant stack offset */
65 #define E_TLLAB         0x0004U /* Local label */
66 #define E_TREGISTER     0x0005U /* Register variable */
67
68 /* Defines for the test field of the expression descriptor */
69 #define E_CC            0x0001U /* expr has set cond codes apropos result value */
70 #define E_FORCETEST     0x0002U /* if expr has NOT set CC, force a test */
71
72 /* Describe the result of an expression */
73 typedef struct ExprDesc ExprDesc;
74 struct ExprDesc {
75     struct SymEntry*    Sym;     /* Symbol table entry if known */
76     type*               Type;    /* Type array of expression */
77     long                ConstVal;/* Value if expression constant */
78     unsigned short      Flags;
79     unsigned short      Test;    /* */
80     unsigned long       Name;    /* Name or label number */
81 };
82
83
84
85 /*****************************************************************************/
86 /*                                   Code                                    */
87 /*****************************************************************************/
88
89
90
91 void MakeConstIntExpr (ExprDesc* Expr, long Value);
92 /* Make Expr a constant integer expression with the given value */
93
94 void PrintExprDesc (FILE* F, ExprDesc* Expr);
95 /* Print an ExprDesc */
96
97
98
99 /* End of exprdesc.h */
100 #endif
101
102
103