merging with Laurent's changes.
authorMario de Sousa <msousa@fe.up.pt>
Sat, 31 Mar 2012 15:36:08 +0100
changeset 497 5b7a0d9838d2
parent 496 fa43fed1084c (current diff)
parent 405 7b5d67d1aeef (diff)
child 498 0637a4490c8c
merging with Laurent's changes.
stage4/generate_c/generate_c_il.cc
stage4/generate_c/generate_c_st.cc
--- a/lib/accessor.h	Sat Mar 31 15:34:33 2012 +0100
+++ b/lib/accessor.h	Sat Mar 31 15:36:08 2012 +0100
@@ -57,7 +57,6 @@
 	__INIT_RETAIN(domain##__##name, retained)
 #define __INIT_EXTERNAL(type, global, name, retained)\
     {\
-        type* __GET_GLOBAL_##global();\
 		name.value = __GET_GLOBAL_##global();\
 		__INIT_RETAIN(name, retained)\
     }
--- a/lib/iec_types_all.h	Sat Mar 31 15:34:33 2012 +0100
+++ b/lib/iec_types_all.h	Sat Mar 31 15:36:08 2012 +0100
@@ -86,7 +86,8 @@
 
 #define __DECLARE_DERIVED_TYPE(type, base)\
 typedef base type;\
-typedef __IEC_##base##_t __IEC_##type##_t;
+typedef __IEC_##base##_t __IEC_##type##_t;\
+typedef __IEC_##base##_p __IEC_##type##_p;
 
 #define __DECLARE_COMPLEX_STRUCT(type)\
 typedef struct {\
--- a/stage4/generate_c/generate_c_il.cc	Sat Mar 31 15:34:33 2012 +0100
+++ b/stage4/generate_c/generate_c_il.cc	Sat Mar 31 15:36:08 2012 +0100
@@ -472,12 +472,18 @@
     		symbol_c* fb_symbol = NULL,
     		symbol_c* fb_value = NULL,
     		bool negative = false) {
-      unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
-      bool type_is_complex = search_varfb_instance_type->type_is_complex();
-      if (vartype == search_var_instance_decl_c::external_vt)
-        s4o.print(SET_EXTERNAL);
-      else if (vartype == search_var_instance_decl_c::located_vt)
-        s4o.print(SET_LOCATED);
+
+      bool type_is_complex = false;
+      if (fb_symbol == NULL) {
+        unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
+        type_is_complex = search_varfb_instance_type->type_is_complex();
+        if (vartype == search_var_instance_decl_c::external_vt)
+          s4o.print(SET_EXTERNAL);
+        else if (vartype == search_var_instance_decl_c::located_vt)
+          s4o.print(SET_LOCATED);
+        else
+          s4o.print(SET_VAR);
+      }
       else
         s4o.print(SET_VAR);
       s4o.print("(");
--- a/stage4/generate_c/generate_c_sfcdecl.cc	Sat Mar 31 15:34:33 2012 +0100
+++ b/stage4/generate_c/generate_c_sfcdecl.cc	Sat Mar 31 15:36:08 2012 +0100
@@ -130,7 +130,7 @@
           wanted_sfcdeclaration = sfcinit_sd;
           
           /* steps table initialisation */
-          s4o.print(s4o.indent_spaces + "static const STEP temp_step = {{0, 0}, 0, 0};\n");
+          s4o.print(s4o.indent_spaces + "static const STEP temp_step = {{0, 0}, 0, {0, 0}};\n");
           s4o.print(s4o.indent_spaces + "for(i = 0; i < ");
           print_variable_prefix();
           s4o.print("__nb_steps; i++) {\n");
@@ -156,7 +156,7 @@
           wanted_sfcdeclaration = sfcinit_sd;
           
           /* actions table initialisation */
-          s4o.print(s4o.indent_spaces + "static const ACTION temp_action = {0, 0, 0, 0, 0, 0};\n");
+          s4o.print(s4o.indent_spaces + "static const ACTION temp_action = {0, 0, 0, 0, {0, 0}, {0, 0}};\n");
           s4o.print(s4o.indent_spaces + "for(i = 0; i < ");
           print_variable_prefix();
           s4o.print("__nb_actions; i++) {\n");
--- a/stage4/generate_c/generate_c_st.cc	Sat Mar 31 15:34:33 2012 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Sat Mar 31 15:36:08 2012 +0100
@@ -170,14 +170,19 @@
 		symbol_c* fb_symbol = NULL,
 		symbol_c* fb_value = NULL) {
   
-  unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
-  bool type_is_complex = search_varfb_instance_type->type_is_complex();
-  if (vartype == search_var_instance_decl_c::external_vt)
-    s4o.print(SET_EXTERNAL);
-  else if (vartype == search_var_instance_decl_c::located_vt)
-    s4o.print(SET_LOCATED);
+  bool type_is_complex = false;
+  if (fb_symbol == NULL) {
+	unsigned int vartype = search_varfb_instance_type->get_vartype(symbol);
+    type_is_complex = search_varfb_instance_type->type_is_complex();
+    if (vartype == search_var_instance_decl_c::external_vt)
+      s4o.print(SET_EXTERNAL);
+    else if (vartype == search_var_instance_decl_c::located_vt)
+      s4o.print(SET_LOCATED);
+    else
+      s4o.print(SET_VAR);
+  }
   else
-    s4o.print(SET_VAR);
+	s4o.print(SET_VAR);
   s4o.print("(");
 
   if (fb_symbol != NULL) {