Skip to content

Commit

Permalink
Moved function pointer params to typedefs, etc, for latest wikiheaders.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 12, 2024
1 parent 477c718 commit b2b2369
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 97 deletions.
367 changes: 286 additions & 81 deletions build-scripts/wikiheaders.pl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/README-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Game Center

Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:

int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);

This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.

Expand Down
2 changes: 1 addition & 1 deletion include/SDL_hidapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id,
*
* \since This function is available since SDL 2.0.18.
*/
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive);

/**
* Write an Output report to a HID device.
Expand Down
5 changes: 3 additions & 2 deletions include/SDL_stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,9 @@ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);

extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
typedef int (SDLCALL *SDL_CompareCallback)(const void *, const void *);
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, SDL_CompareCallback compare);
extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, SDL_CompareCallback compare);

extern DECLSPEC int SDLCALL SDL_abs(int x);

Expand Down
4 changes: 3 additions & 1 deletion include/SDL_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
/* Platform specific functions for iOS */
#ifdef __IPHONEOS__

typedef void (SDLCALL *SDL_iOSAnimationCallback)(void*);

/**
* Use this function to set the animation callback on Apple iOS.
*
Expand Down Expand Up @@ -220,7 +222,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
*
* \sa SDL_iPhoneSetEventPump
*/
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);

#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)

Expand Down
4 changes: 3 additions & 1 deletion include/SDL_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
*/
extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);

typedef void (SDLCALL *SDL_TLSDestructorCallback)(void*);

/**
* Set the current thread's value associated with a thread local storage ID.
*
Expand All @@ -446,7 +448,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
* \sa SDL_TLSCreate
* \sa SDL_TLSGet
*/
extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, SDL_TLSDestructorCallback destructor);

/**
* Cleanup all TLS data for this thread.
Expand Down
8 changes: 4 additions & 4 deletions src/dynapi/SDL_dynapi_procs.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a),
#endif

#ifdef __IPHONEOS__
SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void (SDLCALL *c)(void *), void *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, SDL_iOSAnimationCallback c, void *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),)
#endif

Expand Down Expand Up @@ -411,7 +411,7 @@ SDL_DYNAPI_PROC(void*,SDL_realloc,(void *a, size_t b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),)
SDL_DYNAPI_PROC(char*,SDL_getenv,(const char *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_setenv,(const char *a, const char *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, int (SDLCALL *d)(const void *, const void *)),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, SDL_CompareCallback d),(a,b,c,d),)
SDL_DYNAPI_PROC(int,SDL_abs,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_isdigit,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_isspace,(int a),(a),return)
Expand Down Expand Up @@ -511,7 +511,7 @@ SDL_DYNAPI_PROC(void,SDL_WaitThread,(SDL_Thread *a, int *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),)
SDL_DYNAPI_PROC(SDL_TLSID,SDL_TLSCreate,(void),(),return)
SDL_DYNAPI_PROC(void*,SDL_TLSGet,(SDL_TLSID a),(a),return)
SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (SDLCALL *c)(void*)),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, SDL_TLSDestructorCallback c),(a,b,c),return)
SDL_DYNAPI_PROC(Uint32,SDL_GetTicks,(void),(),return)
SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return)
SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return)
Expand Down Expand Up @@ -939,7 +939,7 @@ SDL_DYNAPI_PROC(void,SDL_UnionFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL
SDL_DYNAPI_PROC(SDL_bool,SDL_EncloseFPoints,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRectAndLine,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_RenderGetWindow,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(void*,SDL_bsearch,(const void *a, const void *b, size_t c, size_t d, int (SDLCALL *e)(const void *, const void *)),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(void*,SDL_bsearch,(const void *a, const void *b, size_t c, size_t d, SDL_CompareCallback e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(const char*,SDL_GameControllerPathForIndex,(int a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GameControllerPath,(SDL_GameController *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_JoystickPathForIndex,(int a),(a),return)
Expand Down
7 changes: 3 additions & 4 deletions src/stdlib/SDL_qsort.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "SDL_stdinc.h"

#if defined(HAVE_QSORT)
void SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *))
void SDL_qsort(void *base, size_t nmemb, size_t size, SDL_CompareCallback compare)
{
if (!base) {
return;
Expand Down Expand Up @@ -522,8 +522,7 @@ fprintf(stderr, "after partitioning first=#%lu last=#%lu\n", (first-(char*)base)

/* ---------------------------------------------------------------------- */

extern void qsortG(void *base, size_t nmemb, size_t size,
int (*compare)(const void *, const void *)) {
extern void qsortG(void *base, size_t nmemb, size_t size, SDL_CompareCallback compare) {

if (nmemb<=1) return;
if (((size_t)base|size)&(WORD_BYTES-1))
Expand All @@ -536,7 +535,7 @@ extern void qsortG(void *base, size_t nmemb, size_t size,

#endif /* HAVE_QSORT */

void *SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *))
void *SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, SDL_CompareCallback compare)
{
#if defined(HAVE_BSEARCH)
return bsearch(key, base, nmemb, size, compare);
Expand Down
2 changes: 1 addition & 1 deletion src/thread/SDL_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void *SDL_TLSGet(SDL_TLSID id)
return storage->array[id - 1].data;
}

int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void *))
int SDL_TLSSet(SDL_TLSID id, const void *value, SDL_TLSDestructorCallback destructor)
{
SDL_TLSData *storage;

Expand Down
2 changes: 1 addition & 1 deletion src/video/uikit/SDL_uikitwindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window)
}
#endif /* !TARGET_OS_TV */

int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam)
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam)
{
if (!window || !window->driverdata) {
return SDL_SetError("Invalid window");
Expand Down

0 comments on commit b2b2369

Please sign in to comment.