author  Ryan C. Gordon <icculus@icculus.org> 
Mon, 01 Aug 2016 00:20:47 0400  
changeset 10214  4f29bb9e19c3 
parent 9998  f67cf37e9cd4 
permissions  rwrr 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

1 
/* 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

2 
Simple DirectMedia Layer 
9998
f67cf37e9cd4
Updated copyright to 2016
Sam Lantinga <slouken@libsdl.org>
parents:
9805
diff
changeset

3 
Copyright (C) 19972016 Sam Lantinga <slouken@libsdl.org> 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

4 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

5 
This software is provided 'asis', without any express or implied 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

6 
warranty. In no event will the authors be held liable for any damages 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

7 
arising from the use of this software. 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

8 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

9 
Permission is granted to anyone to use this software for any purpose, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

10 
including commercial applications, and to alter it and redistribute it 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

11 
freely, subject to the following restrictions: 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

12 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

13 
1. The origin of this software must not be misrepresented; you must not 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

14 
claim that you wrote the original software. If you use this software 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

15 
in a product, an acknowledgment in the product documentation would be 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

16 
appreciated but is not required. 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

17 
2. Altered source versions must be plainly marked as such, and must not be 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

18 
misrepresented as being the original software. 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

19 
3. This notice may not be removed or altered from any source distribution. 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

20 
*/ 
8093
b43765095a6f
Make internal SDL sources include SDL_internal.h instead of SDL_config.h
Ryan C. Gordon <icculus@icculus.org>
parents:
7828
diff
changeset

21 
#include "./SDL_internal.h" 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

22 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

23 
#if defined(__WIN32__)  defined(__WINRT__) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

24 
#include "core/windows/SDL_windows.h" 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

25 
#endif 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

26 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

27 
/* Simple log messages in SDL */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

28 

8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

29 
#include "SDL_error.h" 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

30 
#include "SDL_log.h" 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

31 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

32 
#if HAVE_STDIO_H 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

33 
#include <stdio.h> 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

34 
#endif 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

35 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

36 
#if defined(__ANDROID__) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

37 
#include <android/log.h> 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

38 
#endif 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

39 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

40 
#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

41 
#define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

42 
#define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

43 
#define DEFAULT_TEST_PRIORITY SDL_LOG_PRIORITY_VERBOSE 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

44 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

45 
typedef struct SDL_LogLevel 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

46 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

47 
int category; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

48 
SDL_LogPriority priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

49 
struct SDL_LogLevel *next; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

50 
} SDL_LogLevel; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

51 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

52 
/* The default log output function */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

53 
static void SDL_LogOutput(void *userdata, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

54 
int category, SDL_LogPriority priority, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

55 
const char *message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

56 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

57 
static SDL_LogLevel *SDL_loglevels; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

58 
static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

59 
static SDL_LogPriority SDL_assert_priority = DEFAULT_ASSERT_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

60 
static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

61 
static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

62 
static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

63 
static void *SDL_log_userdata = NULL; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

64 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

65 
static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

66 
NULL, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

67 
"VERBOSE", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

68 
"DEBUG", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

69 
"INFO", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

70 
"WARN", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

71 
"ERROR", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

72 
"CRITICAL" 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

73 
}; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

74 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

75 
#ifdef __ANDROID__ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

76 
static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

77 
"APP", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

78 
"ERROR", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

79 
"SYSTEM", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

80 
"AUDIO", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

81 
"VIDEO", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

82 
"RENDER", 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

83 
"INPUT" 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

84 
}; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

85 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

86 
static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

87 
ANDROID_LOG_UNKNOWN, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

88 
ANDROID_LOG_VERBOSE, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

89 
ANDROID_LOG_DEBUG, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

90 
ANDROID_LOG_INFO, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

91 
ANDROID_LOG_WARN, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

92 
ANDROID_LOG_ERROR, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

93 
ANDROID_LOG_FATAL 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

94 
}; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

95 
#endif /* __ANDROID__ */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

96 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

97 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

98 
void 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

99 
SDL_LogSetAllPriority(SDL_LogPriority priority) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

100 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

101 
SDL_LogLevel *entry; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

102 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

103 
for (entry = SDL_loglevels; entry; entry = entry>next) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

104 
entry>priority = priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

105 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

106 
SDL_default_priority = priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

107 
SDL_assert_priority = priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

108 
SDL_application_priority = priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

109 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

110 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

111 
void 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

112 
SDL_LogSetPriority(int category, SDL_LogPriority priority) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

113 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

114 
SDL_LogLevel *entry; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

115 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

116 
for (entry = SDL_loglevels; entry; entry = entry>next) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

117 
if (entry>category == category) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

118 
entry>priority = priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

119 
return; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

120 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

121 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

122 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

123 
/* Create a new entry */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

124 
entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry)); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

125 
if (entry) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

126 
entry>category = category; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

127 
entry>priority = priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

128 
entry>next = SDL_loglevels; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

129 
SDL_loglevels = entry; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

130 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

131 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

132 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

133 
SDL_LogPriority 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

134 
SDL_LogGetPriority(int category) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

135 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

136 
SDL_LogLevel *entry; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

137 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

138 
for (entry = SDL_loglevels; entry; entry = entry>next) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

139 
if (entry>category == category) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

140 
return entry>priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

141 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

142 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

143 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

144 
if (category == SDL_LOG_CATEGORY_TEST) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

145 
return SDL_test_priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

146 
} else if (category == SDL_LOG_CATEGORY_APPLICATION) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

147 
return SDL_application_priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

148 
} else if (category == SDL_LOG_CATEGORY_ASSERT) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

149 
return SDL_assert_priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

150 
} else { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

151 
return SDL_default_priority; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

152 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

153 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

154 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

155 
void 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

156 
SDL_LogResetPriorities(void) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

157 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

158 
SDL_LogLevel *entry; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

159 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

160 
while (SDL_loglevels) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

161 
entry = SDL_loglevels; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

162 
SDL_loglevels = entry>next; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

163 
SDL_free(entry); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

164 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

165 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

166 
SDL_default_priority = DEFAULT_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

167 
SDL_assert_priority = DEFAULT_ASSERT_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

168 
SDL_application_priority = DEFAULT_APPLICATION_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

169 
SDL_test_priority = DEFAULT_TEST_PRIORITY; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

170 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

171 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

172 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

173 
SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

174 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

175 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

176 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

177 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

178 
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

179 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

180 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

181 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

182 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

183 
SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

184 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

185 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

186 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

187 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

188 
SDL_LogMessageV(category, SDL_LOG_PRIORITY_VERBOSE, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

189 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

190 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

191 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

192 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

193 
SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

194 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

195 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

196 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

197 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

198 
SDL_LogMessageV(category, SDL_LOG_PRIORITY_DEBUG, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

199 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

200 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

201 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

202 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

203 
SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

204 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

205 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

206 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

207 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

208 
SDL_LogMessageV(category, SDL_LOG_PRIORITY_INFO, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

209 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

210 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

211 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

212 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

213 
SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

214 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

215 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

216 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

217 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

218 
SDL_LogMessageV(category, SDL_LOG_PRIORITY_WARN, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

219 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

220 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

221 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

222 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

223 
SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

224 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

225 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

226 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

227 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

228 
SDL_LogMessageV(category, SDL_LOG_PRIORITY_ERROR, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

229 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

230 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

231 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

232 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

233 
SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

234 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

235 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

236 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

237 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

238 
SDL_LogMessageV(category, SDL_LOG_PRIORITY_CRITICAL, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

239 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

240 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

241 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

242 
void 
8820
0e935d5b193a
Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents:
8583
diff
changeset

243 
SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

244 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

245 
va_list ap; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

246 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

247 
va_start(ap, fmt); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

248 
SDL_LogMessageV(category, priority, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

249 
va_end(ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

250 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

251 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

252 
#ifdef __ANDROID__ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

253 
static const char * 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

254 
GetCategoryPrefix(int category) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

255 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

256 
if (category < SDL_LOG_CATEGORY_RESERVED1) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

257 
return SDL_category_prefixes[category]; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

258 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

259 
if (category < SDL_LOG_CATEGORY_CUSTOM) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

260 
return "RESERVED"; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

261 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

262 
return "CUSTOM"; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

263 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

264 
#endif /* __ANDROID__ */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

265 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

266 
void 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

267 
SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

268 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

269 
char *message; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

270 
size_t len; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

271 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

272 
/* Nothing to do if we don't have an output function */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

273 
if (!SDL_log_function) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

274 
return; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

275 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

276 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

277 
/* Make sure we don't exceed array bounds */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

278 
if ((int)priority < 0  priority >= SDL_NUM_LOG_PRIORITIES) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

279 
return; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

280 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

281 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

282 
/* See if we want to do anything with this message */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

283 
if (priority < SDL_LogGetPriority(category)) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

284 
return; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

285 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

286 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

287 
message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

288 
if (!message) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

289 
return; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

290 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

291 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

292 
SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

293 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

294 
/* Chop off final endline. */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

295 
len = SDL_strlen(message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

296 
if ((len > 0) && (message[len1] == '\n')) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

297 
message[len] = '\0'; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

298 
if ((len > 0) && (message[len1] == '\r')) { /* catch "\r\n", too. */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

299 
message[len] = '\0'; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

300 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

301 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

302 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

303 
SDL_log_function(SDL_log_userdata, category, priority, message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

304 
SDL_stack_free(message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

305 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

306 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

307 
#if defined(__WIN32__) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

308 
/* Flag tracking the attachment of the console: 0=unattached, 1=attached, 1=error */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

309 
static int consoleAttached = 0; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

310 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

311 
/* Handle to stderr output of console. */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

312 
static HANDLE stderrHandle = NULL; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

313 
#endif 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

314 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

315 
static void 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

316 
SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

317 
const char *message) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

318 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

319 
#if defined(__WIN32__)  defined(__WINRT__) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

320 
/* Way too many allocations here, urgh */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

321 
/* Note: One can't call SDL_SetError here, since that function itself logs. */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

322 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

323 
char *output; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

324 
size_t length; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

325 
LPTSTR tstr; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

326 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

327 
#ifndef __WINRT__ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

328 
BOOL attachResult; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

329 
DWORD attachError; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

330 
unsigned long charsWritten; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

331 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

332 
/* Maybe attach console and get stderr handle */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

333 
if (consoleAttached == 0) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

334 
attachResult = AttachConsole(ATTACH_PARENT_PROCESS); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

335 
if (!attachResult) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

336 
attachError = GetLastError(); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

337 
if (attachError == ERROR_INVALID_HANDLE) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

338 
OutputDebugString(TEXT("Parent process has no console\r\n")); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

339 
consoleAttached = 1; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

340 
} else if (attachError == ERROR_GEN_FAILURE) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

341 
OutputDebugString(TEXT("Could not attach to console of parent process\r\n")); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

342 
consoleAttached = 1; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

343 
} else if (attachError == ERROR_ACCESS_DENIED) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

344 
/* Already attached */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

345 
consoleAttached = 1; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

346 
} else { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

347 
OutputDebugString(TEXT("Error attaching console\r\n")); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

348 
consoleAttached = 1; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

349 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

350 
} else { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

351 
/* Newly attached */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

352 
consoleAttached = 1; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

353 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

354 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

355 
if (consoleAttached == 1) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

356 
stderrHandle = GetStdHandle(STD_ERROR_HANDLE); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

357 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

358 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

359 
#endif /* ifndef __WINRT__ */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

360 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

361 
length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

362 
output = SDL_stack_alloc(char, length); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

363 
SDL_snprintf(output, length, "%s: %s\r\n", SDL_priority_prefixes[priority], message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

364 
tstr = WIN_UTF8ToString(output); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

365 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

366 
/* Output to debugger */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

367 
OutputDebugString(tstr); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

368 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

369 
#ifndef __WINRT__ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

370 
/* Screen output to stderr, if console was attached. */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

371 
if (consoleAttached == 1) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

372 
if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

373 
OutputDebugString(TEXT("Error calling WriteConsole\r\n")); 
9805
8a0142df6be5
Windows: Fixed wrong debugger output if logging empty string as info or warning.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
9619
diff
changeset

374 
if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) { 
8a0142df6be5
Windows: Fixed wrong debugger output if logging empty string as info or warning.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
9619
diff
changeset

375 
OutputDebugString(TEXT("Insufficient heap memory to write message\r\n")); 
8a0142df6be5
Windows: Fixed wrong debugger output if logging empty string as info or warning.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
9619
diff
changeset

376 
} 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

377 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

378 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

379 
#endif /* ifndef __WINRT__ */ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

380 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

381 
SDL_free(tstr); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

382 
SDL_stack_free(output); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

383 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

384 
#elif defined(__ANDROID__) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

385 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

386 
char tag[32]; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

387 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

388 
SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category)); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

389 
__android_log_write(SDL_android_priority[priority], tag, message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

390 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

391 
#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

392 
/* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now. 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

393 
*/ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

394 
extern void SDL_NSLog(const char *text); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

395 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

396 
char *text; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

397 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

398 
text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

399 
if (text) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

400 
SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

401 
SDL_NSLog(text); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

402 
SDL_stack_free(text); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

403 
return; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

404 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

405 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

406 
#elif defined(__PSP__) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

407 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

408 
FILE* pFile; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

409 
pFile = fopen ("SDL_Log.txt", "a"); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

410 
fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

411 
fclose (pFile); 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

412 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

413 
#endif 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

414 
#if HAVE_STDIO_H 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

415 
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); 
8833
ae720d61d14d
Chrome's Native Client backend implementation
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8820
diff
changeset

416 
#if __NACL__ 
ae720d61d14d
Chrome's Native Client backend implementation
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8820
diff
changeset

417 
fflush(stderr); 
ae720d61d14d
Chrome's Native Client backend implementation
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8820
diff
changeset

418 
#endif 
8582
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

419 
#endif 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

420 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

421 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

422 
void 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

423 
SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

424 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

425 
if (callback) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

426 
*callback = SDL_log_function; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

427 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

428 
if (userdata) { 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

429 
*userdata = SDL_log_userdata; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

430 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

431 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

432 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

433 
void 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

434 
SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata) 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

435 
{ 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

436 
SDL_log_function = callback; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

437 
SDL_log_userdata = userdata; 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

438 
} 
c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

439 

c3e9a2b93517
Fixed line endings on WinRT source code
Sam Lantinga <slouken@libsdl.org>
parents:
8536
diff
changeset

440 
/* vi: set ts=4 sw=4 expandtab: */ 