zenilib: zenilib/jni/external/sdl/src/SDL_assert.c File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Macros | Functions | Variables
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_data * | SDL_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_mutex * | assertion_mutex = NULL
static void * | assertion_userdata = NULL
static SDL_assert_data * | triggered_assertions = NULL

## Macro Definition Documentation

#define ENDLINE "\n"

Referenced by SDL_PromptAssertion().

## Function Documentation

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

static

Definition at line 62 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 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

Definition at line 71 of file SDL_assert.c.

References SDL_assert_data::next, SDL_assert_data::trigger_count, and triggered_assertions.

Referenced by SDL_ReportAssertion().

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

static void SDL_GenerateAssertionReport | ( | void |  | ) |

static

Definition at line 83 of file SDL_assert.c.

References SDL_assert_data::always_ignore, assertion_handler, SDL_assert_data::condition, debug_print(), SDL_assert_data::filename, SDL_assert_data::function, SDL_assert_data::linenum, SDL_assert_data::next, NULL, SDL_PromptAssertion(), SDL_ResetAssertionReport(), SDL_assert_data::trigger_count, and triggered_assertions.

Referenced by SDL_AssertionsQuit().

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.

static SDL_assert_state SDL_PromptAssertion | ( | const SDL_assert_data * | data,
|  | void * | userdata
| ) |  |

static

Definition at line 127 of file SDL_assert.c.

References SDL_MessageBoxData::buttons, SDL_assert_data::condition, debug_print(), ENDLINE, SDL_assert_data::filename, SDL_MessageBoxData::flags, SDL_assert_data::function, SDL_assert_data::linenum, SDL_MessageBoxData::message, NULL, SDL_MessageBoxData::numbuttons, SDL_arraysize, SDL_ASSERTION_ABORT, SDL_ASSERTION_ALWAYS_IGNORE, SDL_ASSERTION_BREAK, SDL_ASSERTION_IGNORE, SDL_ASSERTION_RETRY, 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_WINDOW_FULLSCREEN, SDL_zero, SDL_MessageBoxData::title, SDL_assert_data::trigger_count, and SDL_MessageBoxData::window.

Referenced by SDL_GenerateAssertionReport(), and SDL_SetAssertionHandler().

SDL_assert_state SDL_ReportAssertion | ( | SDL_assert_data * | data,
|  | const char * | func,
|  | const char * | file,
|  | int | line
| ) |  |

Definition at line 259 of file SDL_assert.c.

References SDL_assert_data::always_ignore, assertion_handler, assertion_mutex, assertion_userdata, file, SDL_assert_data::filename, SDL_assert_data::function, SDL_assert_data::linenum, NULL, SDL_AbortAssertion(), SDL_AddAssertionToReport(), 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 SDL_assert_data::trigger_count.

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

  handler | Callback function, called when an assertion fails.
  userdata | A 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_AssertionHandler assertion_handler = SDL_PromptAssertion

static

Definition at line 53 of file SDL_assert.c.

Referenced by SDL_GenerateAssertionReport(), SDL_ReportAssertion(), and SDL_SetAssertionHandler().

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

Definition at line 50 of file SDL_assert.c.

Referenced by SDL_AddAssertionToReport(), SDL_GenerateAssertionReport(), and SDL_GetAssertionReport().