src/SDL_assert.c
changeset 5064 eae20af0b983
parent 5007 adf6f0c8ec35
child 5086 c2539ff054c8
equal deleted inserted replaced
5063:5680976fb37a 5064:eae20af0b983
    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 _WINDOWS
    29 #ifdef __WINDOWS__
    30 #define WIN32_LEAN_AND_MEAN
    30 #define WIN32_LEAN_AND_MEAN
    31 #include <windows.h>
    31 #include <windows.h>
    32 #else  /* fprintf, _exit(), etc. */
    32 #else  /* fprintf, _exit(), etc. */
    33 #include <stdio.h>
    33 #include <stdio.h>
    34 #include <stdlib.h>
    34 #include <stdlib.h>
    55 #endif
    55 #endif
    56 
    56 
    57 static void
    57 static void
    58 debug_print(const char *fmt, ...)
    58 debug_print(const char *fmt, ...)
    59 {
    59 {
    60 #ifdef _WINDOWS
    60 #ifdef __WINDOWS__
    61     /* Format into a buffer for OutputDebugStringA(). */
    61     /* Format into a buffer for OutputDebugStringA(). */
    62     char buf[1024];
    62     char buf[1024];
    63     char *startptr;
    63     char *startptr;
    64     char *ptr;
    64     char *ptr;
    65     int len;
    65     int len;
    97     fflush(stderr);
    97     fflush(stderr);
    98 #endif
    98 #endif
    99 }
    99 }
   100 
   100 
   101 
   101 
   102 #ifdef _WINDOWS
   102 #ifdef __WINDOWS__
   103 static SDL_assert_state SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT;
   103 static SDL_assert_state SDL_Windows_AssertChoice = SDL_ASSERTION_ABORT;
   104 static const SDL_assert_data *SDL_Windows_AssertData = NULL;
   104 static const SDL_assert_data *SDL_Windows_AssertData = NULL;
   105 
   105 
   106 static LRESULT CALLBACK
   106 static LRESULT CALLBACK
   107 SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   107 SDL_Assertion_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
   246     }
   246     }
   247 }
   247 }
   248 
   248 
   249 static void SDL_ExitProcess(int exitcode)
   249 static void SDL_ExitProcess(int exitcode)
   250 {
   250 {
   251 #ifdef _WINDOWS
   251 #ifdef __WINDOWS__
   252     ExitProcess(42);
   252     ExitProcess(42);
   253 #else
   253 #else
   254     _exit(42);
   254     _exit(42);
   255 #endif
   255 #endif
   256 }
   256 }
   309         }
   309         }
   310     }
   310     }
   311 
   311 
   312     /* platform-specific UI... */
   312     /* platform-specific UI... */
   313 
   313 
   314 #ifdef _WINDOWS
   314 #ifdef __WINDOWS__
   315     state = SDL_PromptAssertion_windows(data);
   315     state = SDL_PromptAssertion_windows(data);
   316 
   316 
   317 #elif __MACOSX__
   317 #elif __MACOSX__
   318     /* This has to be done in an Objective-C (*.m) file, so we call out. */
   318     /* This has to be done in an Objective-C (*.m) file, so we call out. */
   319     extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *);
   319     extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *);