SDL standard library

Dependents:   H261_encoder

Committer:
miruga27
Date:
Wed Sep 07 18:46:53 2016 +0000
Revision:
0:dda4f4550403
7/09/2016;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:dda4f4550403 1 /*
miruga27 0:dda4f4550403 2 Simple DirectMedia Layer
miruga27 0:dda4f4550403 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:dda4f4550403 4
miruga27 0:dda4f4550403 5 This software is provided 'as-is', without any express or implied
miruga27 0:dda4f4550403 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:dda4f4550403 7 arising from the use of this software.
miruga27 0:dda4f4550403 8
miruga27 0:dda4f4550403 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:dda4f4550403 10 including commercial applications, and to alter it and redistribute it
miruga27 0:dda4f4550403 11 freely, subject to the following restrictions:
miruga27 0:dda4f4550403 12
miruga27 0:dda4f4550403 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:dda4f4550403 14 claim that you wrote the original software. If you use this software
miruga27 0:dda4f4550403 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:dda4f4550403 16 appreciated but is not required.
miruga27 0:dda4f4550403 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:dda4f4550403 18 misrepresented as being the original software.
miruga27 0:dda4f4550403 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:dda4f4550403 20 */
miruga27 0:dda4f4550403 21
miruga27 0:dda4f4550403 22 /**
miruga27 0:dda4f4550403 23 * \file SDL_log.h
miruga27 0:dda4f4550403 24 *
miruga27 0:dda4f4550403 25 * Simple log messages with categories and priorities.
miruga27 0:dda4f4550403 26 *
miruga27 0:dda4f4550403 27 * By default logs are quiet, but if you're debugging SDL you might want:
miruga27 0:dda4f4550403 28 *
miruga27 0:dda4f4550403 29 * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
miruga27 0:dda4f4550403 30 *
miruga27 0:dda4f4550403 31 * Here's where the messages go on different platforms:
miruga27 0:dda4f4550403 32 * Windows: debug output stream
miruga27 0:dda4f4550403 33 * Android: log output
miruga27 0:dda4f4550403 34 * Others: standard error output (stderr)
miruga27 0:dda4f4550403 35 */
miruga27 0:dda4f4550403 36
miruga27 0:dda4f4550403 37 #ifndef _SDL_log_h
miruga27 0:dda4f4550403 38 #define _SDL_log_h
miruga27 0:dda4f4550403 39
miruga27 0:dda4f4550403 40 #include "SDL_stdinc.h"
miruga27 0:dda4f4550403 41
miruga27 0:dda4f4550403 42 #include "begin_code.h"
miruga27 0:dda4f4550403 43 /* Set up for C function definitions, even when using C++ */
miruga27 0:dda4f4550403 44 #ifdef __cplusplus
miruga27 0:dda4f4550403 45 extern "C" {
miruga27 0:dda4f4550403 46 #endif
miruga27 0:dda4f4550403 47
miruga27 0:dda4f4550403 48
miruga27 0:dda4f4550403 49 /**
miruga27 0:dda4f4550403 50 * \brief The maximum size of a log message
miruga27 0:dda4f4550403 51 *
miruga27 0:dda4f4550403 52 * Messages longer than the maximum size will be truncated
miruga27 0:dda4f4550403 53 */
miruga27 0:dda4f4550403 54 #define SDL_MAX_LOG_MESSAGE 4096
miruga27 0:dda4f4550403 55
miruga27 0:dda4f4550403 56 /**
miruga27 0:dda4f4550403 57 * \brief The predefined log categories
miruga27 0:dda4f4550403 58 *
miruga27 0:dda4f4550403 59 * By default the application category is enabled at the INFO level,
miruga27 0:dda4f4550403 60 * the assert category is enabled at the WARN level, test is enabled
miruga27 0:dda4f4550403 61 * at the VERBOSE level and all other categories are enabled at the
miruga27 0:dda4f4550403 62 * CRITICAL level.
miruga27 0:dda4f4550403 63 */
miruga27 0:dda4f4550403 64 enum
miruga27 0:dda4f4550403 65 {
miruga27 0:dda4f4550403 66 SDL_LOG_CATEGORY_APPLICATION,
miruga27 0:dda4f4550403 67 SDL_LOG_CATEGORY_ERROR,
miruga27 0:dda4f4550403 68 SDL_LOG_CATEGORY_ASSERT,
miruga27 0:dda4f4550403 69 SDL_LOG_CATEGORY_SYSTEM,
miruga27 0:dda4f4550403 70 SDL_LOG_CATEGORY_AUDIO,
miruga27 0:dda4f4550403 71 SDL_LOG_CATEGORY_VIDEO,
miruga27 0:dda4f4550403 72 SDL_LOG_CATEGORY_RENDER,
miruga27 0:dda4f4550403 73 SDL_LOG_CATEGORY_INPUT,
miruga27 0:dda4f4550403 74 SDL_LOG_CATEGORY_TEST,
miruga27 0:dda4f4550403 75
miruga27 0:dda4f4550403 76 /* Reserved for future SDL library use */
miruga27 0:dda4f4550403 77 SDL_LOG_CATEGORY_RESERVED1,
miruga27 0:dda4f4550403 78 SDL_LOG_CATEGORY_RESERVED2,
miruga27 0:dda4f4550403 79 SDL_LOG_CATEGORY_RESERVED3,
miruga27 0:dda4f4550403 80 SDL_LOG_CATEGORY_RESERVED4,
miruga27 0:dda4f4550403 81 SDL_LOG_CATEGORY_RESERVED5,
miruga27 0:dda4f4550403 82 SDL_LOG_CATEGORY_RESERVED6,
miruga27 0:dda4f4550403 83 SDL_LOG_CATEGORY_RESERVED7,
miruga27 0:dda4f4550403 84 SDL_LOG_CATEGORY_RESERVED8,
miruga27 0:dda4f4550403 85 SDL_LOG_CATEGORY_RESERVED9,
miruga27 0:dda4f4550403 86 SDL_LOG_CATEGORY_RESERVED10,
miruga27 0:dda4f4550403 87
miruga27 0:dda4f4550403 88 /* Beyond this point is reserved for application use, e.g.
miruga27 0:dda4f4550403 89 enum {
miruga27 0:dda4f4550403 90 MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
miruga27 0:dda4f4550403 91 MYAPP_CATEGORY_AWESOME2,
miruga27 0:dda4f4550403 92 MYAPP_CATEGORY_AWESOME3,
miruga27 0:dda4f4550403 93 ...
miruga27 0:dda4f4550403 94 };
miruga27 0:dda4f4550403 95 */
miruga27 0:dda4f4550403 96 SDL_LOG_CATEGORY_CUSTOM
miruga27 0:dda4f4550403 97 };
miruga27 0:dda4f4550403 98
miruga27 0:dda4f4550403 99 /**
miruga27 0:dda4f4550403 100 * \brief The predefined log priorities
miruga27 0:dda4f4550403 101 */
miruga27 0:dda4f4550403 102 typedef enum
miruga27 0:dda4f4550403 103 {
miruga27 0:dda4f4550403 104 SDL_LOG_PRIORITY_VERBOSE = 1,
miruga27 0:dda4f4550403 105 SDL_LOG_PRIORITY_DEBUG,
miruga27 0:dda4f4550403 106 SDL_LOG_PRIORITY_INFO,
miruga27 0:dda4f4550403 107 SDL_LOG_PRIORITY_WARN,
miruga27 0:dda4f4550403 108 SDL_LOG_PRIORITY_ERROR,
miruga27 0:dda4f4550403 109 SDL_LOG_PRIORITY_CRITICAL,
miruga27 0:dda4f4550403 110 SDL_NUM_LOG_PRIORITIES
miruga27 0:dda4f4550403 111 } SDL_LogPriority;
miruga27 0:dda4f4550403 112
miruga27 0:dda4f4550403 113
miruga27 0:dda4f4550403 114 /**
miruga27 0:dda4f4550403 115 * \brief Set the priority of all log categories
miruga27 0:dda4f4550403 116 */
miruga27 0:dda4f4550403 117 extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
miruga27 0:dda4f4550403 118
miruga27 0:dda4f4550403 119 /**
miruga27 0:dda4f4550403 120 * \brief Set the priority of a particular log category
miruga27 0:dda4f4550403 121 */
miruga27 0:dda4f4550403 122 extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
miruga27 0:dda4f4550403 123 SDL_LogPriority priority);
miruga27 0:dda4f4550403 124
miruga27 0:dda4f4550403 125 /**
miruga27 0:dda4f4550403 126 * \brief Get the priority of a particular log category
miruga27 0:dda4f4550403 127 */
miruga27 0:dda4f4550403 128 extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
miruga27 0:dda4f4550403 129
miruga27 0:dda4f4550403 130 /**
miruga27 0:dda4f4550403 131 * \brief Reset all priorities to default.
miruga27 0:dda4f4550403 132 *
miruga27 0:dda4f4550403 133 * \note This is called in SDL_Quit().
miruga27 0:dda4f4550403 134 */
miruga27 0:dda4f4550403 135 extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
miruga27 0:dda4f4550403 136
miruga27 0:dda4f4550403 137 /**
miruga27 0:dda4f4550403 138 * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
miruga27 0:dda4f4550403 139 */
miruga27 0:dda4f4550403 140 extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
miruga27 0:dda4f4550403 141
miruga27 0:dda4f4550403 142 /**
miruga27 0:dda4f4550403 143 * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
miruga27 0:dda4f4550403 144 */
miruga27 0:dda4f4550403 145 extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
miruga27 0:dda4f4550403 146
miruga27 0:dda4f4550403 147 /**
miruga27 0:dda4f4550403 148 * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
miruga27 0:dda4f4550403 149 */
miruga27 0:dda4f4550403 150 extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...);
miruga27 0:dda4f4550403 151
miruga27 0:dda4f4550403 152 /**
miruga27 0:dda4f4550403 153 * \brief Log a message with SDL_LOG_PRIORITY_INFO
miruga27 0:dda4f4550403 154 */
miruga27 0:dda4f4550403 155 extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
miruga27 0:dda4f4550403 156
miruga27 0:dda4f4550403 157 /**
miruga27 0:dda4f4550403 158 * \brief Log a message with SDL_LOG_PRIORITY_WARN
miruga27 0:dda4f4550403 159 */
miruga27 0:dda4f4550403 160 extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
miruga27 0:dda4f4550403 161
miruga27 0:dda4f4550403 162 /**
miruga27 0:dda4f4550403 163 * \brief Log a message with SDL_LOG_PRIORITY_ERROR
miruga27 0:dda4f4550403 164 */
miruga27 0:dda4f4550403 165 extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
miruga27 0:dda4f4550403 166
miruga27 0:dda4f4550403 167 /**
miruga27 0:dda4f4550403 168 * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
miruga27 0:dda4f4550403 169 */
miruga27 0:dda4f4550403 170 extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
miruga27 0:dda4f4550403 171
miruga27 0:dda4f4550403 172 /**
miruga27 0:dda4f4550403 173 * \brief Log a message with the specified category and priority.
miruga27 0:dda4f4550403 174 */
miruga27 0:dda4f4550403 175 extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
miruga27 0:dda4f4550403 176 SDL_LogPriority priority,
miruga27 0:dda4f4550403 177 const char *fmt, ...);
miruga27 0:dda4f4550403 178
miruga27 0:dda4f4550403 179 /**
miruga27 0:dda4f4550403 180 * \brief Log a message with the specified category and priority.
miruga27 0:dda4f4550403 181 */
miruga27 0:dda4f4550403 182 extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
miruga27 0:dda4f4550403 183 SDL_LogPriority priority,
miruga27 0:dda4f4550403 184 const char *fmt, va_list ap);
miruga27 0:dda4f4550403 185
miruga27 0:dda4f4550403 186 /**
miruga27 0:dda4f4550403 187 * \brief The prototype for the log output function
miruga27 0:dda4f4550403 188 */
miruga27 0:dda4f4550403 189 typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
miruga27 0:dda4f4550403 190
miruga27 0:dda4f4550403 191 /**
miruga27 0:dda4f4550403 192 * \brief Get the current log output function.
miruga27 0:dda4f4550403 193 */
miruga27 0:dda4f4550403 194 extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
miruga27 0:dda4f4550403 195
miruga27 0:dda4f4550403 196 /**
miruga27 0:dda4f4550403 197 * \brief This function allows you to replace the default log output
miruga27 0:dda4f4550403 198 * function with one of your own.
miruga27 0:dda4f4550403 199 */
miruga27 0:dda4f4550403 200 extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
miruga27 0:dda4f4550403 201
miruga27 0:dda4f4550403 202
miruga27 0:dda4f4550403 203 /* Ends C function definitions when using C++ */
miruga27 0:dda4f4550403 204 #ifdef __cplusplus
miruga27 0:dda4f4550403 205 }
miruga27 0:dda4f4550403 206 #endif
miruga27 0:dda4f4550403 207 #include "close_code.h"
miruga27 0:dda4f4550403 208
miruga27 0:dda4f4550403 209 #endif /* _SDL_log_h */
miruga27 0:dda4f4550403 210
miruga27 0:dda4f4550403 211 /* vi: set ts=4 sw=4 expandtab: */