src/SDL_assert.c
changeset 8316 88f011703f39
parent 6305 601b0e251822
child 8337 4a67a3cca43d
equal deleted inserted replaced
8315:76c317e41b53 8316:88f011703f39
    24 #include "SDL_atomic.h"
    24 #include "SDL_atomic.h"
    25 #include "SDL_assert.h"
    25 #include "SDL_assert.h"
    26 #include "SDL_assert_c.h"
    26 #include "SDL_assert_c.h"
    27 #include "video/SDL_sysvideo.h"
    27 #include "video/SDL_sysvideo.h"
    28 
    28 
    29 #ifdef __WIN32__
    29 #if defined(__WIN32__) || defined(__WINRT__)
    30 #include "core/windows/SDL_windows.h"
    30 #include "core/windows/SDL_windows.h"
    31 
    31 
    32 #ifndef WS_OVERLAPPEDWINDOW
    32 #ifndef WS_OVERLAPPEDWINDOW
    33 #define WS_OVERLAPPEDWINDOW 0
    33 #define WS_OVERLAPPEDWINDOW 0
    34 #endif
    34 #endif
    57 #endif
    57 #endif
    58 
    58 
    59 static void
    59 static void
    60 debug_print(const char *fmt, ...)
    60 debug_print(const char *fmt, ...)
    61 {
    61 {
    62 #ifdef __WIN32__
    62 #if defined(__WIN32__) || defined(__WINRT__)
    63     /* Format into a buffer for OutputDebugStringA(). */
    63     /* Format into a buffer for OutputDebugStringA(). */
    64     char buf[1024];
    64     char buf[1024];
    65     char *startptr;
    65     char *startptr;
    66     char *ptr;
    66     char *ptr;
    67     LPTSTR tstr;
    67     LPTSTR tstr;
   211     return SDL_Windows_AssertChoice;
   211     return SDL_Windows_AssertChoice;
   212 }
   212 }
   213 #endif
   213 #endif
   214 
   214 
   215 
   215 
       
   216 #ifdef __WINRT__
       
   217 
       
   218 static SDL_assert_state
       
   219 SDL_PromptAssertion_windowsrt(const SDL_assert_data *data)
       
   220 {
       
   221     /* TODO, WinRT: implement SDL_PromptAssertion_windowsrt */
       
   222     return SDL_ASSERTION_ABORT;
       
   223 }
       
   224 
       
   225 #endif
       
   226 
       
   227 
   216 static void SDL_AddAssertionToReport(SDL_assert_data *data)
   228 static void SDL_AddAssertionToReport(SDL_assert_data *data)
   217 {
   229 {
   218     /* (data) is always a static struct defined with the assert macros, so
   230     /* (data) is always a static struct defined with the assert macros, so
   219        we don't have to worry about copying or allocating them. */
   231        we don't have to worry about copying or allocating them. */
   220     data->trigger_count++;
   232     data->trigger_count++;
   252     }
   264     }
   253 }
   265 }
   254 
   266 
   255 static void SDL_ExitProcess(int exitcode)
   267 static void SDL_ExitProcess(int exitcode)
   256 {
   268 {
   257 #ifdef __WIN32__
   269 #if defined(__WIN32__)
   258     ExitProcess(exitcode);
   270     ExitProcess(exitcode);
       
   271 #elif defined(__WINRT__)
       
   272     exit(exitcode);
   259 #else
   273 #else
   260     _exit(exitcode);
   274     _exit(exitcode);
   261 #endif
   275 #endif
   262 }
   276 }
   263 
   277 
   315         }
   329         }
   316     }
   330     }
   317 
   331 
   318     /* platform-specific UI... */
   332     /* platform-specific UI... */
   319 
   333 
   320 #ifdef __WIN32__
   334 #if defined(__WIN32__)
   321     state = SDL_PromptAssertion_windows(data);
   335     state = SDL_PromptAssertion_windows(data);
       
   336 
       
   337 #elif defined(__WINRT__)
       
   338     state = SDL_PromptAssertion_windowsrt(data);
   322 
   339 
   323 #elif defined __MACOSX__ && defined SDL_VIDEO_DRIVER_COCOA
   340 #elif defined __MACOSX__ && defined SDL_VIDEO_DRIVER_COCOA
   324     /* This has to be done in an Objective-C (*.m) file, so we call out. */
   341     /* This has to be done in an Objective-C (*.m) file, so we call out. */
   325     extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *);
   342     extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *);
   326     state = SDL_PromptAssertion_cocoa(data);
   343     state = SDL_PromptAssertion_cocoa(data);