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
189 data->function, data->filename, data->linenum,
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
332 if (assertion_mutex ==
NULL) {
334 if (assertion_mutex ==
NULL) {
347 if (data->trigger_count == 0) {
348 data->function =
func;
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
401 if (assertion_mutex !=
NULL) {
403 assertion_mutex =
NULL;
410 if (handler !=
NULL) {
431 item->trigger_count = 0;
445 if (userdata !=
NULL) {