Mercurial > sdl-ios-xcode
annotate src/SDL_assert.c @ 5091:79bd1e289005
Fixed bug #1102
Check /usr/local/bin for hg before sourcing the user's bash settings
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 24 Jan 2011 17:47:18 -0800 |
parents | c2539ff054c8 |
children | 327f181542f1 |
rev | line source |
---|---|
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 |
3651 | 23 #include "SDL.h" |
5006
8e8876e4aec6
Include windows.h in SDL_atomic.h by default, but don't include the atomic API in SDL.h
Sam Lantinga <slouken@libsdl.org>
parents:
4472
diff
changeset
|
24 #include "SDL_atomic.h" |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #include "SDL_assert.h" |
4472
791b3256fb22
Mostly cleaned up warnings with -Wmissing-prototypes
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
26 #include "SDL_assert_c.h" |
3671
0d6f520c0eb9
Fixed building under Visual Studio
Sam Lantinga <slouken@libsdl.org>
parents:
3670
diff
changeset
|
27 #include "video/SDL_sysvideo.h" |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
29 #ifdef __WIN32__ |
5007
adf6f0c8ec35
Fixed compiler warning about symbol redefinition
Sam Lantinga <slouken@libsdl.org>
parents:
5006
diff
changeset
|
30 #define WIN32_LEAN_AND_MEAN |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 #include <windows.h> |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
32 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
33 #ifndef WS_OVERLAPPEDWINDOW |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
34 #define WS_OVERLAPPEDWINDOW 0 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
35 #endif |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
36 |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
37 #ifdef UNICODE |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
38 #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
39 #else |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
40 #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1) |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
41 #endif |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 #else /* fprintf, _exit(), etc. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 #include <stdio.h> |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 #include <stdlib.h> |
3648
a9d830c05998
Fixed build problems with gcc __attribute__.
Ryan C. Gordon <icculus@icculus.org>
parents:
3647
diff
changeset
|
45 #include <unistd.h> |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 #endif |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
48 static SDL_assert_state |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
49 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
50 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
51 /* |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
52 * We keep all triggered assertions in a singly-linked list so we can |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 * generate a report later. |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 static SDL_assert_data assertion_list_terminator = { 0, 0, 0, 0, 0, 0, 0 }; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 static SDL_assert_data *triggered_assertions = &assertion_list_terminator; |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
57 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
58 static SDL_mutex *assertion_mutex = NULL; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
59 static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
60 static void *assertion_userdata = NULL; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
3648
a9d830c05998
Fixed build problems with gcc __attribute__.
Ryan C. Gordon <icculus@icculus.org>
parents:
3647
diff
changeset
|
62 #ifdef __GNUC__ |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
63 static void |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
64 debug_print(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
3648
a9d830c05998
Fixed build problems with gcc __attribute__.
Ryan C. Gordon <icculus@icculus.org>
parents:
3647
diff
changeset
|
65 #endif |
a9d830c05998
Fixed build problems with gcc __attribute__.
Ryan C. Gordon <icculus@icculus.org>
parents:
3647
diff
changeset
|
66 |
a9d830c05998
Fixed build problems with gcc __attribute__.
Ryan C. Gordon <icculus@icculus.org>
parents:
3647
diff
changeset
|
67 static void |
a9d830c05998
Fixed build problems with gcc __attribute__.
Ryan C. Gordon <icculus@icculus.org>
parents:
3647
diff
changeset
|
68 debug_print(const char *fmt, ...) |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
70 #ifdef __WIN32__ |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 /* Format into a buffer for OutputDebugStringA(). */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 char buf[1024]; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 char *startptr; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 char *ptr; |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
75 LPTSTR tstr; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 int len; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 va_list ap; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 va_start(ap, fmt); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 len = (int) SDL_vsnprintf(buf, sizeof (buf), fmt, ap); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 va_end(ap); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 /* Visual C's vsnprintf() may not null-terminate the buffer. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 if ((len >= sizeof (buf)) || (len < 0)) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 buf[sizeof (buf) - 1] = '\0'; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 /* Write it, sorting out the Unix newlines... */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 startptr = buf; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 for (ptr = startptr; *ptr; ptr++) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 if (*ptr == '\n') { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 *ptr = '\0'; |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
92 tstr = WIN_UTF8ToString(startptr); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
93 OutputDebugString(tstr); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
94 SDL_free(tstr); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
95 OutputDebugString(TEXT("\r\n")); |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 startptr = ptr+1; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 /* catch that last piece if it didn't have a newline... */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 if (startptr != ptr) { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
102 tstr = WIN_UTF8ToString(startptr); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
103 OutputDebugString(tstr); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
104 SDL_free(tstr); |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 #else |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 /* Unix has it easy. Just dump it to stderr. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 va_list ap; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 va_start(ap, fmt); |
3669
46d27a9571fa
Whoops, that should be vfprintf(), not fprintf(). :)
Ryan C. Gordon <icculus@icculus.org>
parents:
3664
diff
changeset
|
110 vfprintf(stderr, fmt, ap); |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 va_end(ap); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 fflush(stderr); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 #endif |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
117 #ifdef __WIN32__ |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 static SDL_assert_state SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 static const SDL_assert_data *SDL_Windows_AssertData = NULL; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 static LRESULT CALLBACK |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 switch (msg) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 case WM_CREATE: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 /* !!! FIXME: all this code stinks. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 const SDL_assert_data *data = SDL_Windows_AssertData; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 char buf[1024]; |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
131 LPTSTR tstr; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 const int w = 100; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 const int h = 25; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 const int gap = 10; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 int x = gap; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 int y = 50; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 int len; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 int i; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 static const struct { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
140 LPCTSTR name; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 SDL_assert_state state; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 } buttons[] = { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
143 {TEXT("Abort"), SDL_ASSERTION_ABORT }, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
144 {TEXT("Break"), SDL_ASSERTION_BREAK }, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
145 {TEXT("Retry"), SDL_ASSERTION_RETRY }, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
146 {TEXT("Ignore"), SDL_ASSERTION_IGNORE }, |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
147 {TEXT("Always Ignore"), SDL_ASSERTION_ALWAYS_IGNORE }, |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 }; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 len = (int) SDL_snprintf(buf, sizeof (buf), |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 "Assertion failure at %s (%s:%d), triggered %u time%s:\r\n '%s'", |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 data->function, data->filename, data->linenum, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 data->trigger_count, (data->trigger_count == 1) ? "" : "s", |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 data->condition); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 if ((len < 0) || (len >= sizeof (buf))) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 buf[sizeof (buf) - 1] = '\0'; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
159 tstr = WIN_UTF8ToString(buf); |
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
160 CreateWindow(TEXT("STATIC"), tstr, |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 WS_VISIBLE | WS_CHILD | SS_LEFT, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 x, y, 550, 100, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 hwnd, (HMENU) 1, NULL, NULL); |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
164 SDL_free(tstr); |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 y += 110; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 for (i = 0; i < (sizeof (buttons) / sizeof (buttons[0])); i++) { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
168 CreateWindow(TEXT("BUTTON"), buttons[i].name, |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 WS_VISIBLE | WS_CHILD, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 x, y, w, h, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 hwnd, (HMENU) buttons[i].state, NULL, NULL); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 x += w + gap; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 break; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 case WM_COMMAND: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 SDL_Windows_AssertChoice = ((SDL_assert_state) (LOWORD(wParam))); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 SDL_Windows_AssertData = NULL; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 break; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 case WM_DESTROY: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 SDL_Windows_AssertData = NULL; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 break; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 return DefWindowProc(hwnd, msg, wParam, lParam); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 static SDL_assert_state |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 SDL_PromptAssertion_windows(const SDL_assert_data *data) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 HINSTANCE hInstance = 0; /* !!! FIXME? */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 HWND hwnd; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 MSG msg; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 WNDCLASS wc = {0}; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 SDL_Windows_AssertData = data; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 wc.lpszClassName = TEXT("SDL_assert"); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 wc.hInstance = hInstance ; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 wc.lpfnWndProc = SDL_Assertion_WndProc; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 wc.hCursor = LoadCursor(0, IDC_ARROW); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 RegisterClass(&wc); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 hwnd = CreateWindow(wc.lpszClassName, TEXT("SDL assertion failure"), |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 WS_OVERLAPPEDWINDOW | WS_VISIBLE, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 150, 150, 570, 260, 0, 0, hInstance, 0); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 while (GetMessage(&msg, NULL, 0, 0) && (SDL_Windows_AssertData != NULL)) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 TranslateMessage(&msg); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 DispatchMessage(&msg); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 DestroyWindow(hwnd); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 UnregisterClass(wc.lpszClassName, hInstance); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 return SDL_Windows_AssertChoice; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 #endif |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 static void SDL_AddAssertionToReport(SDL_assert_data *data) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 /* (data) is always a static struct defined with the assert macros, so |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 we don't have to worry about copying or allocating them. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 if (data->next == NULL) { /* not yet added? */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 data->next = triggered_assertions; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 triggered_assertions = data; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
234 |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 static void SDL_GenerateAssertionReport(void) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 { |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
237 const SDL_assert_data *item; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
238 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
239 /* only do this if the app hasn't assigned an assertion handler. */ |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
240 if (assertion_handler != SDL_PromptAssertion) |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
241 return; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
242 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
243 item = SDL_GetAssertionReport(); |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
244 if (item->condition) |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 debug_print("\n\nSDL assertion report.\n"); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 debug_print("All SDL assertions between last init/quit:\n\n"); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
249 while (item->condition) { |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 debug_print( |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 "'%s'\n" |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 " * %s (%s:%d)\n" |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 " * triggered %u time%s.\n" |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 " * always ignore: %s.\n", |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 item->condition, item->function, item->filename, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 item->linenum, item->trigger_count, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 (item->trigger_count == 1) ? "" : "s", |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 item->always_ignore ? "yes" : "no"); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 item = item->next; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 debug_print("\n"); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
263 SDL_ResetAssertionReport(); |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
267 static void SDL_ExitProcess(int exitcode) |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 { |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
269 #ifdef __WIN32__ |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 ExitProcess(42); |
3656
f17ea6f49745
Assume _exit() is available. It may be, even if unix isn't defined.
Sam Lantinga <slouken@libsdl.org>
parents:
3655
diff
changeset
|
271 #else |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 _exit(42); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 #endif |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 } |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
275 |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
276 static void SDL_AbortAssertion(void) |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
277 { |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
278 SDL_Quit(); |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
279 SDL_ExitProcess(42); |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
280 } |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
281 |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
283 static SDL_assert_state |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
284 SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 const char *envr; |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
287 SDL_assert_state state = SDL_ASSERTION_ABORT; |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3671
diff
changeset
|
288 SDL_Window *window; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
290 (void) userdata; /* unused in default handler. */ |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
291 |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 debug_print("\n\n" |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 "Assertion failure at %s (%s:%d), triggered %u time%s:\n" |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 " '%s'\n" |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 "\n", |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 data->function, data->filename, data->linenum, |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 data->trigger_count, (data->trigger_count == 1) ? "" : "s", |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 data->condition); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 |
3655
1cc7f0143c12
Moved SDL_FUNCTION out so it's always available, and added SDL_FILE and SDL_LINE
Sam Lantinga <slouken@libsdl.org>
parents:
3651
diff
changeset
|
300 /* let env. variable override, so unit tests won't block in a GUI. */ |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 envr = SDL_getenv("SDL_ASSERT"); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 if (envr != NULL) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 if (SDL_strcmp(envr, "abort") == 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 return SDL_ASSERTION_ABORT; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 } else if (SDL_strcmp(envr, "break") == 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 return SDL_ASSERTION_BREAK; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 } else if (SDL_strcmp(envr, "retry") == 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 return SDL_ASSERTION_RETRY; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 } else if (SDL_strcmp(envr, "ignore") == 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 return SDL_ASSERTION_IGNORE; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 } else if (SDL_strcmp(envr, "always_ignore") == 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 return SDL_ASSERTION_ALWAYS_IGNORE; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 } else { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 return SDL_ASSERTION_ABORT; /* oh well. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
318 /* Leave fullscreen mode, if possible (scary!) */ |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
319 window = SDL_GetFocusWindow(); |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
320 if (window) { |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
321 if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
322 SDL_MinimizeWindow(window); |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
323 } else { |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
324 /* !!! FIXME: ungrab the input if we're not fullscreen? */ |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
325 /* No need to mess with the window */ |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
326 window = 0; |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
327 } |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
328 } |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
329 |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 /* platform-specific UI... */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
5064
diff
changeset
|
332 #ifdef __WIN32__ |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
333 state = SDL_PromptAssertion_windows(data); |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 |
3690
e431b888ac6c
Fixed compilation on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
335 #elif __MACOSX__ |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 /* This has to be done in an Objective-C (*.m) file, so we call out. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *); |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
338 state = SDL_PromptAssertion_cocoa(data); |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
340 #else |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 /* this is a little hacky. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 for ( ; ; ) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 char buf[32]; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : "); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 fflush(stderr); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 if (fgets(buf, sizeof (buf), stdin) == NULL) { |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
347 break; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 if (SDL_strcmp(buf, "a") == 0) { |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
351 state = SDL_ASSERTION_ABORT; |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
352 break; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 } else if (SDL_strcmp(envr, "b") == 0) { |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
354 state = SDL_ASSERTION_BREAK; |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
355 break; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 } else if (SDL_strcmp(envr, "r") == 0) { |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
357 state = SDL_ASSERTION_RETRY; |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
358 break; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 } else if (SDL_strcmp(envr, "i") == 0) { |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
360 state = SDL_ASSERTION_IGNORE; |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
361 break; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 } else if (SDL_strcmp(envr, "A") == 0) { |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
363 state = SDL_ASSERTION_ALWAYS_IGNORE; |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
364 break; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 #endif |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 |
3657
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
369 /* Re-enter fullscreen mode */ |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
370 if (window) { |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
371 SDL_RestoreWindow(window); |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
372 } |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
373 |
eaea59cee6f2
Leave fullscreen mode to pop an assertion dialog
Sam Lantinga <slouken@libsdl.org>
parents:
3656
diff
changeset
|
374 return state; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 SDL_assert_state |
3655
1cc7f0143c12
Moved SDL_FUNCTION out so it's always available, and added SDL_FILE and SDL_LINE
Sam Lantinga <slouken@libsdl.org>
parents:
3651
diff
changeset
|
379 SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, |
1cc7f0143c12
Moved SDL_FUNCTION out so it's always available, and added SDL_FILE and SDL_LINE
Sam Lantinga <slouken@libsdl.org>
parents:
3651
diff
changeset
|
380 int line) |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 { |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
382 static int assertion_running = 0; |
3662
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
383 static SDL_SpinLock spinlock = 0; |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
384 SDL_assert_state state = SDL_ASSERTION_IGNORE; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 |
3662
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
386 SDL_AtomicLock(&spinlock); |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
387 if (assertion_mutex == NULL) { /* never called SDL_Init()? */ |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
388 assertion_mutex = SDL_CreateMutex(); |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
389 if (assertion_mutex == NULL) { |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
390 SDL_AtomicUnlock(&spinlock); |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
391 return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
392 } |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
393 } |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
394 SDL_AtomicUnlock(&spinlock); |
6a0b3048f271
Handle assertion failures when SDL_Init() isn't called.
Ryan C. Gordon <icculus@icculus.org>
parents:
3661
diff
changeset
|
395 |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 if (SDL_LockMutex(assertion_mutex) < 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 /* doing this because Visual C is upset over assigning in the macro. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 if (data->trigger_count == 0) { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 data->function = func; |
3655
1cc7f0143c12
Moved SDL_FUNCTION out so it's always available, and added SDL_FILE and SDL_LINE
Sam Lantinga <slouken@libsdl.org>
parents:
3651
diff
changeset
|
403 data->filename = file; |
1cc7f0143c12
Moved SDL_FUNCTION out so it's always available, and added SDL_FILE and SDL_LINE
Sam Lantinga <slouken@libsdl.org>
parents:
3651
diff
changeset
|
404 data->linenum = line; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 SDL_AddAssertionToReport(data); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 data->trigger_count++; |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
410 |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
411 assertion_running++; |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
412 if (assertion_running > 1) { /* assert during assert! Abort. */ |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
413 if (assertion_running == 2) { |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
414 SDL_AbortAssertion(); |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
415 } else if (assertion_running == 3) { /* Abort asserted! */ |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
416 SDL_ExitProcess(42); |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
417 } else { |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
418 while (1) { /* do nothing but spin; what else can you do?! */ } |
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
419 } |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
422 if (!data->always_ignore) { |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
423 state = assertion_handler(data, assertion_userdata); |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
424 } |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 switch (state) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 case SDL_ASSERTION_ABORT: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 SDL_AbortAssertion(); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 return SDL_ASSERTION_IGNORE; /* shouldn't return, but oh well. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 case SDL_ASSERTION_ALWAYS_IGNORE: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 state = SDL_ASSERTION_IGNORE; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 data->always_ignore = 1; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 break; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 case SDL_ASSERTION_IGNORE: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 case SDL_ASSERTION_RETRY: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 case SDL_ASSERTION_BREAK: |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 break; /* macro handles these. */ |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 |
3661
22b6a0c7ea6e
Handle assertion failures during assertion handler.
Ryan C. Gordon <icculus@icculus.org>
parents:
3657
diff
changeset
|
443 assertion_running--; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 SDL_UnlockMutex(assertion_mutex); |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 return state; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 int SDL_AssertionsInit(void) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 { |
3664
8bdc37b1a52a
Handle assert init/quit better.
Ryan C. Gordon <icculus@icculus.org>
parents:
3662
diff
changeset
|
452 /* this is a no-op at the moment. */ |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 return 0; |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 void SDL_AssertionsQuit(void) |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 { |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 SDL_GenerateAssertionReport(); |
3664
8bdc37b1a52a
Handle assert init/quit better.
Ryan C. Gordon <icculus@icculus.org>
parents:
3662
diff
changeset
|
459 if (assertion_mutex != NULL) { |
8bdc37b1a52a
Handle assert init/quit better.
Ryan C. Gordon <icculus@icculus.org>
parents:
3662
diff
changeset
|
460 SDL_DestroyMutex(assertion_mutex); |
8bdc37b1a52a
Handle assert init/quit better.
Ryan C. Gordon <icculus@icculus.org>
parents:
3662
diff
changeset
|
461 assertion_mutex = NULL; |
8bdc37b1a52a
Handle assert init/quit better.
Ryan C. Gordon <icculus@icculus.org>
parents:
3662
diff
changeset
|
462 } |
3670
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
463 } |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
464 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
465 void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata) |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
466 { |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
467 if (handler != NULL) { |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
468 assertion_handler = handler; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
469 assertion_userdata = userdata; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
470 } else { |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
471 assertion_handler = SDL_PromptAssertion; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
472 assertion_userdata = NULL; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
473 } |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
474 } |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
475 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
476 const SDL_assert_data *SDL_GetAssertionReport(void) |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
477 { |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
478 return triggered_assertions; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
479 } |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
480 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
481 void SDL_ResetAssertionReport(void) |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
482 { |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
483 SDL_assert_data *item = triggered_assertions; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
484 SDL_assert_data *next = NULL; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
485 for (item = triggered_assertions; item->condition; item = next) { |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
486 next = (SDL_assert_data *) item->next; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
487 item->always_ignore = SDL_FALSE; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
488 item->trigger_count = 0; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
489 item->next = NULL; |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
490 } |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
491 |
62b6a5b99918
Clean up assertion API for public use.
Ryan C. Gordon <icculus@icculus.org>
parents:
3669
diff
changeset
|
492 triggered_assertions = &assertion_list_terminator; |
3647
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 } |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
494 |
c5925cd41955
First pass at Ryan's assertion code, minor tweaks to come.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 /* vi: set ts=4 sw=4 expandtab: */ |