114 * or an ANY_BIT, we need to handle all possibilities, and determine the result of the |
114 * or an ANY_BIT, we need to handle all possibilities, and determine the result of the |
115 * operation assuming each type. |
115 * operation assuming each type. |
116 * For this reason, we have one entry for each possible type, with some expressions |
116 * For this reason, we have one entry for each possible type, with some expressions |
117 * having more than one entry filled in! |
117 * having more than one entry filled in! |
118 */ |
118 */ |
119 typedef enum { cs_undefined, /* not defined --> const_value is not valid! */ |
119 typedef enum { cs_undefined, /* not defined/not yet evaluated --> const_value is not valid! */ |
|
120 cs_non_const, /* we have deternmined that expression is not a const value --> const_value is not valid! */ |
120 cs_const_value, /* const value is valid */ |
121 cs_const_value, /* const value is valid */ |
121 cs_overflow /* result produced overflow or underflow --> const_value is not valid! */ |
122 cs_overflow /* result produced overflow or underflow --> const_value is not valid! */ |
122 } const_status_t; |
123 } const_status_t; |
123 |
124 |
|
125 typedef struct {const_status_t status; real64_t value; } const_value_real64_t; |
|
126 typedef struct {const_status_t status; int64_t value; } const_value_int64_t; |
|
127 typedef struct {const_status_t status; uint64_t value; } const_value_uint64_t; |
|
128 typedef struct {const_status_t status; bool value; } const_value_bool_t; |
|
129 |
124 typedef struct { |
130 typedef struct { |
125 const_status_t status; |
131 const_value_real64_t _real64; /* status is initialised to UNDEFINED */ |
126 real64_t value; |
132 const_value_int64_t _int64; /* status is initialised to UNDEFINED */ |
127 } const_value_real64_t; |
133 const_value_uint64_t _uint64; /* status is initialised to UNDEFINED */ |
128 const_value_real64_t *const_value_real64; /* when NULL --> UNDEFINED */ |
134 const_value_bool_t _bool; /* status is initialised to UNDEFINED */ |
|
135 } const_value_t; |
|
136 const_value_t const_value; |
129 |
137 |
130 typedef struct { |
|
131 const_status_t status; |
|
132 int64_t value; |
|
133 } const_value_int64_t; |
|
134 const_value_int64_t *const_value_int64; /* when NULL --> UNDEFINED */ |
|
135 |
|
136 typedef struct { |
|
137 const_status_t status; |
|
138 uint64_t value; |
|
139 } const_value_uint64_t; |
|
140 const_value_uint64_t *const_value_uint64; /* when NULL --> UNDEFINED */ |
|
141 |
|
142 typedef struct { |
|
143 const_status_t status; |
|
144 bool value; |
|
145 } const_value_bool_t; |
|
146 const_value_bool_t *const_value_bool; /* when NULL --> UNDEFINED */ |
|
147 |
|
148 |
138 |
149 public: |
139 public: |
150 /* default constructor */ |
140 /* default constructor */ |
151 symbol_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
141 symbol_c(int fl = 0, int fc = 0, const char *ffile = NULL /* filename */, long int forder=0, /* order in which it is read by lexcial analyser */ |
152 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |
142 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0 /* order in which it is read by lexcial analyser */ |