1039 __ne_time(TIME) |
1039 __ne_time(TIME) |
1040 |
1040 |
1041 __compare_string(__ne_, != ) |
1041 __compare_string(__ne_, != ) |
1042 |
1042 |
1043 |
1043 |
|
1044 |
|
1045 /********************************/ |
|
1046 /* Type tools */ |
|
1047 /********************************/ |
|
1048 /* Enumerate native types */ |
|
1049 #define __decl_enum_type(TYPENAME) TYPENAME##_ENUM, |
|
1050 typedef enum{ |
|
1051 ANY(__decl_enum_type) |
|
1052 } __IEC_types_enum; |
|
1053 |
|
1054 /* Get size of type from its number */ |
|
1055 #define __decl_size_case(TYPENAME) case TYPENAME##_ENUM: return sizeof(TYPENAME); |
|
1056 static inline USINT __get_type_enum_size(__IEC_types_enum t){ |
|
1057 switch(t){ |
|
1058 ANY(__decl_size_case) |
|
1059 } |
|
1060 } |
|
1061 |
|
1062 /* Get string representation of referenced by void pointer where type is given as its number */ |
|
1063 #define __decl_str_case(cat,TYPENAME) case TYPENAME##_ENUM:return __##cat##_to_string(*(TYPENAME*)p); |
|
1064 #define __decl_str_case_bit(TYPENAME) __decl_str_case(bit,TYPENAME) |
|
1065 #define __decl_str_case_real(TYPENAME) __decl_str_case(real,TYPENAME) |
|
1066 #define __decl_str_case_sint(TYPENAME) __decl_str_case(sint,TYPENAME) |
|
1067 #define __decl_str_case_uint(TYPENAME) __decl_str_case(uint,TYPENAME) |
|
1068 static inline STRING __get_type_enum_str(__IEC_types_enum t, void* p){ |
|
1069 switch(t){ |
|
1070 __decl_str_case(bool,BOOL) |
|
1071 ANY_NBIT(__decl_str_case_bit) |
|
1072 ANY_REAL(__decl_str_case_real) |
|
1073 ANY_SINT(__decl_str_case_sint) |
|
1074 ANY_UINT(__decl_str_case_uint) |
|
1075 __decl_str_case(time,TIME) |
|
1076 __decl_str_case(date,DATE) |
|
1077 __decl_str_case(tod,TOD) |
|
1078 __decl_str_case(dt, DT) |
|
1079 } |
|
1080 } |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |