Variable forcing now uses limited list and buffer instead of systematical instance tree traversal and in-tree "fvalue" to keep track of forced value for pointed variables (external, located). Pointer swapping is performed when forcing externals and located, with backup being restored when forcing is reset. Match Beremiz commit 93ad018fb602.
authorEdouard Tisserant
Tue, 14 Dec 2021 08:48:05 +0100
changeset 1096 fad6e7a818e2
parent 1095 36bbd0b64816
child 1097 520a4b937f13
Variable forcing now uses limited list and buffer instead of systematical instance tree traversal and in-tree "fvalue" to keep track of forced value for pointed variables (external, located). Pointer swapping is performed when forcing externals and located, with backup being restored when forcing is reset. Match Beremiz commit 93ad018fb602.
lib/C/accessor.h
lib/C/iec_types_all.h
--- a/lib/C/accessor.h	Wed Nov 24 08:58:58 2021 +0100
+++ b/lib/C/accessor.h	Tue Dec 14 08:48:05 2021 +0100
@@ -87,20 +87,20 @@
 #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.value)) __VA_ARGS__)
 #define __GET_EXTERNAL_FB(name, ...)\
 	__GET_VAR(((*name) __VA_ARGS__))
 #define __GET_LOCATED(name, ...)\
-	((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : (*(name.value)) __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__))
+	(&(name.value __VA_ARGS__))
 #define __GET_EXTERNAL_BY_REF(name, ...)\
-	((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &((*(name.value)) __VA_ARGS__))
+	(&((*(name.value)) __VA_ARGS__))
 #define __GET_EXTERNAL_FB_BY_REF(name, ...)\
 	__GET_EXTERNAL_BY_REF(((*name) __VA_ARGS__))
 #define __GET_LOCATED_BY_REF(name, ...)\
-	((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &((*(name.value)) __VA_ARGS__))
+	(&((*(name.value)) __VA_ARGS__))
 
 #define __GET_VAR_REF(name, ...)\
 	(&(name.value __VA_ARGS__))
--- a/lib/C/iec_types_all.h	Wed Nov 24 08:58:58 2021 +0100
+++ b/lib/C/iec_types_all.h	Tue Dec 14 08:48:05 2021 +0100
@@ -83,7 +83,6 @@
 typedef struct {\
   IEC_##type *value;\
   IEC_BYTE flags;\
-  IEC_##type fvalue;\
 } __IEC_##type##_p;
 
 
@@ -102,7 +101,6 @@
 typedef struct {\
   type *value;\
   IEC_BYTE flags;\
-  type fvalue;\
 } __IEC_##type##_p;
 
 #define __DECLARE_ENUMERATED_TYPE(type, ...)\