equal
deleted
inserted
replaced
47 |
47 |
48 |
48 |
49 |
49 |
50 |
50 |
51 #include "array_dimension_iterator.hh" |
51 #include "array_dimension_iterator.hh" |
|
52 #include "../main.hh" // required for ERROR() and ERROR_MSG() macros. |
52 |
53 |
53 |
54 |
54 //#define DEBUG |
55 //#define DEBUG |
55 #ifdef DEBUG |
56 #ifdef DEBUG |
56 #define TRACE(classname) printf("\n____%s____\n",classname); |
57 #define TRACE(classname) printf("\n____%s____\n",classname); |
57 #else |
58 #else |
58 #define TRACE(classname) |
59 #define TRACE(classname) |
59 #endif |
60 #endif |
60 |
61 |
61 |
62 |
62 #define ERROR error_exit(__FILE__,__LINE__) |
|
63 /* function defined in main.cc */ |
|
64 extern void error_exit(const char *file_name, int line_no); |
|
65 |
63 |
66 void* array_dimension_iterator_c::iterate_list(list_c *list) { |
64 void* array_dimension_iterator_c::iterate_list(list_c *list) { |
67 void *res; |
65 void *res; |
68 for (int i = 0; i < list->n; i++) { |
66 for (int i = 0; i < list->n; i++) { |
69 res = list->elements[i]->accept(*this); |
67 res = list->elements[i]->accept(*this); |
100 * this function must be called once to get the object to |
98 * this function must be called once to get the object to |
101 * reference the first subrange... |
99 * reference the first subrange... |
102 * |
100 * |
103 * Returns the subrange symbol! |
101 * Returns the subrange symbol! |
104 */ |
102 */ |
105 symbol_c *array_dimension_iterator_c::next(void) { |
103 subrange_c *array_dimension_iterator_c::next(void) { |
106 void *res = array_specification->accept(*this); |
104 void *res = array_specification->accept(*this); |
107 if (res == NULL) |
105 if (res == NULL) |
108 return NULL; |
106 return NULL; |
109 |
107 |
110 return current_array_dimension; |
108 return current_array_dimension; |