diff -r 8da635655f37 -r 4369ce5e687f stage4/generate_c/generate_c_sfcdecl.cc --- a/stage4/generate_c/generate_c_sfcdecl.cc Thu Jul 31 17:49:44 2014 +0100 +++ b/stage4/generate_c/generate_c_sfcdecl.cc Wed Aug 06 10:43:15 2014 +0100 @@ -195,6 +195,12 @@ for(int i = 0; i < symbol->n; i++) symbol->elements[i]->accept(*this); { + // first fill up the this->variable_list variable! + wanted_sfcdeclaration = actioncount_sd; + for(int i = 0; i < symbol->n; i++) + symbol->elements[i]->accept(*this); + wanted_sfcdeclaration = actiondef_sd; + // Now do the defines for actions that reference a variable instead of an action block! std::list::iterator pt; for(pt = variable_list.begin(); pt != variable_list.end(); pt++) { s4o.print("#define "); @@ -216,7 +222,14 @@ break; case actionundef_sd: s4o.print("// Actions undefinitions\n"); + for(int i = 0; i < symbol->n; i++) + symbol->elements[i]->accept(*this); { + // first fill up the this->variable_list variable! + wanted_sfcdeclaration = actioncount_sd; + for(int i = 0; i < symbol->n; i++) + symbol->elements[i]->accept(*this); + wanted_sfcdeclaration = actionundef_sd; std::list::iterator pt; for(pt = variable_list.begin(); pt != variable_list.end(); pt++) { s4o.print("#undef "); @@ -225,8 +238,6 @@ s4o.print("\n"); } } - for(int i = 0; i < symbol->n; i++) - symbol->elements[i]->accept(*this); s4o.print("\n"); break; default: @@ -331,9 +342,8 @@ void *visit(action_association_c *symbol) { /* we try to find the variable instance declaration, to determine if symbol is variable... */ symbol_c *var_decl = search_var_instance_decl->get_decl(symbol->action_name); - if (var_decl != NULL) { - std::list::iterator pt; + std::list::iterator pt; for(pt = variable_list.begin(); pt != variable_list.end(); pt++) { if (!compare_identifiers(pt->symbol, symbol->action_name)) return NULL;