equal
deleted
inserted
replaced
48 |
48 |
49 #include <stdio.h> // required for NULL |
49 #include <stdio.h> // required for NULL |
50 #include <vector> |
50 #include <vector> |
51 #include <string> |
51 #include <string> |
52 #include <stdint.h> // required for uint64_t, etc... |
52 #include <stdint.h> // required for uint64_t, etc... |
|
53 |
|
54 |
|
55 |
|
56 /* NOTE: we cant use sizeof() in pre-processor directives, so we do it another way... */ |
|
57 #include <float.h> |
|
58 #if (LDBL_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */ |
|
59 #define long_double long double |
|
60 #define real64_t long_double /* so we can later use #if (real64_t == long_double) directives in the code! */ |
|
61 #elif ( DBL_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */ |
|
62 #define real64_t double |
|
63 #elif ( FLT_MANT_DIG == 53) /* NOTE: 64 bit IEC559 real has 53 bits for mantissa! */ |
|
64 #define real64_t float |
|
65 #else |
|
66 #error Could not find a 64 bit floating point data type on this platform. Aborting... |
|
67 #endif |
|
68 |
53 |
69 |
54 /* Forward declaration of the visitor interface |
70 /* Forward declaration of the visitor interface |
55 * declared in the visitor.hh file |
71 * declared in the visitor.hh file |
56 * We cannot include the visitor.hh file, as it will |
72 * We cannot include the visitor.hh file, as it will |
57 * include this same file first, as it too requires references |
73 * include this same file first, as it too requires references |
84 * If it points to an object of type invalid_type_name_c, it means it is invalid. |
100 * If it points to an object of type invalid_type_name_c, it means it is invalid. |
85 * Otherwise, it points to an object of the apropriate data type (e.g. int_type_name_c, bool_type_name_c, ...) |
101 * Otherwise, it points to an object of the apropriate data type (e.g. int_type_name_c, bool_type_name_c, ...) |
86 */ |
102 */ |
87 symbol_c *datatype; |
103 symbol_c *datatype; |
88 |
104 |
89 double *const_value_real; |
105 real64_t *const_value_real; |
90 int64_t *const_value_integer; |
106 int64_t *const_value_integer; |
91 uint64_t *const_value_uinteger; |
107 uint64_t *const_value_uinteger; |
92 bool *const_value_bool; |
108 bool *const_value_bool; |
93 |
109 |
94 |
110 |
145 }; |
161 }; |
146 |
162 |
147 |
163 |
148 |
164 |
149 |
165 |
150 #define SYM_LIST(class_name_c, ...) \ |
166 #define SYM_LIST(class_name_c, ...) \ |
151 class class_name_c: public list_c { \ |
167 class class_name_c: public list_c { \ |
152 public: \ |
168 public: \ |
153 __VA_ARGS__ \ |
169 __VA_ARGS__ \ |
154 public: \ |
170 public: \ |
155 class_name_c( \ |
171 class_name_c( \ |
160 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
176 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
161 virtual void *accept(visitor_c &visitor); \ |
177 virtual void *accept(visitor_c &visitor); \ |
162 }; |
178 }; |
163 |
179 |
164 |
180 |
165 #define SYM_TOKEN(class_name_c, ...) \ |
181 #define SYM_TOKEN(class_name_c, ...) \ |
166 class class_name_c: public token_c { \ |
182 class class_name_c: public token_c { \ |
167 public: \ |
183 public: \ |
168 __VA_ARGS__ \ |
184 __VA_ARGS__ \ |
169 public: \ |
185 public: \ |
170 class_name_c(const char *value, \ |
186 class_name_c(const char *value, \ |
172 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
188 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
173 virtual void *accept(visitor_c &visitor); \ |
189 virtual void *accept(visitor_c &visitor); \ |
174 }; |
190 }; |
175 |
191 |
176 |
192 |
177 #define SYM_REF0(class_name_c, ...) \ |
193 #define SYM_REF0(class_name_c, ...) \ |
178 class class_name_c: public symbol_c { \ |
194 class class_name_c: public symbol_c { \ |
179 public: \ |
195 public: \ |
180 __VA_ARGS__ \ |
196 __VA_ARGS__ \ |
181 public: \ |
197 public: \ |
182 class_name_c( \ |
198 class_name_c( \ |
248 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
264 int ll = 0, int lc = 0, const char *lfile = NULL /* filename */, long int lorder=0); \ |
249 virtual void *accept(visitor_c &visitor); \ |
265 virtual void *accept(visitor_c &visitor); \ |
250 }; |
266 }; |
251 |
267 |
252 |
268 |
253 #define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...) \ |
269 #define SYM_REF5(class_name_c, ref1, ref2, ref3, ref4, ref5, ...) \ |
254 class class_name_c: public symbol_c { \ |
270 class class_name_c: public symbol_c { \ |
255 public: \ |
271 public: \ |
256 symbol_c *ref1; \ |
272 symbol_c *ref1; \ |
257 symbol_c *ref2; \ |
273 symbol_c *ref2; \ |
258 symbol_c *ref3; \ |
274 symbol_c *ref3; \ |