Rev 4743 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4743 | Rev 4756 | ||
|---|---|---|---|
| Line 45... | Line 45... | ||
| 45 | /** Internal magic value for a field consistency check. |
45 | /** Internal magic value for a field consistency check. |
| 46 | */ |
46 | */ |
| 47 | #define GENERIC_FIELD_MAGIC_VALUE 0x55667788 |
47 | #define GENERIC_FIELD_MAGIC_VALUE 0x55667788 |
| 48 | 48 | ||
| 49 | /** Generic type field declaration. |
49 | /** Generic type field declaration. |
| 50 | * @param name Name of the field. Input parameter. |
50 | * @param[in] name Name of the field. |
| 51 | * @param type Inner object type. Input parameter |
51 | * @param[in] type Inner object type. |
| 52 | */ |
52 | */ |
| 53 | #define GENERIC_FIELD_DECLARE( name, type ) \ |
53 | #define GENERIC_FIELD_DECLARE( name, type ) \ |
| 54 | \ |
54 | \ |
| 55 | typedef struct name name##_t; \ |
55 | typedef struct name name##_t; \ |
| 56 | typedef name##_t * name##_ref; \ |
56 | typedef name##_t * name##_ref; \ |
| Line 71... | Line 71... | ||
| 71 | int name##_initialize( name##_ref field ); \ |
71 | int name##_initialize( name##_ref field ); \ |
| 72 | int name##_is_valid( name##_ref field ); |
72 | int name##_is_valid( name##_ref field ); |
| 73 | 73 | ||
| 74 | /** Generic type field implementation. |
74 | /** Generic type field implementation. |
| 75 | * Should follow declaration with the same parameters. |
75 | * Should follow declaration with the same parameters. |
| 76 | * @param name Name of the field. Input parameter. |
76 | * @param[in] name Name of the field. |
| 77 | * @param type Inner object type. Input parameter |
77 | * @param[in] type Inner object type. |
| 78 | */ |
78 | */ |
| 79 | #define GENERIC_FIELD_IMPLEMENT( name, type ) \ |
79 | #define GENERIC_FIELD_IMPLEMENT( name, type ) \ |
| 80 | \ |
80 | \ |
| 81 | int name##_add( name##_ref field, type * value ){ \ |
81 | int name##_add( name##_ref field, type * value ){ \ |
| 82 | if( name##_is_valid( field )){ \ |
82 | if( name##_is_valid( field )){ \ |