Fixing bug in generated code for complex type external variable
authorlaurent
Fri, 09 Dec 2011 10:03:37 +0100
changeset 394 8a04e93f9ef2
parent 393 f09a5ffe1edc
child 395 25f3b479a8ce
Fixing bug in generated code for complex type external variable
lib/accessor.h
lib/iec_types_all.h
--- a/lib/accessor.h	Fri Dec 09 10:01:48 2011 +0100
+++ b/lib/accessor.h	Fri Dec 09 10:03:37 2011 +0100
@@ -73,15 +73,15 @@
 #define __GET_VAR(name, ...)\
 	name.value __VA_ARGS__
 #define __GET_EXTERNAL(name, ...)\
-	((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : *(name.value) __VA_ARGS__)
+	((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : (*(name.value)) __VA_ARGS__)
 #define __GET_LOCATED(name, ...)\
-	((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : *(name.value) __VA_ARGS__)
+	((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : (*(name.value)) __VA_ARGS__)
 #define __GET_VAR_BY_REF(name, ...)\
 	((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &(name.value __VA_ARGS__))
 #define __GET_EXTERNAL_BY_REF(name, ...)\
-	((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &(*(name.value) __VA_ARGS__))
+	((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &((*(name.value)) __VA_ARGS__))
 #define __GET_LOCATED_BY_REF(name, ...)\
-	((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &(*(name.value) __VA_ARGS__))
+	((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &((*(name.value)) __VA_ARGS__))
 
 // variable setting macros
 #define __SET_VAR(prefix, name, new_value, ...)\
--- a/lib/iec_types_all.h	Fri Dec 09 10:01:48 2011 +0100
+++ b/lib/iec_types_all.h	Fri Dec 09 10:03:37 2011 +0100
@@ -97,6 +97,7 @@
 typedef struct {\
   type *value;\
   IEC_BYTE flags;\
+  type fvalue;\
 } __IEC_##type##_p;
 
 #define __DECLARE_ENUMERATED_TYPE(type, ...)\