zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_assert.c File Reference
#include "SDL_config.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"
 

Functions

static void debug_print (const char *fmt,...)
 
static void SDL_AbortAssertion (void)
 
static void SDL_AddAssertionToReport (SDL_assert_data *data)
 
void SDL_AssertionsQuit (void)
 
static void SDL_ExitProcess (int exitcode)
 
static void SDL_GenerateAssertionReport (void)
 
const SDL_assert_dataSDL_GetAssertionReport (void)
 Get a list of all assertion failures. More...
 
static SDL_assert_state SDL_PromptAssertion (const SDL_assert_data *data, void *userdata)
 
SDL_assert_state SDL_ReportAssertion (SDL_assert_data *data, const char *func, const char *file, int line)
 
void SDL_ResetAssertionReport (void)
 Reset the list of all assertion failures. More...
 
void SDL_SetAssertionHandler (SDL_AssertionHandler handler, void *userdata)
 Set an application-defined assertion handler. More...
 

Variables

static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion
 
static SDL_mutexassertion_mutex = NULL
 
static voidassertion_userdata = NULL
 
static SDL_assert_datatriggered_assertions = NULL
 

Macro Definition Documentation

#define ENDLINE   "\n"

Referenced by SDL_PromptAssertion().

Function Documentation

static void debug_print ( const char *  fmt,
  ... 
)
static
static void SDL_AbortAssertion ( void  )
static

Definition at line 119 of file SDL_assert.c.

References SDL_ExitProcess(), and SDL_Quit().

Referenced by SDL_ReportAssertion().

static void SDL_AddAssertionToReport ( SDL_assert_data data)
static
void SDL_AssertionsQuit ( void  )

Definition at line 328 of file SDL_assert.c.

References assertion_mutex, NULL, SDL_DestroyMutex(), and SDL_GenerateAssertionReport().

Referenced by SDL_Quit().

static void SDL_ExitProcess ( int  exitcode)
static

Definition at line 110 of file SDL_assert.c.

Referenced by SDL_AbortAssertion(), and SDL_ReportAssertion().

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_assert_data *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; }

Returns
List of all assertions.
See Also
SDL_ResetAssertionReport

Definition at line 348 of file SDL_assert.c.

References triggered_assertions.

void SDL_ResetAssertionReport ( void  )

Reset the list of all assertion failures.

Reset list of all assertions triggered.

See Also
SDL_GetAssertionReport

Definition at line 353 of file SDL_assert.c.

References SDL_assert_data::always_ignore, SDL_assert_data::next, NULL, SDL_FALSE, and SDL_assert_data::trigger_count.

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()!

Returns
SDL_assert_state value of how to handle the assertion failure.
Parameters
handlerCallback function, called when an assertion fails.
userdataA pointer passed to the callback as-is.

Definition at line 337 of file SDL_assert.c.

References assertion_handler, assertion_userdata, NULL, and SDL_PromptAssertion().

Variable Documentation

SDL_mutex* assertion_mutex = NULL
static

Definition at line 52 of file SDL_assert.c.

Referenced by SDL_AssertionsQuit(), and SDL_ReportAssertion().

void* assertion_userdata = NULL
static

Definition at line 54 of file SDL_assert.c.

Referenced by SDL_ReportAssertion(), and SDL_SetAssertionHandler().

SDL_assert_data* triggered_assertions = NULL
static