--- a/stage4/generate_c/generate_c_base.cc Wed Feb 19 22:25:10 2014 +0100
+++ b/stage4/generate_c/generate_c_base.cc Wed Feb 19 22:27:11 2014 +0100
@@ -227,7 +227,8 @@
symbol_c *value,
symbol_c *fb_name = NULL,
bool temp = false) {
- bool is_subrange = search_base_type_c::type_is_subrange(type);
+ if (!get_datatype_info_c::is_type_valid(type)) ERROR;
+ bool is_subrange = get_datatype_info_c::is_subrange(type);
if (is_subrange) {
s4o.print("__CHECK_");
type->accept(*this);
@@ -582,6 +583,60 @@
/********************************/
/* leave for derived classes... */
+
+/* enumerated_type_name '#' identifier */
+void *visit(enumerated_value_c *symbol) {
+ if (NULL == symbol->datatype) {
+ debug_c::print(symbol);
+ ERROR;
+ }
+
+ symbol_c *type_name = get_datatype_info_c::get_id(symbol->datatype);
+ if (NULL == type_name) {
+ ERROR_MSG("C code generator does not currently support anonymous enumerated data types.");
+ }
+
+ type_name->accept(*this);
+ s4o.print("__");
+ symbol->value->accept(*this);
+ return NULL;
+}
+
+
+
+/* NOTE: visit(subrange_spec_init_c *)
+ * and visit(subrange_specification_c *)
+ * together simply print out the integer datatype
+ * on which the subrange is based.
+ *
+ * Future code clean-ups should delete these two
+ * visit mehotds, and make sure whoever calls them
+ * uses symbol->datatype instead!
+ */
+/* subrange_specification ASSIGN signed_integer */
+void *visit(subrange_spec_init_c *symbol) {
+ TRACE("subrange_spec_init_c");
+ symbol->subrange_specification->accept(*this);
+ return NULL;
+}
+
+/* integer_type_name '(' subrange')' */
+void *visit(subrange_specification_c *symbol) {
+ TRACE("subrange_specification_c");
+ symbol->integer_type_name->accept(*this);
+ return NULL;
+}
+
+
+/* helper symbol for array_specification */
+/* array_subrange_list ',' subrange */
+void *visit(array_subrange_list_c *symbol) {
+ TRACE("array_subrange_list_c");
+ print_list(symbol);
+ return NULL;
+}
+
+
/*********************/
/* B 1.4 - Variables */
/*********************/