lib/iec_types_all.h
changeset 327 da78d0d93c75
parent 301 15bf9ecb936d
child 350 2c3c4dc34979
equal deleted inserted replaced
326:e3fbf97d2021 327:da78d0d93c75
    30   IEC_##type *value;\
    30   IEC_##type *value;\
    31   IEC_BYTE flags;\
    31   IEC_BYTE flags;\
    32   IEC_##type fvalue;\
    32   IEC_##type fvalue;\
    33 } __IEC_##type##_p;
    33 } __IEC_##type##_p;
    34 
    34 
    35 #define __DECLARE_DERIVED_TYPE(base, type)\
    35 #define __DECLARE_DERIVED_TYPE(type, base)\
    36 typedef base type;\
    36 typedef base type;\
    37 typedef __IEC_##base##_t __IEC_##type##_t;
    37 typedef __IEC_##base##_t __IEC_##type##_t;
    38 
    38 
    39 #define __DECLARE_COMPLEX_STRUCT(type)\
    39 #define __DECLARE_COMPLEX_STRUCT(type)\
    40 typedef struct {\
    40 typedef struct {\
    45 typedef struct {\
    45 typedef struct {\
    46   type *value;\
    46   type *value;\
    47   IEC_BYTE flags;\
    47   IEC_BYTE flags;\
    48 } __IEC_##type##_p;
    48 } __IEC_##type##_p;
    49 
    49 
    50 #define __DECLARE_ARRAY_TYPE(base, type, size)\
    50 #define __DECLARE_ENUMERATED_TYPE(type, ...)\
       
    51 typedef enum {\
       
    52   __VA_ARGS__\
       
    53 } type;\
       
    54 __DECLARE_COMPLEX_STRUCT(type)
       
    55 
       
    56 #define __DECLARE_ARRAY_TYPE(type, base, size)\
    51 typedef struct {\
    57 typedef struct {\
    52   base table size;\
    58   base table size;\
    53 } type;\
    59 } type;\
    54 __DECLARE_COMPLEX_STRUCT(type);
    60 __DECLARE_COMPLEX_STRUCT(type)
    55 
    61 
    56 #define __DECLARE_STRUCT_TYPE(elements, type)\
    62 #define __DECLARE_STRUCT_TYPE(type, elements)\
    57 typedef elements type;\
    63 typedef struct {\
    58 __DECLARE_COMPLEX_STRUCT(type);
    64   elements\
       
    65 } type;\
       
    66 __DECLARE_COMPLEX_STRUCT(type)
    59 
    67 
    60 /* Those typdefs clash with windows.h */
    68 /* Those typdefs clash with windows.h */
    61 /* i.e. this file cannot be included aside windows.h */
    69 /* i.e. this file cannot be included aside windows.h */
    62 ANY(__DECLARE_IEC_TYPE)
    70 ANY(__DECLARE_IEC_TYPE)
    63 
    71