SDL
2.0
|
#include "./SDL_internal.h"
#include "SDL.h"
#include "SDL_atomic.h"
#include "SDL_messagebox.h"
#include "SDL_video.h"
#include "SDL_assert.h"
#include "SDL_assert_c.h"
#include "video/SDL_sysvideo.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Go to the source code of this file.
Macros | |
#define | ENDLINE "\n" |
Variables | |
static SDL_assert_data * | triggered_assertions = NULL |
static SDL_mutex * | assertion_mutex = NULL |
static SDL_AssertionHandler | assertion_handler = SDL_PromptAssertion |
static void * | assertion_userdata = NULL |
#define ENDLINE "\n" |
Referenced by SDL_PromptAssertion().
|
static |
Definition at line 74 of file SDL_assert.c.
References SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_WARN, and SDL_LogMessageV.
Referenced by SDL_GenerateAssertionReport(), and SDL_PromptAssertion().
|
static |
Definition at line 137 of file SDL_assert.c.
References SDL_assert_state, SDL_ExitProcess(), SDL_Quit, and SDLCALL.
Referenced by SDL_ReportAssertion().
|
static |
Definition at line 83 of file SDL_assert.c.
References triggered_assertions.
Referenced by SDL_ReportAssertion().
Definition at line 387 of file SDL_assert.c.
References NULL, SDL_DestroyMutex, and SDL_GenerateAssertionReport().
Referenced by SDL_Quit().
|
static |
Definition at line 123 of file SDL_assert.c.
Referenced by SDL_AbortAssertion(), and SDL_ReportAssertion().
Definition at line 95 of file SDL_assert.c.
References assertion_handler, debug_print(), NULL, SDL_assert_data, SDL_PromptAssertion(), SDL_ResetAssertionReport(), and triggered_assertions.
Referenced by SDL_AssertionsQuit().
SDL_AssertionHandler SDL_GetAssertionHandler | ( | void ** | puserdata | ) |
Get the current assertion handler.
This returns the function pointer that is called when an assertion is triggered. This is either the value last passed to SDL_SetAssertionHandler(), or if no application-specified function is set, is equivalent to calling SDL_GetDefaultAssertionHandler().
puserdata | Pointer to a void*, which will store the "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value will always be NULL for the default handler. If you don't care about this data, it is safe to pass a NULL pointer to this function to ignore it. |
Definition at line 433 of file SDL_assert.c.
References assertion_handler, assertion_userdata, and NULL.
const SDL_assert_data* SDL_GetAssertionReport | ( | void | ) |
Get a list of all assertion failures.
Get all assertions triggered since last call to SDL_ResetAssertionReport(), or the start of the program.
The proper way to examine this data looks something like this:
const SDL_AssertData *item = SDL_GetAssertionReport(); while (item) { printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", item->condition, item->function, item->filename, item->linenum, item->trigger_count, item->always_ignore ? "yes" : "no"); item = item->next; }
Definition at line 409 of file SDL_assert.c.
References triggered_assertions.
SDL_AssertionHandler SDL_GetDefaultAssertionHandler | ( | void | ) |
Get the default assertion handler.
This returns the function pointer that is called by default when an assertion is triggered. This is an internal function provided by SDL, that is used for assertions when SDL_SetAssertionHandler() hasn't been used to provide a different function.
Definition at line 428 of file SDL_assert.c.
References SDL_PromptAssertion().
|
static |
Definition at line 145 of file SDL_assert.c.
References SDL_MessageBoxData::buttons, debug_print(), ENDLINE, SDL_MessageBoxData::flags, free, SDL_MessageBoxData::message, NULL, SDL_MessageBoxData::numbuttons, SDL_arraysize, SDL_assert_state, SDL_ASSERTION_ABORT, SDL_ASSERTION_ALWAYS_IGNORE, SDL_ASSERTION_BREAK, SDL_ASSERTION_IGNORE, SDL_ASSERTION_RETRY, SDL_FALSE, SDL_getenv, SDL_GetFocusWindow(), SDL_GetWindowFlags, SDL_MAX_LOG_MESSAGE, SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, SDL_MESSAGEBOX_WARNING, SDL_MinimizeWindow, SDL_RestoreWindow, SDL_ShowMessageBox, SDL_snprintf, SDL_stack_alloc, SDL_stack_free, SDL_strcmp, SDL_strncmp, SDL_TRUE, SDL_WINDOW_FULLSCREEN, SDL_zero, state, SDL_MessageBoxData::title, void, and SDL_MessageBoxData::window.
Referenced by SDL_GenerateAssertionReport(), SDL_GetDefaultAssertionHandler(), and SDL_SetAssertionHandler().
SDL_assert_state SDL_ReportAssertion | ( | SDL_assert_data * | data, |
const char * | func, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 313 of file SDL_assert.c.
References assertion_handler, assertion_userdata, NULL, SDL_AbortAssertion(), SDL_AddAssertionToReport(), SDL_assert_state, SDL_ASSERTION_ABORT, SDL_ASSERTION_ALWAYS_IGNORE, SDL_ASSERTION_BREAK, SDL_ASSERTION_IGNORE, SDL_ASSERTION_RETRY, SDL_AtomicLock, SDL_AtomicUnlock, SDL_CreateMutex, SDL_ExitProcess(), SDL_LockMutex, SDL_UnlockMutex, and state.
Reset the list of all assertion failures.
Reset list of all assertions triggered.
Definition at line 414 of file SDL_assert.c.
References NULL, SDL_assert_data, SDL_FALSE, and triggered_assertions.
Referenced by SDL_GenerateAssertionReport().
void SDL_SetAssertionHandler | ( | SDL_AssertionHandler | handler, |
void * | userdata | ||
) |
Set an application-defined assertion handler.
This allows an app to show its own assertion UI and/or force the response to an assertion failure. If the app doesn't provide this, SDL will try to do the right thing, popping up a system-specific GUI dialog, and probably minimizing any fullscreen windows.
This callback may fire from any thread, but it runs wrapped in a mutex, so it will only fire from one thread at a time.
Setting the callback to NULL restores SDL's original internal handler.
This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
Return SDL_AssertState value of how to handle the assertion failure.
handler | Callback function, called when an assertion fails. |
userdata | A pointer passed to the callback as-is. |
Definition at line 398 of file SDL_assert.c.
References assertion_handler, assertion_userdata, NULL, and SDL_PromptAssertion().
|
static |
Definition at line 65 of file SDL_assert.c.
Referenced by SDL_GenerateAssertionReport(), SDL_GetAssertionHandler(), SDL_ReportAssertion(), and SDL_SetAssertionHandler().
Definition at line 62 of file SDL_assert.c.
Definition at line 66 of file SDL_assert.c.
Referenced by SDL_GetAssertionHandler(), SDL_ReportAssertion(), and SDL_SetAssertionHandler().
|
static |
Definition at line 59 of file SDL_assert.c.
Referenced by SDL_AddAssertionToReport(), SDL_GenerateAssertionReport(), SDL_GetAssertionReport(), and SDL_ResetAssertionReport().