]> granicus.if.org Git - nethack/commitdiff
more sensible arg order for callback
authorAdam Powers <apowers@ato.ms>
Sat, 29 Aug 2020 18:10:09 +0000 (11:10 -0700)
committerAdam Powers <apowers@ato.ms>
Sat, 29 Aug 2020 18:10:09 +0000 (11:10 -0700)
win/shim/winshim.c

index 2334e9dec3fcc8195dc24f56bab773d3d9574c76..9fed47d9c4eba71acad546fba73e9126d3ad9352 100644 (file)
 #define SHIM_DEBUG
 
 #ifndef __EMSCRIPTEN__
-typedef void(*stub_callback_t)(const char *name, const char *fmt, void *ret_ptr, ...);
+typedef void(*stub_callback_t)(const char *name, void *ret_ptr, const char *fmt, ...);
 #else /* __EMSCRIPTEN__ */
 /* WASM can't handle a variadic callback, so we pass back an array of pointers instead... */
-typedef void(*stub_callback_t)(const char *name, const char *fmt, void *ret_ptr, void *args[]);
+typedef void(*stub_callback_t)(const char *name, void *ret_ptr, const char *fmt, void *args[]);
 #endif /* !__EMSCRIPTEN__ */
 
 /* this is the primary interface to shim graphics,
@@ -45,7 +45,7 @@ ret_type name fn_args { \
     ret_type ret; \
     debugf("SHIM GRAPHICS: " #name "\n"); \
     if (!shim_graphics_callback) return; \
-    shim_graphics_callback(#name, fmt, (void *)&ret, args); \
+    shim_graphics_callback(#name, (void *)&ret, fmt, args); \
     return ret; \
 }
 
@@ -54,7 +54,7 @@ void name fn_args { \
     void *args[] = { __VA_ARGS__ }; \
     debugf("SHIM GRAPHICS: " #name "\n"); \
     if (!shim_graphics_callback) return; \
-    shim_graphics_callback(#name, fmt, NULL, args); \
+    shim_graphics_callback(#name, NULL, fmt, args); \
 }
 #else /* !__EMSCRIPTEN__ */
 #define A2P
@@ -64,14 +64,14 @@ ret_type name args { \
     ret_type ret; \
     debugf("SHIM GRAPHICS: " #name "\n"); \
     if (!shim_graphics_callback) return; \
-    shim_graphics_callback(#name, fmt, (void *)&ret, __VA_ARGS__); \
+    shim_graphics_callback(#name, (void *)&ret, fmt, __VA_ARGS__); \
     return ret; \
 }
 
 void name args { \
     debugf("SHIM GRAPHICS: " #name "\n"); \
     if (!shim_graphics_callback) return; \
-    shim_graphics_callback(#name, fmt, NULL, __VA_ARGS__); \
+    shim_graphics_callback(#name, NULL, fmt, __VA_ARGS__); \
 }
 #endif /* __EMSCRIPTEN__ */