Make temporary fix to is_complex() method.
--- a/absyntax_utils/search_var_instance_decl.cc Tue Apr 24 19:17:53 2012 +0100
+++ b/absyntax_utils/search_var_instance_decl.cc Wed Apr 25 15:46:53 2012 +0100
@@ -124,6 +124,33 @@
return this->current_option;
}
+
+
+/* This is a temporary fix. Hopefully, once I clean up stage4 code, and I change the way
+ * we generate C code, this function will no longer be needed!
+ */
+#include <typeinfo> /* required for typeid() */
+bool search_var_instance_decl_c::type_is_complex(symbol_c *symbol) {
+ symbol_c *decl;
+ search_base_type_c search_base_type;
+
+ decl = this->get_decl(symbol);
+ if (NULL == decl) ERROR;
+ decl = search_base_type.get_basetype_decl(decl);
+ if (NULL == decl) ERROR;
+
+ return ((typeid( *(decl) ) == typeid( array_specification_c )) ||
+// (typeid( *(decl) ) == typeid( array_spec_init_c )) || /* does not seem to be necessary */
+ (typeid( *(decl) ) == typeid( structure_type_declaration_c )) ||
+ (typeid( *(decl) ) == typeid( structure_element_declaration_list_c )) ||
+// (typeid( *(decl) ) == typeid( structure_type_declaration_c )) || /* does not seem to be necessary */
+ (typeid( *(decl) ) == typeid( initialized_structure_c ))
+
+ );
+}
+
+
+
/***************************/
/* B 0 - Programming Model */
/***************************/
--- a/absyntax_utils/search_var_instance_decl.hh Tue Apr 24 19:17:53 2012 +0100
+++ b/absyntax_utils/search_var_instance_decl.hh Wed Apr 25 15:46:53 2012 +0100
@@ -102,13 +102,15 @@
public:
search_var_instance_decl_c(symbol_c *search_scope);
- symbol_c *get_decl(symbol_c *variable_instance_name);
-
+
+ symbol_c * get_decl (symbol_c *variable_instance_name);
unsigned int get_vartype(symbol_c *variable_instance_name);
- unsigned int get_option(symbol_c *variable_instance_name);
+ unsigned int get_option (symbol_c *variable_instance_name);
+
+ /* NOTE: The following function will be completely deleted in the (hopefully near) future. */
+ bool type_is_complex(symbol_c *variable_name);
public:
-
/* the types of variables that need to be processed... */
static const unsigned int none_vt = 0x0000;
static const unsigned int input_vt = 0x0001; // VAR_INPUT
--- a/absyntax_utils/search_varfb_instance_type.cc Tue Apr 24 19:17:53 2012 +0100
+++ b/absyntax_utils/search_varfb_instance_type.cc Wed Apr 25 15:46:53 2012 +0100
@@ -125,14 +125,6 @@
-bool search_varfb_instance_type_c::type_is_complex(symbol_c *variable_name) {
- this->init();
- variable_name->accept(*this);
- return this->is_complex;
-}
-
-
-
/*************************/
/* B.1 - Common elements */
--- a/absyntax_utils/search_varfb_instance_type.hh Tue Apr 24 19:17:53 2012 +0100
+++ b/absyntax_utils/search_varfb_instance_type.hh Wed Apr 25 15:46:53 2012 +0100
@@ -104,16 +104,13 @@
void init(void);
public:
- search_varfb_instance_type_c(symbol_c *search_scope);
- symbol_c *get_basetype_decl(symbol_c *variable_name);
- symbol_c *get_basetype_id (symbol_c *variable_name);
-// symbol_c *get_type_decl(symbol_c *variable_name);
- symbol_c *get_type_id(symbol_c *variable_name);
+ search_varfb_instance_type_c(symbol_c *search_scope );
+ symbol_c *get_basetype_decl (symbol_c *variable_name);
+ symbol_c *get_basetype_id (symbol_c *variable_name);
+// symbol_c *get_type_decl (symbol_c *variable_name);
+ symbol_c *get_type_id (symbol_c *variable_name);
- /* NOTE: The following function should be moved to its own independent visitor class.
- * In other words, it will be removed from this class in the future.
- */
- bool type_is_complex(symbol_c *variable_name);
+
private:
/* a helper function... */
--- a/stage4/generate_c/generate_c_il.cc Tue Apr 24 19:17:53 2012 +0100
+++ b/stage4/generate_c/generate_c_il.cc Wed Apr 25 15:46:53 2012 +0100
@@ -461,7 +461,7 @@
variablegeneration_t old_wanted_variablegeneration = wanted_variablegeneration;
wanted_variablegeneration = complextype_base_vg;
symbol->accept(*this);
- if (search_varfb_instance_type->type_is_complex(symbol))
+ if (search_var_instance_decl->type_is_complex(symbol))
s4o.print(",");
wanted_variablegeneration = complextype_suffix_vg;
symbol->accept(*this);
@@ -480,7 +480,7 @@
bool type_is_complex = false;
if (fb_symbol == NULL) {
unsigned int vartype = search_var_instance_decl->get_vartype(symbol);
- type_is_complex = search_varfb_instance_type->type_is_complex(symbol);
+ type_is_complex = search_var_instance_decl->type_is_complex(symbol);
if (vartype == search_var_instance_decl_c::external_vt)
s4o.print(SET_EXTERNAL);
else if (vartype == search_var_instance_decl_c::located_vt)
--- a/stage4/generate_c/generate_c_inlinefcall.cc Tue Apr 24 19:17:53 2012 +0100
+++ b/stage4/generate_c/generate_c_inlinefcall.cc Wed Apr 25 15:46:53 2012 +0100
@@ -324,7 +324,7 @@
wanted_variablegeneration = complextype_base_vg;
symbol->accept(*this);
- if (search_varfb_instance_type->type_is_complex(symbol))
+ if (search_var_instance_decl->type_is_complex(symbol))
s4o.print(",");
wanted_variablegeneration = complextype_suffix_vg;
symbol->accept(*this);
@@ -350,7 +350,7 @@
s4o.print(",");
wanted_variablegeneration = expression_vg;
print_check_function(type, value, NULL, true);
- if (search_varfb_instance_type->type_is_complex(symbol)) {
+ if (search_var_instance_decl->type_is_complex(symbol)) {
s4o.print(",");
wanted_variablegeneration = complextype_suffix_vg;
symbol->accept(*this);
--- a/stage4/generate_c/generate_c_st.cc Tue Apr 24 19:17:53 2012 +0100
+++ b/stage4/generate_c/generate_c_st.cc Wed Apr 25 15:46:53 2012 +0100
@@ -135,6 +135,11 @@
}
private:
+
+
+
+
+
void *print_getter(symbol_c *symbol) {
unsigned int vartype = search_var_instance_decl->get_vartype(symbol);
@@ -159,7 +164,7 @@
variablegeneration_t old_wanted_variablegeneration = wanted_variablegeneration;
wanted_variablegeneration = complextype_base_vg;
symbol->accept(*this);
- if (search_varfb_instance_type->type_is_complex(symbol))
+ if (search_var_instance_decl->type_is_complex(symbol))
s4o.print(",");
wanted_variablegeneration = complextype_suffix_vg;
symbol->accept(*this);
@@ -177,7 +182,7 @@
bool type_is_complex = false;
if (fb_symbol == NULL) {
unsigned int vartype = search_var_instance_decl->get_vartype(symbol);
- type_is_complex = search_varfb_instance_type->type_is_complex(symbol);
+ type_is_complex = search_var_instance_decl->type_is_complex(symbol);
if (vartype == search_var_instance_decl_c::external_vt)
s4o.print(SET_EXTERNAL);
else if (vartype == search_var_instance_decl_c::located_vt)