--- a/stage4/generate_c/generate_var_list.cc Thu Nov 08 18:55:57 2012 +0100
+++ b/stage4/generate_c/generate_var_list.cc Thu Nov 15 22:28:53 2012 +0100
@@ -132,14 +132,14 @@
var_type_symbol->accept(*this);
if (this->current_var_type_symbol == NULL)
- this->current_var_type_symbol = var_type_symbol;
+ this->current_var_type_symbol = var_type_symbol;
return (this->current_var_type_symbol);
}
symbol_c *get_current_type_name(void) {
if (this->current_var_type_name == NULL)
- return (this->current_var_type_symbol);
+ return (this->current_var_type_symbol);
return (this->current_var_type_name);
}
@@ -188,8 +188,7 @@
class generate_var_list_c: protected generate_c_typedecl_c {
public:
- typedef struct
- {
+ typedef struct {
symbol_c *symbol;
} SYMBOL;
@@ -329,12 +328,14 @@
case search_type_symbol_c::function_block_vtc:
this->current_var_type_name->accept(*this);
s4o.print(";\n");
- SYMBOL *current_name;
- current_name = new SYMBOL;
- current_name->symbol = symbol;
- current_symbol_list.push_back(*current_name);
- this->current_var_type_symbol->accept(*this);
- current_symbol_list.pop_back();
+ if (this->current_var_class_category != external_vcc) {
+ SYMBOL *current_name;
+ current_name = new SYMBOL;
+ current_name->symbol = symbol;
+ current_symbol_list.push_back(*current_name);
+ this->current_var_type_symbol->accept(*this);
+ current_symbol_list.pop_back();
+ }
break;
case search_type_symbol_c::array_vtc:
this->current_var_type_name->accept(*this);
@@ -372,7 +373,7 @@
s4o.print(str);
}
- void print_symbol_list(void) {
+ void print_symbol_list() {
std::list<SYMBOL>::iterator pt;
for(pt = current_symbol_list.begin(); pt != current_symbol_list.end(); pt++) {
pt->symbol->accept(*this);
@@ -648,20 +649,20 @@
// SYM_REF2(global_var_spec_c, global_var_name, location)
void *visit(global_var_spec_c *symbol) {
search_location_type_c search_location_type;
- switch (search_location_type.get_location_type(symbol->location)) {
- case search_location_type_c::input_lt:
- this->current_var_class_category = located_input_vcc;
- break;
- case search_location_type_c::memory_lt:
- this->current_var_class_category = located_memory_vcc;
- break;
- case search_location_type_c::output_lt:
- this->current_var_class_category = located_output_vcc;
- break;
- default:
- ERROR;
- break;
- }
+ switch (search_location_type.get_location_type(symbol->location)) {
+ case search_location_type_c::input_lt:
+ this->current_var_class_category = located_input_vcc;
+ break;
+ case search_location_type_c::memory_lt:
+ this->current_var_class_category = located_memory_vcc;
+ break;
+ case search_location_type_c::output_lt:
+ this->current_var_class_category = located_output_vcc;
+ break;
+ default:
+ ERROR;
+ break;
+ }
if (symbol->global_var_name != NULL)
declare_variable(symbol->global_var_name);