Added SDL_GetAssertionHandler() and SDL_GetDefaultAssertionHandler().
authorRyan C. Gordon <icculus@icculus.org>
Tue, 04 Feb 2014 11:38:40 -0500
changeset 816782ec2a95e664
parent 8166 d1be9ce49463
child 8168 76d51b45342e
Added SDL_GetAssertionHandler() and SDL_GetDefaultAssertionHandler().
include/SDL_assert.h
src/SDL_assert.c
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
     1.1 --- a/include/SDL_assert.h	Mon Feb 03 23:08:53 2014 -0500
     1.2 +++ b/include/SDL_assert.h	Tue Feb 04 11:38:40 2014 -0500
     1.3 @@ -203,6 +203,35 @@
     1.4                                              void *userdata);
     1.5  
     1.6  /**
     1.7 + *  \brief Get the default assertion handler.
     1.8 + *
     1.9 + *  This returns the function pointer that is called by default when an
    1.10 + *   assertion is triggered. This is an internal function provided by SDL,
    1.11 + *   that is used for assertions when SDL_SetAssertionHandler() hasn't been
    1.12 + *   used to provide a different function.
    1.13 + *
    1.14 + *  \return The default SDL_AssertionHandler that is called when an assert triggers.
    1.15 + */
    1.16 +extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
    1.17 +
    1.18 +/**
    1.19 + *  \brief Get the current assertion handler.
    1.20 + *
    1.21 + *  This returns the function pointer that is called when an assertion is
    1.22 + *   triggered. This is either the value last passed to
    1.23 + *   SDL_SetAssertionHandler(), or if no application-specified function is
    1.24 + *   set, is equivalent to calling SDL_GetDefaultAssertionHandler().
    1.25 + *
    1.26 + *   \param puserdata Pointer to a void*, which will store the "userdata"
    1.27 + *                    pointer that was passed to SDL_SetAssertionHandler().
    1.28 + *                    This value will always be NULL for the default handler.
    1.29 + *                    If you don't care about this data, it is safe to pass
    1.30 + *                    a NULL pointer to this function to ignore it.
    1.31 + *  \return The SDL_AssertionHandler that is called when an assert triggers.
    1.32 + */
    1.33 +extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
    1.34 +
    1.35 +/**
    1.36   *  \brief Get a list of all assertion failures.
    1.37   *
    1.38   *  Get all assertions triggered since last call to SDL_ResetAssertionReport(),
     2.1 --- a/src/SDL_assert.c	Mon Feb 03 23:08:53 2014 -0500
     2.2 +++ b/src/SDL_assert.c	Tue Feb 04 11:38:40 2014 -0500
     2.3 @@ -366,4 +366,17 @@
     2.4      triggered_assertions = NULL;
     2.5  }
     2.6  
     2.7 +SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void)
     2.8 +{
     2.9 +    return SDL_PromptAssertion;
    2.10 +}
    2.11 +
    2.12 +SDL_AssertionHandler SDL_GetAssertionHandler(void **userdata)
    2.13 +{
    2.14 +    if (userdata != NULL) {
    2.15 +        *userdata = assertion_userdata;
    2.16 +    }
    2.17 +    return assertion_handler;
    2.18 +}
    2.19 +
    2.20  /* vi: set ts=4 sw=4 expandtab: */
     3.1 --- a/src/dynapi/SDL_dynapi_overrides.h	Mon Feb 03 23:08:53 2014 -0500
     3.2 +++ b/src/dynapi/SDL_dynapi_overrides.h	Tue Feb 04 11:38:40 2014 -0500
     3.3 @@ -572,3 +572,5 @@
     3.4  #define SDL_GameControllerAddMappingsFromRW SDL_GameControllerAddMappingsFromRW_REAL
     3.5  #define SDL_GL_ResetAttributes SDL_GL_ResetAttributes_REAL
     3.6  #define SDL_HasAVX SDL_HasAVX_REAL
     3.7 +#define SDL_GetDefaultAssertionHandler SDL_GetDefaultAssertionHandler_REAL
     3.8 +#define SDL_GetAssertionHandler SDL_GetAssertionHandler_REAL
     4.1 --- a/src/dynapi/SDL_dynapi_procs.h	Mon Feb 03 23:08:53 2014 -0500
     4.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Tue Feb 04 11:38:40 2014 -0500
     4.3 @@ -601,3 +601,5 @@
     4.4  SDL_DYNAPI_PROC(int,SDL_GameControllerAddMappingsFromRW,(SDL_RWops *a, int b),(a,b),return)
     4.5  SDL_DYNAPI_PROC(void,SDL_GL_ResetAttributes,(void),(),)
     4.6  SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX,(void),(),return)
     4.7 +SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetDefaultAssertionHandler,(void),(),return)
     4.8 +SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return)