1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _KERNEL_UTIL_KERNEL_C_H
6#define _KERNEL_UTIL_KERNEL_C_H
7
8
9/*!	Defines a structure that has the size of a certain C++ structure.
10	\param name The name of the C++ structure.
11	\param flatName The name of the structure to be defined.
12*/
13#define DEFINE_FLAT_KERNEL_CPP_STRUCT(name, flatName)	\
14	struct flatName {									\
15		char	bytes[_KERNEL_CPP_STRUCT_SIZE_##name];	\
16	};
17
18
19/*!	In C mode DEFINE_KERNEL_CPP_STRUCT() defines a struct \a name with the
20	size of the C++ structure of the same name. In C++ it is a no-op.
21*/
22#ifdef __cplusplus
23#	define DEFINE_KERNEL_CPP_STRUCT(name)
24#else
25#	define DEFINE_KERNEL_CPP_STRUCT(name)			\
26		DEFINE_FLAT_KERNEL_CPP_STRUCT(name, name)	\
27		typedef struct name name;
28#endif
29
30
31#endif	/* _KERNEL_UTIL_KERNEL_C_H */
32