David van Moolenbroek b2ed49a5d8 libmagicrt: integrate into build system
The magic runtime library is now built as part of the regular build, if
the MKMAGIC=yes flag is passed to the build system.  The library has
been renamed from "magic" to "magicrt" to resolve a name clash with BSD
file(1)'s libmagic.  All its level-5 LLVM warnings have been resolved.
 The final library, "libmagicrt.bcc", is now stored in the destination
library directory rather than in the source tree.

Change-Id: Iebd4b93a2cafbb59f95d938ad1edb8b4f6e729f6
2016-01-13 20:32:32 +01:00

29 lines
1.1 KiB
C

#undef xglue
#undef glue
#undef CALLBACK_TYPENAME
#undef CALLBACK_SETTERNAME
#undef DEFINE_CALLBACK
#undef DECLARE_CALLBACK
#define xglue(x, y) x ## y
#define glue(x, y) xglue(x, y)
#ifdef CALLBACK_FAMILY
#define CALLBACK_TYPENAME(name) glue(glue(glue(glue(glue(CALLBACK_PREFIX, _cb_), CALLBACK_FAMILY), _), name), _t)
#define CALLBACK_SETTERNAME(name) glue(glue(glue(glue(CALLBACK_PREFIX, _setcb_), CALLBACK_FAMILY), _), name)
#else
#define CALLBACK_TYPENAME(name) glue(glue(glue(CALLBACK_PREFIX, _cb_), name), _t)
#define CALLBACK_SETTERNAME(name) glue(glue(CALLBACK_PREFIX, _setcb_), name)
#endif
#define DECLARE_CALLBACK(ret_type, name, args) \
typedef ret_type(*CALLBACK_TYPENAME(name))args
#define DEFINE_DECL_CALLBACK(ret_type, name, args) \
DECLARE_CALLBACK(ret_type, name, args); \
void CALLBACK_SETTERNAME(name)(CALLBACK_TYPENAME(name) cb)
#define DEFINE_DECL_CALLBACK_CUSTOM(ret_type, name, args, setter_args) \
DECLARE_CALLBACK(ret_type, name, args); \
void CALLBACK_SETTERNAME(name)setter_args