8 /*********************/ |
8 /*********************/ |
9 |
9 |
10 /* Include non windows.h clashing typedefs */ |
10 /* Include non windows.h clashing typedefs */ |
11 #include "iec_types.h" |
11 #include "iec_types.h" |
12 |
12 |
|
13 #define TRUE 1 |
|
14 #define FALSE 0 |
|
15 |
|
16 #define __DECLARE_IEC_TYPE(type)\ |
|
17 typedef IEC_##type type;\ |
|
18 \ |
|
19 typedef struct {\ |
|
20 IEC_##type value;\ |
|
21 IEC_BYTE flags;\ |
|
22 } __IEC_##type##_t;\ |
|
23 \ |
|
24 typedef struct {\ |
|
25 IEC_##type *value;\ |
|
26 IEC_BYTE flags;\ |
|
27 IEC_##type fvalue;\ |
|
28 } __IEC_##type##_p; |
|
29 |
|
30 #define __DECLARE_DERIVED_TYPE(base, type)\ |
|
31 typedef base type;\ |
|
32 typedef __IEC_##base##_t __IEC_##type##_t; |
|
33 |
|
34 #define __DECLARE_COMPLEX_STRUCT(type)\ |
|
35 typedef struct {\ |
|
36 type value;\ |
|
37 IEC_BYTE flags;\ |
|
38 } __IEC_##type##_t;\ |
|
39 \ |
|
40 typedef struct {\ |
|
41 type *value;\ |
|
42 IEC_BYTE flags;\ |
|
43 } __IEC_##type##_p; |
|
44 |
|
45 #define __DECLARE_ARRAY_TYPE(base, type, size)\ |
|
46 typedef base type size;\ |
|
47 __DECLARE_COMPLEX_STRUCT(type); |
|
48 |
|
49 #define __DECLARE_STRUCT_TYPE(elements, type)\ |
|
50 typedef elements type;\ |
|
51 __DECLARE_COMPLEX_STRUCT(type); |
|
52 |
13 /* Those typdefs clash with windows.h */ |
53 /* Those typdefs clash with windows.h */ |
14 /* i.e. this file cannot be included aside windows.h */ |
54 /* i.e. this file cannot be included aside windows.h */ |
|
55 ANY(__DECLARE_IEC_TYPE) |
|
56 |
|
57 |
|
58 /* |
15 typedef IEC_BOOL BOOL; |
59 typedef IEC_BOOL BOOL; |
16 |
|
17 #define TRUE 1 |
|
18 #define FALSE 0 |
|
19 |
60 |
20 typedef IEC_SINT SINT; |
61 typedef IEC_SINT SINT; |
21 typedef IEC_INT INT; |
62 typedef IEC_INT INT; |
22 typedef IEC_DINT DINT; |
63 typedef IEC_DINT DINT; |
23 typedef IEC_LINT LINT; |
64 typedef IEC_LINT LINT; |
39 typedef IEC_DATE DATE; |
80 typedef IEC_DATE DATE; |
40 typedef IEC_DT DT; |
81 typedef IEC_DT DT; |
41 typedef IEC_TOD TOD; |
82 typedef IEC_TOD TOD; |
42 |
83 |
43 typedef IEC_STRING STRING; |
84 typedef IEC_STRING STRING; |
|
85 */ |
44 |
86 |
45 typedef struct { |
87 typedef struct { |
46 BOOL state; // current step state. 0 : inative, 1: active |
88 __IEC_BOOL_t state; // current step state. 0 : inative, 1: active |
47 BOOL prev_state; // previous step state. 0 : inative, 1: active |
89 BOOL prev_state; // previous step state. 0 : inative, 1: active |
48 TIME elapsed_time; // time since step is active |
90 TIME elapsed_time; // time since step is active |
49 } STEP; |
91 } STEP; |
50 |
92 |
51 typedef struct { |
93 typedef struct { |