Renamed SDL_LogGetOutputFunction() and SDL_LogSetOutputFunction() to match SDL 3.0 naming convention

main
Sam Lantinga 2024-03-17 09:50:28 -07:00
parent d8a54cd4f8
commit d65ae710a1
10 changed files with 41 additions and 17 deletions

View File

@ -3113,3 +3113,13 @@ typedef SDL_RWops, SDL_IOStream;
@@
- SDL_RWops
+ SDL_IOStream
@@
@@
- SDL_LogGetOutputFunction
+ SDL_GetLogOutputFunction
(...)
@@
@@
- SDL_LogSetOutputFunction
+ SDL_SetLogOutputFunction
(...)

View File

@ -888,6 +888,12 @@ The following symbols have been renamed:
SDL_LoadFunction() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to the appropriate function type. You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior.
## SDL_log.h
The following functions have been renamed:
* SDL_LogGetOutputFunction() => SDL_GetLogOutputFunction()
* SDL_LogSetOutputFunction() => SDL_SetLogOutputFunction()
## SDL_main.h
SDL3 doesn't have a static libSDLmain to link against anymore.

View File

@ -454,7 +454,7 @@ extern "C" {
* "1" - Log most events (other than the really spammy ones).
* "2" - Include mouse and finger motion events.
*
* This is generally meant to be used to debug SDL itself, but can be useful for application developers that need better visibility into what is going on in the event queue. Logged events are sent through SDL_Log(), which means by default they appear on stdout on most platforms or maybe OutputDebugString() on Windows, and can be funneled by the app with SDL_LogSetOutputFunction(), etc.
* This is generally meant to be used to debug SDL itself, but can be useful for application developers that need better visibility into what is going on in the event queue. Logged events are sent through SDL_Log(), which means by default they appear on stdout on most platforms or maybe OutputDebugString() on Windows, and can be funneled by the app with SDL_SetLogOutputFunction(), etc.
*
* This hint can be set anytime.
*/

View File

@ -360,7 +360,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
*
* This function is called by SDL when there is new text to be logged.
*
* \param userdata what was passed as `userdata` to SDL_LogSetOutputFunction()
* \param userdata what was passed as `userdata` to SDL_SetLogOutputFunction()
* \param category the category of the message
* \param priority the priority of the message
* \param message the message being output
@ -377,9 +377,9 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_LogSetOutputFunction
* \sa SDL_SetLogOutputFunction
*/
extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
extern DECLSPEC void SDLCALL SDL_GetLogOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
/**
* Replace the default log output function with one of your own.
@ -389,9 +389,9 @@ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *cal
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_LogGetOutputFunction
* \sa SDL_GetLogOutputFunction
*/
extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
extern DECLSPEC void SDLCALL SDL_SetLogOutputFunction(SDL_LogOutputFunction callback, void *userdata);
/* Ends C function definitions when using C++ */

View File

@ -361,6 +361,10 @@
#define KMOD_SCROLL SDL_KMOD_SCROLL
#define KMOD_SHIFT SDL_KMOD_SHIFT
/* ##SDL_log.h */
#define SDL_LogGetOutputFunction SDL_GetLogOutputFunction
#define SDL_LogSetOutputFunction SDL_SetLogOutputFunction
/* ##SDL_mouse.h */
#define SDL_FreeCursor SDL_DestroyCursor
@ -858,6 +862,10 @@
#define KMOD_SCROLL KMOD_SCROLL_renamed_SDL_KMOD_SCROLL
#define KMOD_SHIFT KMOD_SHIFT_renamed_SDL_KMOD_SHIFT
/* ##SDL_log.h */
#define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_renamed_SDL_GetLogOutputFunction
#define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_renamed_SDL_SetLogOutputFunction
/* ##SDL_mouse.h */
#define SDL_FreeCursor SDL_FreeCursor_renamed_SDL_DestroyCursor

View File

@ -594,7 +594,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority
#endif
}
void SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata)
void SDL_GetLogOutputFunction(SDL_LogOutputFunction *callback, void **userdata)
{
if (callback) {
*callback = SDL_log_function;
@ -604,7 +604,7 @@ void SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata)
}
}
void SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata)
void SDL_SetLogOutputFunction(SDL_LogOutputFunction callback, void *userdata)
{
SDL_log_function = callback;
SDL_log_userdata = userdata;

View File

@ -423,14 +423,14 @@ SDL3_0.0.0 {
SDL_LogCritical;
SDL_LogDebug;
SDL_LogError;
SDL_LogGetOutputFunction;
SDL_GetLogOutputFunction;
SDL_LogGetPriority;
SDL_LogInfo;
SDL_LogMessage;
SDL_LogMessageV;
SDL_LogResetPriorities;
SDL_LogSetAllPriority;
SDL_LogSetOutputFunction;
SDL_SetLogOutputFunction;
SDL_LogSetPriority;
SDL_LogVerbose;
SDL_LogWarn;

View File

@ -447,14 +447,14 @@
#define SDL_LogCritical SDL_LogCritical_REAL
#define SDL_LogDebug SDL_LogDebug_REAL
#define SDL_LogError SDL_LogError_REAL
#define SDL_LogGetOutputFunction SDL_LogGetOutputFunction_REAL
#define SDL_GetLogOutputFunction SDL_GetLogOutputFunction_REAL
#define SDL_LogGetPriority SDL_LogGetPriority_REAL
#define SDL_LogInfo SDL_LogInfo_REAL
#define SDL_LogMessage SDL_LogMessage_REAL
#define SDL_LogMessageV SDL_LogMessageV_REAL
#define SDL_LogResetPriorities SDL_LogResetPriorities_REAL
#define SDL_LogSetAllPriority SDL_LogSetAllPriority_REAL
#define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_REAL
#define SDL_SetLogOutputFunction SDL_SetLogOutputFunction_REAL
#define SDL_LogSetPriority SDL_LogSetPriority_REAL
#define SDL_LogVerbose SDL_LogVerbose_REAL
#define SDL_LogWarn SDL_LogWarn_REAL

View File

@ -497,12 +497,12 @@ SDL_DYNAPI_PROC(void,SDL_LockRWLockForWriting,(SDL_RWLock *a),(a),)
SDL_DYNAPI_PROC(int,SDL_LockSurface,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_LogGetOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),)
SDL_DYNAPI_PROC(SDL_LogPriority,SDL_LogGetPriority,(int a),(a),return)
SDL_DYNAPI_PROC(void,SDL_LogMessageV,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, va_list d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_LogResetPriorities,(void),(),)
SDL_DYNAPI_PROC(void,SDL_LogSetAllPriority,(SDL_LogPriority a),(a),)
SDL_DYNAPI_PROC(void,SDL_LogSetOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_SetLogOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_LogSetPriority,(int a, SDL_LogPriority b),(a,b),)
SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)

View File

@ -17,13 +17,13 @@ static void SDLCALL TestLogOutput(void *userdata, int category, SDL_LogPriority
static void EnableTestLog(int *message_count)
{
*message_count = 0;
SDL_LogGetOutputFunction(&original_function, &original_userdata);
SDL_LogSetOutputFunction(TestLogOutput, message_count);
SDL_GetLogOutputFunction(&original_function, &original_userdata);
SDL_SetLogOutputFunction(TestLogOutput, message_count);
}
static void DisableTestLog()
{
SDL_LogSetOutputFunction(original_function, original_userdata);
SDL_SetLogOutputFunction(original_function, original_userdata);
}
/* Fixture */