36 lines
692 B
C
36 lines
692 B
C
/* vxmux_util.h - conventional utility macros for VxWorks */
|
|
|
|
#ifndef VXMUX_UTIL_H
|
|
#define VXMUX_UTIL_H
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define member_to_object(pMember, type, memberName) \
|
|
((type *)((char *)(pMember) - offsetof (type, memberName)))
|
|
|
|
|
|
#ifdef VXMUX_NDEBUG
|
|
#define VXMUX_ASSERT(x) ((void)0)
|
|
#else
|
|
void __vxmux_assert(const char *msg);
|
|
|
|
#define _MKSTRING(s) _MKSTRING2(s)
|
|
#define _MKSTRING2(s) #s
|
|
|
|
#define VXMUX_ASSERT(x) \
|
|
((void)((x) ? ((void)0) : \
|
|
__vxmux_assert("Assertion failed: "#x", file " __FILE__ \
|
|
", line "_MKSTRING(__LINE__)"\n")))
|
|
#endif /* VXMUX_NDEBUG */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* VXMUX_UTIL_H */
|