x11/wayland/mir: Make the dynamic loading macro salsa a little less messy.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 18 Feb 2016 23:27:58 -0500
changeset 10079 6eaf52c8d398
parent 10078 c1bd97d27681
child 10081 a858fbc2e1f8
x11/wayland/mir: Make the dynamic loading macro salsa a little less messy.
src/video/mir/SDL_mirdyn.c
src/video/mir/SDL_mirdyn.h
src/video/mir/SDL_mirsym.h
src/video/wayland/SDL_waylanddyn.c
src/video/wayland/SDL_waylanddyn.h
src/video/wayland/SDL_waylandsym.h
src/video/x11/SDL_x11dyn.c
src/video/x11/SDL_x11dyn.h
src/video/x11/SDL_x11sym.h
--- a/src/video/mir/SDL_mirdyn.c	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/mir/SDL_mirdyn.c	Thu Feb 18 23:27:58 2016 -0500
@@ -85,8 +85,6 @@
 #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 @@
 #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 @@
         }
 
 #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 @@
 #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
     }
--- a/src/video/mir/SDL_mirdyn.h	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/mir/SDL_mirdyn.h	Thu Feb 18 23:27:58 2016 -0500
@@ -36,13 +36,10 @@
 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
 }
--- a/src/video/mir/SDL_mirsym.h	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/mir/SDL_mirsym.h	Thu Feb 18 23:27:58 2016 -0500
@@ -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_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: */
--- a/src/video/wayland/SDL_waylanddyn.c	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/wayland/SDL_waylanddyn.c	Thu Feb 18 23:27:58 2016 -0500
@@ -94,9 +94,6 @@
 #define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL;
 #define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL;
 #include "SDL_waylandsym.h"
-#undef SDL_WAYLAND_MODULE
-#undef SDL_WAYLAND_SYM
-#undef SDL_WAYLAND_INTERFACE
 
 static int wayland_load_refcount = 0;
 
@@ -115,9 +112,6 @@
 #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL;
 #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL;
 #include "SDL_waylandsym.h"
-#undef SDL_WAYLAND_MODULE
-#undef SDL_WAYLAND_SYM
-#undef SDL_WAYLAND_INTERFACE
 
 
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
@@ -150,20 +144,12 @@
         }
 
 #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
-#define SDL_WAYLAND_SYM(rc,fn,params)
-#define SDL_WAYLAND_INTERFACE(iface)
 #include "SDL_waylandsym.h"
-#undef SDL_WAYLAND_MODULE
-#undef SDL_WAYLAND_SYM
-#undef SDL_WAYLAND_INTERFACE
 
 #define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
 #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
 #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
 #include "SDL_waylandsym.h"
-#undef SDL_WAYLAND_MODULE
-#undef SDL_WAYLAND_SYM
-#undef SDL_WAYLAND_INTERFACE
 
         if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) {
             /* all required symbols loaded. */
@@ -180,9 +166,6 @@
 #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
 #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface;
 #include "SDL_waylandsym.h"
-#undef SDL_WAYLAND_MODULE
-#undef SDL_WAYLAND_SYM
-#undef SDL_WAYLAND_INTERFACE
 
 #endif
     }
--- a/src/video/wayland/SDL_waylanddyn.h	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/wayland/SDL_waylanddyn.h	Thu Feb 18 23:27:58 2016 -0500
@@ -53,10 +53,7 @@
     extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn;
 #define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface;
 #include "SDL_waylandsym.h"
-#undef SDL_WAYLAND_MODULE
-#undef SDL_WAYLAND_SYM
-#undef SDL_WAYLAND_INTERFACE
- 
+
 
 #ifdef __cplusplus
 }
--- a/src/video/wayland/SDL_waylandsym.h	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/wayland/SDL_waylandsym.h	Thu Feb 18 23:27:58 2016 -0500
@@ -21,6 +21,18 @@
 
 /* *INDENT-OFF* */
 
+#ifndef SDL_WAYLAND_MODULE
+#define SDL_WAYLAND_MODULE(modname)
+#endif
+
+#ifndef SDL_WAYLAND_SYM
+#define SDL_WAYLAND_SYM(rc,fn,params)
+#endif
+
+#ifndef SDL_WAYLAND_INTERFACE
+#define SDL_WAYLAND_INTERFACE(iface)
+#endif
+
 SDL_WAYLAND_MODULE(WAYLAND_CLIENT)
 SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...))
 SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *))
@@ -99,8 +111,10 @@
                       xkb_layout_index_t latched_layout,\
                       xkb_layout_index_t locked_layout) )
 
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
 
 /* *INDENT-ON* */
 
 /* vi: set ts=4 sw=4 expandtab: */
-//SDL_WAYLAND_SYM(ret, fn, params)
--- a/src/video/x11/SDL_x11dyn.c	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/x11/SDL_x11dyn.c	Thu Feb 18 23:27:58 2016 -0500
@@ -106,11 +106,8 @@
 #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */
 
 /* Define all the function pointers and wrappers... */
-#define SDL_X11_MODULE(modname)
 #define SDL_X11_SYM(rc,fn,params,args,ret) SDL_DYNX11FN_##fn X11_##fn = NULL;
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 /* Annoying varargs entry point... */
 #ifdef X_HAVE_UTF8_STRING
@@ -120,10 +117,7 @@
 
 /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
 #define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 0;
-#define SDL_X11_SYM(rc,fn,params,args,ret)
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 static int x11_load_refcount = 0;
 
@@ -139,8 +133,6 @@
 #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0;
 #define SDL_X11_SYM(rc,fn,params,args,ret) X11_##fn = NULL;
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 #ifdef X_HAVE_UTF8_STRING
             X11_XCreateIC = NULL;
@@ -177,16 +169,11 @@
         }
 
 #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */
-#define SDL_X11_SYM(a,fn,x,y,z)
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
 #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod);
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 #ifdef X_HAVE_UTF8_STRING
         X11_XCreateIC = (SDL_DYNX11FN_XCreateIC)
@@ -209,8 +196,6 @@
 #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */
 #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn;
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 #ifdef X_HAVE_UTF8_STRING
         X11_XCreateIC = XCreateIC;
--- a/src/video/x11/SDL_x11dyn.h	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/x11/SDL_x11dyn.h	Thu Feb 18 23:27:58 2016 -0500
@@ -86,13 +86,10 @@
 void SDL_X11_UnloadSymbols(void);
 
 /* Declare all the function pointers and wrappers... */
-#define SDL_X11_MODULE(modname)
 #define SDL_X11_SYM(rc,fn,params,args,ret) \
     typedef rc (*SDL_DYNX11FN_##fn) params; \
     extern SDL_DYNX11FN_##fn X11_##fn;
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 /* Annoying varargs entry point... */
 #ifdef X_HAVE_UTF8_STRING
@@ -104,10 +101,7 @@
 
 /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
 #define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
-#define SDL_X11_SYM(rc,fn,params,args,ret)
 #include "SDL_x11sym.h"
-#undef SDL_X11_MODULE
-#undef SDL_X11_SYM
 
 #ifdef __cplusplus
 }
--- a/src/video/x11/SDL_x11sym.h	Wed Feb 17 14:15:37 2016 -0800
+++ b/src/video/x11/SDL_x11sym.h	Thu Feb 18 23:27:58 2016 -0500
@@ -21,6 +21,14 @@
 
 /* *INDENT-OFF* */
 
+#ifndef SDL_X11_MODULE
+#define SDL_X11_MODULE(modname)
+#endif
+
+#ifndef SDL_X11_SYM
+#define SDL_X11_SYM(rc,fn,params,args,ret)
+#endif
+
 SDL_X11_MODULE(BASEXLIB)
 SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
 SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return)
@@ -311,6 +319,9 @@
 SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return)
 #endif
 
+#undef SDL_X11_MODULE
+#undef SDL_X11_SYM
+
 /* *INDENT-ON* */
 
 /* vi: set ts=4 sw=4 expandtab: */