31,6 → 31,7 |
*/ |
|
/** @file |
* Generic type field. |
*/ |
|
#ifndef __GENERIC_FIELD_H__ |
41,8 → 42,14 |
#include <mem.h> |
#include <unistd.h> |
|
/** Internal magic value for a field consistency check. |
*/ |
#define GENERIC_FIELD_MAGIC_VALUE 0x55667788 |
|
/** Generic type field declaration. |
* @param name Name of the field. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define GENERIC_FIELD_DECLARE( name, type ) \ |
\ |
typedef struct name name##_t; \ |
64,6 → 71,11 |
int name##_initialize( name##_ref field ); \ |
int name##_is_valid( name##_ref field ); |
|
/** Generic type field implementation. |
* Should follow declaration with the same parameters. |
* @param name Name of the field. Input parameter. |
* @param type Inner object type. Input parameter |
*/ |
#define GENERIC_FIELD_IMPLEMENT( name, type ) \ |
\ |
int name##_add( name##_ref field, type * value ){ \ |