Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 56 | mjames | 1 | #ifndef _JTEST_DEFINE_H_ |
| 2 | #define _JTEST_DEFINE_H_ |
||
| 3 | |||
| 4 | /*--------------------------------------------------------------------------------*/ |
||
| 5 | /* Macros and Defines */ |
||
| 6 | /*--------------------------------------------------------------------------------*/ |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Makes a symbol for use as a struct name. Names made this way have two parts; |
||
| 10 | * the first parts is a prefix common to all structs of that class. The second |
||
| 11 | * is a specifier which differs for each instance of that struct type. |
||
| 12 | */ |
||
| 13 | #define JTEST_STRUCT_NAME(prefix, specifier) \ |
||
| 14 | CONCAT(prefix, specifier) |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Define a struct with type with a name generated by #JTEST_STRUCT_NAME(). |
||
| 18 | */ |
||
| 19 | #define JTEST_DEFINE_STRUCT(type, struct_name) \ |
||
| 20 | type struct_name |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Declare a struct with type with a name generated by #JTEST_STRUCT_NAME(). |
||
| 24 | */ |
||
| 25 | #define JTEST_DECLARE_STRUCT(struct_definition) \ |
||
| 26 | extern struct_definition |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Define and initialize a struct (created with JTEST_DEFINE_STRUCT()) and |
||
| 30 | * initialize it with init_values. |
||
| 31 | */ |
||
| 32 | #define JTEST_INIT_STRUCT(struct_definition, init_values) \ |
||
| 33 | struct_definition = { \ |
||
| 34 | init_values \ |
||
| 35 | } |
||
| 36 | |||
| 37 | #endif /* _JTEST_DEFINE_H_ */ |