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 100796eaf52c8d398
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
     1.1 --- a/src/video/mir/SDL_mirdyn.c	Wed Feb 17 14:15:37 2016 -0800
     1.2 +++ b/src/video/mir/SDL_mirdyn.c	Thu Feb 18 23:27:58 2016 -0500
     1.3 @@ -85,8 +85,6 @@
     1.4  #define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0;
     1.5  #define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL;
     1.6  #include "SDL_mirsym.h"
     1.7 -#undef SDL_MIR_MODULE
     1.8 -#undef SDL_MIR_SYM
     1.9  
    1.10  static int mir_load_refcount = 0;
    1.11  
    1.12 @@ -104,8 +102,6 @@
    1.13  #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0;
    1.14  #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL;
    1.15  #include "SDL_mirsym.h"
    1.16 -#undef SDL_MIR_MODULE
    1.17 -#undef SDL_MIR_SYM
    1.18  
    1.19  
    1.20  #ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
    1.21 @@ -138,16 +134,11 @@
    1.22          }
    1.23  
    1.24  #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
    1.25 -#define SDL_MIR_SYM(rc,fn,params)
    1.26  #include "SDL_mirsym.h"
    1.27 -#undef SDL_MIR_MODULE
    1.28 -#undef SDL_MIR_SYM
    1.29  
    1.30  #define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
    1.31  #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
    1.32  #include "SDL_mirsym.h"
    1.33 -#undef SDL_MIR_MODULE
    1.34 -#undef SDL_MIR_SYM
    1.35  
    1.36          if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) {
    1.37              /* all required symbols loaded. */
    1.38 @@ -163,8 +154,6 @@
    1.39  #define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
    1.40  #define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn;
    1.41  #include "SDL_mirsym.h"
    1.42 -#undef SDL_MIR_MODULE
    1.43 -#undef SDL_MIR_SYM
    1.44  
    1.45  #endif
    1.46      }
     2.1 --- a/src/video/mir/SDL_mirdyn.h	Wed Feb 17 14:15:37 2016 -0800
     2.2 +++ b/src/video/mir/SDL_mirdyn.h	Thu Feb 18 23:27:58 2016 -0500
     2.3 @@ -36,13 +36,10 @@
     2.4  void SDL_MIR_UnloadSymbols(void);
     2.5  
     2.6  /* Declare all the function pointers and wrappers... */
     2.7 -#define SDL_MIR_MODULE(modname)
     2.8  #define SDL_MIR_SYM(rc,fn,params) \
     2.9      typedef rc (*SDL_DYNMIRFN_##fn) params; \
    2.10      extern SDL_DYNMIRFN_##fn MIR_##fn;
    2.11  #include "SDL_mirsym.h"
    2.12 -#undef SDL_MIR_MODULE
    2.13 -#undef SDL_MIR_SYM
    2.14  
    2.15  #ifdef __cplusplus
    2.16  }
     3.1 --- a/src/video/mir/SDL_mirsym.h	Wed Feb 17 14:15:37 2016 -0800
     3.2 +++ b/src/video/mir/SDL_mirsym.h	Thu Feb 18 23:27:58 2016 -0500
     3.3 @@ -21,6 +21,14 @@
     3.4  
     3.5  /* *INDENT-OFF* */
     3.6  
     3.7 +#ifndef SDL_MIR_MODULE
     3.8 +#define SDL_MIR_MODULE(modname)
     3.9 +#endif
    3.10 +
    3.11 +#ifndef SDL_MIR_SYM
    3.12 +#define SDL_MIR_SYM(rc,fn,params)
    3.13 +#endif
    3.14 +
    3.15  SDL_MIR_MODULE(MIR_CLIENT)
    3.16  SDL_MIR_SYM(MirDisplayConfiguration*,mir_connection_create_display_config,(MirConnection *connection))
    3.17  SDL_MIR_SYM(MirSurface *,mir_connection_create_surface_sync,(MirConnection *connection, MirSurfaceParameters const *params))
    3.18 @@ -44,6 +52,9 @@
    3.19  SDL_MIR_MODULE(XKBCOMMON)
    3.20  SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size))
    3.21  
    3.22 +#undef SDL_MIR_MODULE
    3.23 +#undef SDL_MIR_SYM
    3.24 +
    3.25  /* *INDENT-ON* */
    3.26  
    3.27  /* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/src/video/wayland/SDL_waylanddyn.c	Wed Feb 17 14:15:37 2016 -0800
     4.2 +++ b/src/video/wayland/SDL_waylanddyn.c	Thu Feb 18 23:27:58 2016 -0500
     4.3 @@ -94,9 +94,6 @@
     4.4  #define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL;
     4.5  #define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL;
     4.6  #include "SDL_waylandsym.h"
     4.7 -#undef SDL_WAYLAND_MODULE
     4.8 -#undef SDL_WAYLAND_SYM
     4.9 -#undef SDL_WAYLAND_INTERFACE
    4.10  
    4.11  static int wayland_load_refcount = 0;
    4.12  
    4.13 @@ -115,9 +112,6 @@
    4.14  #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL;
    4.15  #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL;
    4.16  #include "SDL_waylandsym.h"
    4.17 -#undef SDL_WAYLAND_MODULE
    4.18 -#undef SDL_WAYLAND_SYM
    4.19 -#undef SDL_WAYLAND_INTERFACE
    4.20  
    4.21  
    4.22  #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
    4.23 @@ -150,20 +144,12 @@
    4.24          }
    4.25  
    4.26  #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
    4.27 -#define SDL_WAYLAND_SYM(rc,fn,params)
    4.28 -#define SDL_WAYLAND_INTERFACE(iface)
    4.29  #include "SDL_waylandsym.h"
    4.30 -#undef SDL_WAYLAND_MODULE
    4.31 -#undef SDL_WAYLAND_SYM
    4.32 -#undef SDL_WAYLAND_INTERFACE
    4.33  
    4.34  #define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
    4.35  #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
    4.36  #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
    4.37  #include "SDL_waylandsym.h"
    4.38 -#undef SDL_WAYLAND_MODULE
    4.39 -#undef SDL_WAYLAND_SYM
    4.40 -#undef SDL_WAYLAND_INTERFACE
    4.41  
    4.42          if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) {
    4.43              /* all required symbols loaded. */
    4.44 @@ -180,9 +166,6 @@
    4.45  #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
    4.46  #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface;
    4.47  #include "SDL_waylandsym.h"
    4.48 -#undef SDL_WAYLAND_MODULE
    4.49 -#undef SDL_WAYLAND_SYM
    4.50 -#undef SDL_WAYLAND_INTERFACE
    4.51  
    4.52  #endif
    4.53      }
     5.1 --- a/src/video/wayland/SDL_waylanddyn.h	Wed Feb 17 14:15:37 2016 -0800
     5.2 +++ b/src/video/wayland/SDL_waylanddyn.h	Thu Feb 18 23:27:58 2016 -0500
     5.3 @@ -53,10 +53,7 @@
     5.4      extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn;
     5.5  #define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface;
     5.6  #include "SDL_waylandsym.h"
     5.7 -#undef SDL_WAYLAND_MODULE
     5.8 -#undef SDL_WAYLAND_SYM
     5.9 -#undef SDL_WAYLAND_INTERFACE
    5.10 - 
    5.11 +
    5.12  
    5.13  #ifdef __cplusplus
    5.14  }
     6.1 --- a/src/video/wayland/SDL_waylandsym.h	Wed Feb 17 14:15:37 2016 -0800
     6.2 +++ b/src/video/wayland/SDL_waylandsym.h	Thu Feb 18 23:27:58 2016 -0500
     6.3 @@ -21,6 +21,18 @@
     6.4  
     6.5  /* *INDENT-OFF* */
     6.6  
     6.7 +#ifndef SDL_WAYLAND_MODULE
     6.8 +#define SDL_WAYLAND_MODULE(modname)
     6.9 +#endif
    6.10 +
    6.11 +#ifndef SDL_WAYLAND_SYM
    6.12 +#define SDL_WAYLAND_SYM(rc,fn,params)
    6.13 +#endif
    6.14 +
    6.15 +#ifndef SDL_WAYLAND_INTERFACE
    6.16 +#define SDL_WAYLAND_INTERFACE(iface)
    6.17 +#endif
    6.18 +
    6.19  SDL_WAYLAND_MODULE(WAYLAND_CLIENT)
    6.20  SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...))
    6.21  SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *))
    6.22 @@ -99,8 +111,10 @@
    6.23                        xkb_layout_index_t latched_layout,\
    6.24                        xkb_layout_index_t locked_layout) )
    6.25  
    6.26 +#undef SDL_WAYLAND_MODULE
    6.27 +#undef SDL_WAYLAND_SYM
    6.28 +#undef SDL_WAYLAND_INTERFACE
    6.29  
    6.30  /* *INDENT-ON* */
    6.31  
    6.32  /* vi: set ts=4 sw=4 expandtab: */
    6.33 -//SDL_WAYLAND_SYM(ret, fn, params)
     7.1 --- a/src/video/x11/SDL_x11dyn.c	Wed Feb 17 14:15:37 2016 -0800
     7.2 +++ b/src/video/x11/SDL_x11dyn.c	Thu Feb 18 23:27:58 2016 -0500
     7.3 @@ -106,11 +106,8 @@
     7.4  #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */
     7.5  
     7.6  /* Define all the function pointers and wrappers... */
     7.7 -#define SDL_X11_MODULE(modname)
     7.8  #define SDL_X11_SYM(rc,fn,params,args,ret) SDL_DYNX11FN_##fn X11_##fn = NULL;
     7.9  #include "SDL_x11sym.h"
    7.10 -#undef SDL_X11_MODULE
    7.11 -#undef SDL_X11_SYM
    7.12  
    7.13  /* Annoying varargs entry point... */
    7.14  #ifdef X_HAVE_UTF8_STRING
    7.15 @@ -120,10 +117,7 @@
    7.16  
    7.17  /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
    7.18  #define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 0;
    7.19 -#define SDL_X11_SYM(rc,fn,params,args,ret)
    7.20  #include "SDL_x11sym.h"
    7.21 -#undef SDL_X11_MODULE
    7.22 -#undef SDL_X11_SYM
    7.23  
    7.24  static int x11_load_refcount = 0;
    7.25  
    7.26 @@ -139,8 +133,6 @@
    7.27  #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0;
    7.28  #define SDL_X11_SYM(rc,fn,params,args,ret) X11_##fn = NULL;
    7.29  #include "SDL_x11sym.h"
    7.30 -#undef SDL_X11_MODULE
    7.31 -#undef SDL_X11_SYM
    7.32  
    7.33  #ifdef X_HAVE_UTF8_STRING
    7.34              X11_XCreateIC = NULL;
    7.35 @@ -177,16 +169,11 @@
    7.36          }
    7.37  
    7.38  #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */
    7.39 -#define SDL_X11_SYM(a,fn,x,y,z)
    7.40  #include "SDL_x11sym.h"
    7.41 -#undef SDL_X11_MODULE
    7.42 -#undef SDL_X11_SYM
    7.43  
    7.44  #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
    7.45  #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod);
    7.46  #include "SDL_x11sym.h"
    7.47 -#undef SDL_X11_MODULE
    7.48 -#undef SDL_X11_SYM
    7.49  
    7.50  #ifdef X_HAVE_UTF8_STRING
    7.51          X11_XCreateIC = (SDL_DYNX11FN_XCreateIC)
    7.52 @@ -209,8 +196,6 @@
    7.53  #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */
    7.54  #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn;
    7.55  #include "SDL_x11sym.h"
    7.56 -#undef SDL_X11_MODULE
    7.57 -#undef SDL_X11_SYM
    7.58  
    7.59  #ifdef X_HAVE_UTF8_STRING
    7.60          X11_XCreateIC = XCreateIC;
     8.1 --- a/src/video/x11/SDL_x11dyn.h	Wed Feb 17 14:15:37 2016 -0800
     8.2 +++ b/src/video/x11/SDL_x11dyn.h	Thu Feb 18 23:27:58 2016 -0500
     8.3 @@ -86,13 +86,10 @@
     8.4  void SDL_X11_UnloadSymbols(void);
     8.5  
     8.6  /* Declare all the function pointers and wrappers... */
     8.7 -#define SDL_X11_MODULE(modname)
     8.8  #define SDL_X11_SYM(rc,fn,params,args,ret) \
     8.9      typedef rc (*SDL_DYNX11FN_##fn) params; \
    8.10      extern SDL_DYNX11FN_##fn X11_##fn;
    8.11  #include "SDL_x11sym.h"
    8.12 -#undef SDL_X11_MODULE
    8.13 -#undef SDL_X11_SYM
    8.14  
    8.15  /* Annoying varargs entry point... */
    8.16  #ifdef X_HAVE_UTF8_STRING
    8.17 @@ -104,10 +101,7 @@
    8.18  
    8.19  /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
    8.20  #define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
    8.21 -#define SDL_X11_SYM(rc,fn,params,args,ret)
    8.22  #include "SDL_x11sym.h"
    8.23 -#undef SDL_X11_MODULE
    8.24 -#undef SDL_X11_SYM
    8.25  
    8.26  #ifdef __cplusplus
    8.27  }
     9.1 --- a/src/video/x11/SDL_x11sym.h	Wed Feb 17 14:15:37 2016 -0800
     9.2 +++ b/src/video/x11/SDL_x11sym.h	Thu Feb 18 23:27:58 2016 -0500
     9.3 @@ -21,6 +21,14 @@
     9.4  
     9.5  /* *INDENT-OFF* */
     9.6  
     9.7 +#ifndef SDL_X11_MODULE
     9.8 +#define SDL_X11_MODULE(modname)
     9.9 +#endif
    9.10 +
    9.11 +#ifndef SDL_X11_SYM
    9.12 +#define SDL_X11_SYM(rc,fn,params,args,ret)
    9.13 +#endif
    9.14 +
    9.15  SDL_X11_MODULE(BASEXLIB)
    9.16  SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
    9.17  SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return)
    9.18 @@ -311,6 +319,9 @@
    9.19  SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return)
    9.20  #endif
    9.21  
    9.22 +#undef SDL_X11_MODULE
    9.23 +#undef SDL_X11_SYM
    9.24 +
    9.25  /* *INDENT-ON* */
    9.26  
    9.27  /* vi: set ts=4 sw=4 expandtab: */