mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
978 B
50 lines
978 B
//
|
|
// Macros that create storage for vars
|
|
//
|
|
|
|
//
|
|
// Clear any previous definitions of the macros.
|
|
//
|
|
#undef DC_DATA
|
|
#undef DC_DATA_VAL
|
|
#undef DC_CONST_DATA
|
|
#undef DC_DATA_ARRAY
|
|
#undef DC_CONST_DATA_ARRAY
|
|
#undef DC_DATA_2D_ARRAY
|
|
#undef DC_CONST_DATA_2D_ARRAY
|
|
|
|
|
|
// This is for structs that can't use the DC_DATA macros; they can switch on it
|
|
#define DC_DEFINE_DATA
|
|
|
|
//
|
|
// Allocate Storage
|
|
//
|
|
|
|
#define DC_DATA(TYPE, Name) \
|
|
TYPE Name
|
|
|
|
#define DC_DATA_VAL(TYPE, Name, Value) \
|
|
TYPE Name = Value
|
|
|
|
#define DC_CONST_DATA(TYPE, Name, Value) \
|
|
const TYPE Name = Value
|
|
|
|
|
|
#define DC_DATA_ARRAY(TYPE, Name, Size) \
|
|
TYPE Name[Size]
|
|
|
|
#define DC_CONST_DATA_ARRAY(TYPE, Name, Size, Value) \
|
|
const TYPE Name[Size] = Value
|
|
|
|
|
|
#define DC_DATA_2D_ARRAY(TYPE, Name, Size1, Size2) \
|
|
TYPE Name[Size1][Size2]
|
|
|
|
#define DC_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, Value) \
|
|
const TYPE Name[Size1][Size2] = Value
|
|
|
|
|
|
|
|
|
|
|