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");
126 ExitProcess(exitcode);
127 #elif defined(__EMSCRIPTEN__) 128 emscripten_cancel_main_loop();
129 emscripten_force_exit(exitcode);
148 #define ENDLINE "\r\n" 177 "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE 179 data->function, data->filename, data->linenum,
180 data->trigger_count, (data->trigger_count == 1) ?
"time" :
"times",
198 }
else if (
SDL_strcmp(envr,
"always_ignore") == 0) {
221 messagebox.
title =
"Assertion Failed";
227 if (selected == -1) {
236 #if defined(__EMSCRIPTEN__) 240 char *
buf = (
char *) EM_ASM_INT({
242 Pointer_stringify($0) +
'\n\n' +
243 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :';
244 var reply = window.prompt(str,
"i");
245 if (reply === null) {
248 return allocate(intArrayFromString(reply),
'i8', ALLOC_NORMAL);
271 #elif defined(HAVE_STDIO_H) 275 fprintf(stderr,
"Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : ");
277 if (fgets(buf,
sizeof (buf), stdin) ==
NULL) {
317 static int assertion_running = 0;
319 #ifndef SDL_THREADS_DISABLED 322 if (assertion_mutex ==
NULL) {
324 if (assertion_mutex ==
NULL) {
337 if (data->trigger_count == 0) {
338 data->function =
func;
339 data->filename = file;
340 data->linenum = line;
346 if (assertion_running > 1) {
347 if (assertion_running == 2) {
349 }
else if (assertion_running == 3) {
356 if (!data->always_ignore) {
368 data->always_ignore = 1;
379 #ifndef SDL_THREADS_DISABLED 390 #ifndef SDL_THREADS_DISABLED 391 if (assertion_mutex !=
NULL) {
393 assertion_mutex =
NULL;
400 if (handler !=
NULL) {
421 item->trigger_count = 0;
435 if (userdata !=
NULL) {
static SDL_AssertionHandler assertion_handler
SDL_AssertState(* SDL_AssertionHandler)(const SDL_AssertData *data, void *userdata)
#define SDL_MAX_LOG_MESSAGE
The maximum size of a log message.
static void SDL_GenerateAssertionReport(void)
static SDL_assert_data * triggered_assertions
GLuint GLsizei const GLchar * message
void SDL_ResetAssertionReport(void)
Reset the list of all assertion failures.
#define SDL_GetWindowFlags
static void * assertion_userdata
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define SDL_MinimizeWindow
static SDL_assert_state SDL_PromptAssertion(const SDL_assert_data *data, void *userdata)
const SDL_assert_data * SDL_GetAssertionReport(void)
Get a list of all assertion failures.
static void debug_print(const char *fmt,...)
void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)
Set an application-defined assertion handler.
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
void SDL_AssertionsQuit(void)
#define SDL_stack_alloc(type, count)
SDL_Window * SDL_GetFocusWindow(void)
SDL_AssertionHandler SDL_GetAssertionHandler(void **userdata)
Get the current assertion handler.
GLenum GLuint GLenum GLsizei const GLchar * buf
const SDL_MessageBoxButtonData * buttons
MessageBox structure containing title, text, window, etc.
#define SDL_RestoreWindow
static void SDL_AddAssertionToReport(SDL_assert_data *data)
static SDL_NORETURN void SDL_AbortAssertion(void)
#define SDL_ShowMessageBox
static SDL_NORETURN void SDL_ExitProcess(int exitcode)
EGLSurface EGLNativeWindowType * window
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
The type used to identify a window.
static SDL_mutex * assertion_mutex
SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void)
Get the default assertion handler.
#define SDL_arraysize(array)
#define SDL_stack_free(data)
SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, int line)