Edouard@2632: 
Edouard@3395: #define __Unpack_case_t(TYPENAME)                                           \
Edouard@3395:         case TYPENAME##_ENUM :                                              \
Edouard@3395:             if(flags) *flags = ((__IEC_##TYPENAME##_t *)varp)->flags;       \
Edouard@3395:             if(value_p) *value_p = &((__IEC_##TYPENAME##_t *)varp)->value;  \
Edouard@3395: 		    if(size) *size = sizeof(TYPENAME);                              \
Edouard@2632:             break;
Edouard@2632: 
Edouard@3395: #define __Unpack_case_p(TYPENAME)                                           \
Edouard@3395:         case TYPENAME##_O_ENUM :                                            \
Edouard@3395:         case TYPENAME##_P_ENUM :                                            \
Edouard@3395:             if(flags) *flags = ((__IEC_##TYPENAME##_p *)varp)->flags;       \
Edouard@3395:             if(value_p) *value_p = ((__IEC_##TYPENAME##_p *)varp)->value;   \
Edouard@3395: 		    if(size) *size = sizeof(TYPENAME);                              \
Edouard@2632:             break;
Edouard@2632: 
edouard@2710: #define __Is_a_string(dsc) (dsc->type == STRING_ENUM)   ||\
edouard@2710:                            (dsc->type == STRING_P_ENUM) ||\
edouard@2710:                            (dsc->type == STRING_O_ENUM)
edouard@2710: 
Edouard@3395: static int UnpackVar(__Unpack_desc_type *dsc, void **value_p, char *flags, size_t *size)
Edouard@2632: {
Edouard@2632:     void *varp = dsc->ptr;
Edouard@2632:     /* find data to copy*/
Edouard@2632:     switch(dsc->type){
Edouard@2632:         __ANY(__Unpack_case_t)
Edouard@2632:         __ANY(__Unpack_case_p)
Edouard@2632:     default:
Edouard@3395:         return 0; /* should never happen */
Edouard@2632:     }
Edouard@3395:     return 1;
Edouard@2632: }
Edouard@2632: