39 * LREAL#22.2 -> returns reference to a lreal_type_name_c object. |
39 * LREAL#22.2 -> returns reference to a lreal_type_name_c object. |
40 * etc... |
40 * etc... |
41 */ |
41 */ |
42 |
42 |
43 |
43 |
|
44 #include "../util/symtable.hh" |
44 #include "search_constant_type.hh" |
45 #include "search_constant_type.hh" |
|
46 |
|
47 /* A symbol table with all values declared for enumerated type... */ |
|
48 /* Note that if the value is defined multiple times the value |
|
49 * is the null pointer. |
|
50 */ |
|
51 extern symbol_c null_symbol4; |
|
52 extern symtable_c<symbol_c *, &null_symbol4> enumerated_value_symtable; |
45 |
53 |
46 #define ERROR error_exit(__FILE__,__LINE__) |
54 #define ERROR error_exit(__FILE__,__LINE__) |
47 /* function defined in main.cc */ |
55 /* function defined in main.cc */ |
48 extern void error_exit(const char *file_name, int line_no); |
56 extern void error_exit(const char *file_name, int line_no); |
49 |
57 |
115 void *search_constant_type_c::visit(daytime_c *symbol) {ERROR; return NULL;} /* this member function should never be called. */ |
123 void *search_constant_type_c::visit(daytime_c *symbol) {ERROR; return NULL;} /* this member function should never be called. */ |
116 void *search_constant_type_c::visit(date_c *symbol) {return (void *)(symbol->type_name);} |
124 void *search_constant_type_c::visit(date_c *symbol) {return (void *)(symbol->type_name);} |
117 void *search_constant_type_c::visit(date_literal_c *symbol) {ERROR; return NULL;} /* this member function should never be called. */ |
125 void *search_constant_type_c::visit(date_literal_c *symbol) {ERROR; return NULL;} /* this member function should never be called. */ |
118 void *search_constant_type_c::visit(date_and_time_c *symbol) {return (void *)(symbol->type_name);} |
126 void *search_constant_type_c::visit(date_and_time_c *symbol) {return (void *)(symbol->type_name);} |
119 |
127 |
|
128 /********************************/ |
|
129 /* B 1.3.3 - Derived data types */ |
|
130 /********************************/ |
|
131 void *search_constant_type_c::visit(enumerated_value_c *symbol) { |
|
132 if (symbol->type != NULL) |
|
133 return (void *)(symbol->type); |
|
134 |
|
135 symbol_c *value_type = enumerated_value_symtable.find_value(symbol->value); |
|
136 if (value_type == enumerated_value_symtable.end_value()) ERROR; |
|
137 |
|
138 return (void *)value_type; |
|
139 } |
120 |
140 |
121 real_type_name_c search_constant_type_c::real_type_name; |
141 real_type_name_c search_constant_type_c::real_type_name; |
122 sint_type_name_c search_constant_type_c::sint_type_name; |
142 sint_type_name_c search_constant_type_c::sint_type_name; |
123 lint_type_name_c search_constant_type_c::lint_type_name; |
143 lint_type_name_c search_constant_type_c::lint_type_name; |
124 dint_type_name_c search_constant_type_c::dint_type_name; |
144 dint_type_name_c search_constant_type_c::dint_type_name; |