Go to the documentation of this file.
23 #if defined(__WIN32__)
36 #ifndef WS_OVERLAPPEDWINDOW
37 #define WS_OVERLAPPEDWINDOW 0
42 #if ! defined(__WINRT__)
47 #if defined(__EMSCRIPTEN__)
48 #include <emscripten.h>
61 #ifndef SDL_THREADS_DISABLED
87 data->trigger_count++;
88 if (
data->trigger_count == 1) {
102 debug_print(
"All SDL assertions between last init/quit:\n\n");
104 while (item !=
NULL) {
108 " * triggered %u time%s.\n"
109 " * always ignore: %s.\n",
110 item->condition, item->function, item->filename,
111 item->linenum, item->trigger_count,
112 (item->trigger_count == 1) ?
"" :
"s",
113 item->always_ignore ?
"yes" :
"no");
123 #if defined(__WATCOMC__)
124 #pragma aux SDL_ExitProcess aborts;
132 TerminateProcess(GetCurrentProcess(), exitcode);
134 #elif defined(__EMSCRIPTEN__)
135 emscripten_cancel_main_loop();
136 emscripten_force_exit(exitcode);
144 #if defined(__WATCOMC__)
145 #pragma aux SDL_AbortAssertion aborts;
158 #define ENDLINE "\r\n"
187 "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE
190 data->trigger_count, (
data->trigger_count == 1) ?
"time" :
"times",
208 }
else if (
SDL_strcmp(envr,
"always_ignore") == 0) {
231 messagebox.
title =
"Assertion Failed";
237 if (selected == -1) {
246 #if defined(__EMSCRIPTEN__)
250 char *
buf = (
char *) EM_ASM_INT({
252 Pointer_stringify($0) +
'\n\n' +
253 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :';
254 var reply =
window.prompt(str,
"i");
255 if (reply ===
null) {
258 return allocate(intArrayFromString(reply),
'i8', ALLOC_NORMAL);
281 #elif defined(HAVE_STDIO_H)
285 fprintf(stderr,
"Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : ");
287 if (fgets(
buf,
sizeof (
buf), stdin) ==
NULL) {
327 static int assertion_running = 0;
329 #ifndef SDL_THREADS_DISABLED
347 if (
data->trigger_count == 0) {
349 data->filename = file;
350 data->linenum = line;
356 if (assertion_running > 1) {
357 if (assertion_running == 2) {
359 }
else if (assertion_running == 3) {
366 if (!
data->always_ignore) {
378 data->always_ignore = 1;
389 #ifndef SDL_THREADS_DISABLED
400 #ifndef SDL_THREADS_DISABLED
410 if (handler !=
NULL) {
431 item->trigger_count = 0;
445 if (userdata !=
NULL) {
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
@ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
static void debug_print(const char *fmt,...)
static void * assertion_userdata
GLuint GLsizei const GLchar * message
void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)
Set an application-defined assertion handler.
const SDL_assert_data * SDL_GetAssertionReport(void)
Get a list of all assertion failures.
static SDL_mutex * assertion_mutex
#define SDL_GetWindowFlags
@ SDL_LOG_CATEGORY_ASSERT
SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, int line)
static void SDL_AddAssertionToReport(SDL_assert_data *data)
static void SDL_GenerateAssertionReport(void)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
The type used to identify a window.
#define SDL_stack_alloc(type, count)
void SDL_ResetAssertionReport(void)
Reset the list of all assertion failures.
SDL_Window * SDL_GetFocusWindow(void)
#define SDL_MinimizeWindow
static SDL_assert_state SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
GLenum GLuint GLenum GLsizei const GLchar * buf
static void SDL_AbortAssertion(void)
EGLSurface EGLNativeWindowType * window
SDL_AssertState(* SDL_AssertionHandler)(const SDL_AssertData *data, void *userdata)
MessageBox structure containing title, text, window, etc.
void SDL_AssertionsQuit(void)
static void SDL_ExitProcess(int exitcode)
#define SDL_RestoreWindow
@ SDL_ASSERTION_ALWAYS_IGNORE
SDL_AssertionHandler SDL_GetAssertionHandler(void **userdata)
Get the current assertion handler.
#define SDL_arraysize(array)
const SDL_MessageBoxButtonData * buttons
@ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT
#define SDL_stack_free(data)
#define SDL_ShowMessageBox
SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void)
Get the default assertion handler.
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
#define SDL_MAX_LOG_MESSAGE
The maximum size of a log message.
static SDL_AssertionHandler assertion_handler
static SDL_assert_data * triggered_assertions