x11/wayland/mir: Make the dynamic loading macro salsa a little less messy.

This commit is contained in:
Ryan C. Gordon
2016-02-18 23:27:58 -05:00
parent d6699d5541
commit df4be2f200
9 changed files with 38 additions and 57 deletions

View File

@@ -85,8 +85,6 @@ MIR_GetSym(const char *fnname, int *pHasModule)
#define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0;
#define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL;
#include "SDL_mirsym.h"
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
static int mir_load_refcount = 0;
@@ -104,8 +102,6 @@ SDL_MIR_UnloadSymbols(void)
#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0;
#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL;
#include "SDL_mirsym.h"
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
@@ -138,16 +134,11 @@ SDL_MIR_LoadSymbols(void)
}
#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
#define SDL_MIR_SYM(rc,fn,params)
#include "SDL_mirsym.h"
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
#define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
#include "SDL_mirsym.h"
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) {
/* all required symbols loaded. */
@@ -163,8 +154,6 @@ SDL_MIR_LoadSymbols(void)
#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn;
#include "SDL_mirsym.h"
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
#endif
}

View File

@@ -36,13 +36,10 @@ int SDL_MIR_LoadSymbols(void);
void SDL_MIR_UnloadSymbols(void);
/* Declare all the function pointers and wrappers... */
#define SDL_MIR_MODULE(modname)
#define SDL_MIR_SYM(rc,fn,params) \
typedef rc (*SDL_DYNMIRFN_##fn) params; \
extern SDL_DYNMIRFN_##fn MIR_##fn;
#include "SDL_mirsym.h"
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
#ifdef __cplusplus
}

View File

@@ -21,6 +21,14 @@
/* *INDENT-OFF* */
#ifndef SDL_MIR_MODULE
#define SDL_MIR_MODULE(modname)
#endif
#ifndef SDL_MIR_SYM
#define SDL_MIR_SYM(rc,fn,params)
#endif
SDL_MIR_MODULE(MIR_CLIENT)
SDL_MIR_SYM(MirDisplayConfiguration*,mir_connection_create_display_config,(MirConnection *connection))
SDL_MIR_SYM(MirSurface *,mir_connection_create_surface_sync,(MirConnection *connection, MirSurfaceParameters const *params))
@@ -44,6 +52,9 @@ SDL_MIR_SYM(void,mir_surface_swap_buffers_sync,(MirSurface *surface))
SDL_MIR_MODULE(XKBCOMMON)
SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size))
#undef SDL_MIR_MODULE
#undef SDL_MIR_SYM
/* *INDENT-ON* */
/* vi: set ts=4 sw=4 expandtab: */