45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/*
|
|
|
|
macros.h : macros used to define enumerated types
|
|
|
|
*/
|
|
|
|
|
|
#if !defined(__MACROS_H__)
|
|
#define __MACROS_H__
|
|
|
|
/*
|
|
* if the constants are not to be enumerated, the typedef does not
|
|
* exist, enabling the programmer to choose the memory usage for the
|
|
* variable. it is his responsibility to ensure that the scope is enough
|
|
* for the enum range. the enumerated type is faked with the specified
|
|
* type.
|
|
* if the constants are enumerated, the type exists, and the variables
|
|
* are of this type. the problem is that the memory usage is implementation-
|
|
* dependant
|
|
*/
|
|
|
|
#if defined(ENUMERATE_CONSTANTS)
|
|
|
|
#define M_BeginDeclareEnumerate(tdeWhatever) \
|
|
typedef enum tdeWhatever##_ \
|
|
{
|
|
|
|
#define M_EndDeclareEnumerate(tdeWhatever, type) \
|
|
} tdeWhatever;
|
|
|
|
#else /* ENUMERATE_CONSTANTS */
|
|
|
|
#define M_BeginDeclareEnumerate(tdeWhatever) \
|
|
enum \
|
|
{
|
|
|
|
#define M_EndDeclareEnumerate(tdeWhatever, type) \
|
|
}; \
|
|
typedef type tdeWhatever;
|
|
|
|
#endif /* !ENUMERATE_CONSTANTS */
|
|
|
|
#endif /* !__MACROS_H__ */
|
|
|