define macros for struct members declaration
This commit is contained in:
parent
1418709bdf
commit
a02e91bfa3
2 changed files with 3 additions and 11 deletions
12
struct.c
12
struct.c
|
|
@ -1,16 +1,8 @@
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
|
|
||||||
struct cu_value_s test_struct[] = {
|
CU_STRUCT_BEGIN(test)
|
||||||
{.type = Sequence, .sequence = {.size = 6}},
|
|
||||||
{.type = Array, .array = {.item = 4, .count = 12, .index = 0}},
|
|
||||||
{.type = Int16},
|
|
||||||
{.type = Array, .array = {.item = 14, .count = 3, .index = 1}},
|
|
||||||
{.type = NoValue}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*CU_STRUCT_BEGIN(test)
|
|
||||||
CU_VALUE_SEQUENCE(6)
|
CU_VALUE_SEQUENCE(6)
|
||||||
CU_VALUE_ARRAY(4, 12)
|
CU_VALUE_ARRAY(4, 12)
|
||||||
CU_VALUE_INT16()
|
CU_VALUE_INT16()
|
||||||
CU_VALUE_ARRAY_INDEX(14, 3)
|
CU_VALUE_ARRAY_INDEX(14, 3)
|
||||||
CU_STRUCT_END()*/
|
CU_STRUCT_END()
|
||||||
|
|
|
||||||
2
struct.h
2
struct.h
|
|
@ -36,7 +36,7 @@ struct cu_value_s {
|
||||||
#define CU_VALUE_INT32() {.type = Int32},
|
#define CU_VALUE_INT32() {.type = Int32},
|
||||||
#define CU_VALUE_INT64() {.type = Int64},
|
#define CU_VALUE_INT64() {.type = Int64},
|
||||||
#define CU_VALUE_SEQUENCE(_size) \
|
#define CU_VALUE_SEQUENCE(_size) \
|
||||||
{.type = Sequence, .sequence = {.size = (_size)},
|
{.type = Sequence, .sequence = {.size = (_size)}},
|
||||||
#define CU_VALUE_ARRAY(_item, _count) \
|
#define CU_VALUE_ARRAY(_item, _count) \
|
||||||
{.type = Array, .array = {.item = (_item), .count = (_count), .index = 0}},
|
{.type = Array, .array = {.item = (_item), .count = (_count), .index = 0}},
|
||||||
#define CU_VALUE_ARRAY_INDEX(_item, _index) \
|
#define CU_VALUE_ARRAY_INDEX(_item, _index) \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue