Edouard@2767: 
Edouard@2767: #define __Unpack_case_t(TYPENAME) \
Edouard@2767:         case TYPENAME##_ENUM :\
Edouard@2767:             *flags = ((__IEC_##TYPENAME##_t *)varp)->flags;\
Edouard@2767:             forced_value_p = *real_value_p = &((__IEC_##TYPENAME##_t *)varp)->value;\
Edouard@2767:             break;
Edouard@2767: 
Edouard@2767: #define __Unpack_case_p(TYPENAME)\
Edouard@2767:         case TYPENAME##_O_ENUM :\
Edouard@2767:             *flags = __IEC_OUTPUT_FLAG;\
Edouard@2767:         case TYPENAME##_P_ENUM :\
Edouard@2767:             *flags |= ((__IEC_##TYPENAME##_p *)varp)->flags;\
Edouard@2767:             *real_value_p = ((__IEC_##TYPENAME##_p *)varp)->value;\
Edouard@2767:             forced_value_p = &((__IEC_##TYPENAME##_p *)varp)->fvalue;\
Edouard@2767:             break;
Edouard@2767: 
edouard@2825: #define __Is_a_string(dsc) (dsc->type == STRING_ENUM)   ||\
edouard@2825:                            (dsc->type == STRING_P_ENUM) ||\
edouard@2825:                            (dsc->type == STRING_O_ENUM)
edouard@2825: 
Edouard@2767: static void* UnpackVar(__Unpack_desc_type *dsc, void **real_value_p, char *flags)
Edouard@2767: {
Edouard@2767:     void *varp = dsc->ptr;
Edouard@2767:     void *forced_value_p = NULL;
Edouard@2767:     *flags = 0;
Edouard@2767:     /* find data to copy*/
Edouard@2767:     switch(dsc->type){
Edouard@2767:         __ANY(__Unpack_case_t)
Edouard@2767:         __ANY(__Unpack_case_p)
Edouard@2767:     default:
Edouard@2767:         break;
Edouard@2767:     }
Edouard@2767:     if (*flags & __IEC_FORCE_FLAG)
Edouard@2767:         return forced_value_p;
Edouard@2767:     return *real_value_p;
Edouard@2767: }
Edouard@2767: