#define A_SEQUENCE_OF(type) A_SET_OF(type) #define A_SET_OF(type) \ struct { \ type **array; \ int count; /* Meaningful size */ \ int size; /* Allocated size */ \ void (*free)(type *); \ } typedef struct IntersectionStateList { A_SEQUENCE_OF(struct IntersectionState) list; } IntersectionStateList_t; typedef struct IntersectionState { NodeReferenceID_t intersectionId; IntersectionStatusObject_t status; MinuteOfTheYear_t *moy /* OPTIONAL */; DSecond_t *timeStamp /* OPTIONAL */; PhaseList_t phases; } IntersectionState_t; typedef struct SPAT { MsgCount_t msgCnt; MinuteOfTheYear_t *timeStamp /* OPTIONAL */; DescriptiveName_t *name /* OPTIONAL */; IntersectionStateList_t intersections; } SPAT_t; 我想使用SPAT_t结构体,但是当中的成员intersections的定义让我很困惑,不知道怎么调用A_SEQUENCE_OF?求大家支招。 |
类似这样吗?不知道"调用A_SEQUENCE_OF"是指什么,define只是简单的字符串替换。
SPAT_t t1; t1.intersections.list.size=3;