# HG changeset patch # User etisserant # Date 1216314380 -7200 # Node ID fd5760f30682a8931614b16a5b022533f553dfd4 # Parent ee613c07b9e58d1b02fb009b14e40e7d14cca2ce Changed located global variable declaration and init to reflec recent change on located vars (pointers) diff -r ee613c07b9e5 -r fd5760f30682 stage4/generate_c/generate_c_vardecl.cc --- a/stage4/generate_c/generate_c_vardecl.cc Thu Jul 17 17:03:06 2008 +0200 +++ b/stage4/generate_c/generate_c_vardecl.cc Thu Jul 17 19:06:20 2008 +0200 @@ -402,7 +402,6 @@ */ typedef enum {finterface_vf, local_vf, - localstatic_vf, localinit_vf, init_vf, constructorinit_vf, @@ -1198,15 +1197,6 @@ /* now to produce the c equivalent... */ switch(wanted_varformat) { case local_vf: - case localstatic_vf: - /* NOTE: located variables must be declared static, as the connection to the - * MatPLC point must be initialised at program startup, and not whenever - * a new function block is instantiated! - * Nevertheless, this construct never occurs inside a Function Block, but - * only inside a configuration. In this case, only a single instance will - * be created, directly at startup, so it is not necessary that the variables - * be declared static. - */ s4o.print(s4o.indent_spaces); if (symbol->global_var_name != NULL) { s4o.print("extern "); @@ -1214,13 +1204,9 @@ s4o.print("* "); symbol->location->accept(*this); s4o.print(";\n"); - if (wanted_varformat == localstatic_vf) - s4o.print("static "); this->current_var_type_symbol->accept(*this); s4o.print(" *"); symbol->global_var_name->accept(*this); - s4o.print(" = "); - symbol->location->accept(*this); s4o.print(";\n"); } break; @@ -1229,7 +1215,12 @@ s4o.print(nv->get()); if (symbol->global_var_name != NULL) { - s4o.print("*"); + symbol->global_var_name->accept(*this); + s4o.print(" = "); + symbol->location->accept(*this); + s4o.print(";"); + s4o.print(nv->get()); + s4o.print("*"); symbol->global_var_name->accept(*this); } else