[4608] | 1 | /* |
---|
[3395] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Benjamin Grauer |
---|
| 13 | co-programmer: ... |
---|
| 14 | */ |
---|
| 15 | |
---|
[4608] | 16 | /*! |
---|
[3395] | 17 | \file debug.h |
---|
[4836] | 18 | * Handles output to console for different Verbose-Modes. |
---|
[3601] | 19 | |
---|
| 20 | There are two main modes HARD and SOFT. HARD is precessed during compileTime where SOFT is for runtime. |
---|
[4608] | 21 | \li HARD: One can choose between different modes. see: // DEFINE_MODULES |
---|
[3601] | 22 | \li SOFT: If you want each module can have its own variable for processing. just pass it to DEBUG_MODULE_SOFT |
---|
[4608] | 23 | */ |
---|
[3395] | 24 | |
---|
[3204] | 25 | #ifndef _DEBUG_H |
---|
| 26 | #define _DEBUG_H |
---|
| 27 | |
---|
[3863] | 28 | #include "confincl.h" |
---|
[3590] | 29 | |
---|
| 30 | #include <stdio.h> |
---|
| 31 | |
---|
| 32 | // DEFINE ERROR MODES |
---|
[3395] | 33 | #define NO 0 |
---|
[3480] | 34 | #define ERR 1 |
---|
| 35 | #define WARN 2 |
---|
| 36 | #define INFO 3 |
---|
[4608] | 37 | //#define DEBUG 4 |
---|
[4373] | 38 | #define vDEBUG 5 |
---|
[3293] | 39 | |
---|
[3592] | 40 | extern int verbose; |
---|
| 41 | |
---|
[3601] | 42 | //definitions |
---|
[3592] | 43 | #ifndef MODULAR_DEBUG |
---|
| 44 | #define HARD_DEBUG_LEVEL DEBUG |
---|
[3601] | 45 | #define SOFT_DEBUG_LEVEL verbose |
---|
[3592] | 46 | #else /* MODULAR_DEBUG */ |
---|
[4608] | 47 | #ifndef DEBUG_MODULE_SOFT |
---|
[3601] | 48 | #define SOFT_DEBUG_LEVEL verbose |
---|
| 49 | #else /* DEBUG_MODULE_SOFT */ |
---|
| 50 | #define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT |
---|
| 51 | #endif /* DEBUG_MODULE_SOFT */ |
---|
| 52 | |
---|
[3590] | 53 | #ifndef DEBUG_SPECIAL_MODULE |
---|
[3592] | 54 | #define HARD_DEBUG_LEVEL DEBUG |
---|
| 55 | #else /* DEBUG_SPECIAL_MODULE */ |
---|
[3863] | 56 | // DEFINE MODULES |
---|
[3655] | 57 | #define DEBUG_MODULE_ORXONOX 0 |
---|
[4287] | 58 | #define DEBUG_MODULE_WORLD 0 |
---|
| 59 | #define DEBUG_MODULE_PNODE 0 |
---|
[3655] | 60 | #define DEBUG_MODULE_WORLD_ENTITY 0 |
---|
[4287] | 61 | #define DEBUG_MODULE_COMMAND_NODE 0 |
---|
[3655] | 62 | #define DEBUG_MODULE_GRAPHICS 0 |
---|
[4094] | 63 | #define DEBUG_MODULE_LOAD 2 |
---|
[3591] | 64 | |
---|
[4287] | 65 | #define DEBUG_MODULE_IMPORTER 0 |
---|
[4620] | 66 | #define DEBUG_MODULE_TRACK_MANAGER 2 |
---|
[3688] | 67 | #define DEBUG_MODULE_GARBAGE_COLLECTOR 0 |
---|
[4932] | 68 | #define DEBUG_MODULE_OBJECT_MANAGER 2 |
---|
[3655] | 69 | #define DEBUG_MODULE_LIGHT 0 |
---|
[3752] | 70 | #define DEBUG_MODULE_PLAYER 1 |
---|
[4885] | 71 | #define DEBUG_MODULE_WEAPON 4 |
---|
[3655] | 72 | #define DEBUG_MODULE_MATH 0 |
---|
[3875] | 73 | #define DEBUG_MODULE_FONT 1 |
---|
| 74 | #define DEBUG_MODULE_ANIM 1 |
---|
[4287] | 75 | #define DEBUG_MODULE_PARTICLE 1 |
---|
[4381] | 76 | #define DEBUG_MODULE_PHYSICS 1 |
---|
[4354] | 77 | #define DEBUG_MODULE_EVENT 3 |
---|
[3439] | 78 | |
---|
[3655] | 79 | #define DEBUG_MODULE_NULL_PARENT 0 |
---|
[4471] | 80 | #define DEBUG_MODULE_NETWORK 0 |
---|
[3591] | 81 | |
---|
[4808] | 82 | #define DEBUG_MODULE_COLLISON_DETECTION 0 |
---|
[4852] | 83 | #define DEBUG_MODULE_SPATIAL_SEPARATION 3 |
---|
[3395] | 84 | |
---|
[3592] | 85 | #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE |
---|
| 86 | #endif /* DEBUG_SPECIAL_MODULE */ |
---|
| 87 | #endif /* MODULAR_DEBUG */ |
---|
[4373] | 88 | |
---|
[3293] | 89 | /////////////////////////////////////////////////// |
---|
| 90 | /// PRINTF: prints with filename and linenumber /// |
---|
| 91 | /////////////////////////////////////////////////// |
---|
[4373] | 92 | #define PRINTFNO PRINTF0 |
---|
| 93 | #define PRINTFERR PRINTF1 |
---|
| 94 | #define PRINTFWARN PRINTF2 |
---|
| 95 | #define PRINTFINFO PRINTF3 |
---|
| 96 | #define PRINTFDEBUG PRINTF4 |
---|
| 97 | #define PRINTFVDEBUG PRINTF5 |
---|
[3293] | 98 | |
---|
[3433] | 99 | #ifdef DEBUG |
---|
[3590] | 100 | |
---|
[3205] | 101 | #define PRINTF(x) \ |
---|
| 102 | PRINTF ## x |
---|
| 103 | |
---|
[3592] | 104 | #if HARD_DEBUG_LEVEL >= ERR |
---|
[3205] | 105 | #define PRINTF1 \ |
---|
[3601] | 106 | if (SOFT_DEBUG_LEVEL >= ERR) \ |
---|
[3511] | 107 | printf("ERROR::%s:%d:", __FILE__, __LINE__) && printf |
---|
[4608] | 108 | #else |
---|
[3395] | 109 | #define PRINTF1 if (NO) |
---|
[3205] | 110 | #endif |
---|
[4608] | 111 | |
---|
[3592] | 112 | #if HARD_DEBUG_LEVEL >= WARN |
---|
[3205] | 113 | #define PRINTF2 \ |
---|
[3601] | 114 | if (SOFT_DEBUG_LEVEL >= WARN) \ |
---|
[3511] | 115 | printf("WARNING::%s:%d:", __FILE__, __LINE__) && printf |
---|
[4608] | 116 | |
---|
| 117 | #else |
---|
[3395] | 118 | #define PRINTF2 if (NO) |
---|
[3205] | 119 | #endif |
---|
[4608] | 120 | |
---|
[3592] | 121 | #if HARD_DEBUG_LEVEL >= INFO |
---|
[3205] | 122 | #define PRINTF3 \ |
---|
[3601] | 123 | if (SOFT_DEBUG_LEVEL >= INFO) \ |
---|
[3511] | 124 | printf("INFO::%s:%d:", __FILE__, __LINE__) && printf |
---|
[4608] | 125 | #else |
---|
[3395] | 126 | #define PRINTF3 if (NO) |
---|
[3205] | 127 | #endif |
---|
[4608] | 128 | |
---|
[4373] | 129 | #if HARD_DEBUG_LEVEL >= DEBUG |
---|
[3205] | 130 | #define PRINTF4 \ |
---|
[4373] | 131 | if (SOFT_DEBUG_LEVEL >= DEBUG) \ |
---|
[3511] | 132 | printf("DEBUG::%s:%d:", __FILE__, __LINE__) && printf |
---|
[4608] | 133 | #else |
---|
[3395] | 134 | #define PRINTF4 if (NO) |
---|
[3205] | 135 | #endif |
---|
[4608] | 136 | |
---|
[4373] | 137 | #if HARD_DEBUG_LEVEL >= vDEBUG |
---|
[3548] | 138 | #define PRINTF5 \ |
---|
[4373] | 139 | if (SOFT_DEBUG_LEVEL >= vDEBUG) \ |
---|
[3548] | 140 | printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf |
---|
[4608] | 141 | #else |
---|
[3548] | 142 | #define PRINTF5 if (NO) |
---|
| 143 | #endif |
---|
[4608] | 144 | |
---|
| 145 | #else |
---|
[3395] | 146 | #define PRINTF(x) if (NO) |
---|
[3204] | 147 | #endif |
---|
| 148 | |
---|
[3206] | 149 | #define PRINTF0 \ |
---|
[3212] | 150 | printf("%s:%d::", __FILE__, __LINE__) && printf |
---|
[3204] | 151 | |
---|
[3293] | 152 | |
---|
| 153 | /////////////////////////////////////////////////// |
---|
| 154 | /// PRINT: just prints output as is /// |
---|
| 155 | /////////////////////////////////////////////////// |
---|
[4373] | 156 | #define PRINTNO PRINT0 |
---|
| 157 | #define PRINTERR PRINT1 |
---|
| 158 | #define PRINTWARN PRINT2 |
---|
| 159 | #define PRINTINFO PRINT3 |
---|
| 160 | #define PRINTDEBUG PRINT4 |
---|
| 161 | #define PRINTVDEBUG PRINT5 |
---|
| 162 | |
---|
[3293] | 163 | #ifdef DEBUG |
---|
| 164 | #define PRINT(x) \ |
---|
[3395] | 165 | PRINT ## x |
---|
[3293] | 166 | |
---|
[3592] | 167 | #if HARD_DEBUG_LEVEL >= ERR |
---|
[4608] | 168 | #define PRINT1 \ |
---|
| 169 | if (SOFT_DEBUG_LEVEL >= ERR) \ |
---|
[3395] | 170 | printf |
---|
[4608] | 171 | #else |
---|
[3395] | 172 | #define PRINT1 if (NO) |
---|
[3293] | 173 | #endif |
---|
[3395] | 174 | |
---|
[3592] | 175 | #if HARD_DEBUG_LEVEL >= WARN |
---|
[3293] | 176 | #define PRINT2 \ |
---|
[3601] | 177 | if (SOFT_DEBUG_LEVEL >= WARN) \ |
---|
[3395] | 178 | printf |
---|
[3293] | 179 | |
---|
[4608] | 180 | #else |
---|
[3395] | 181 | #define PRINT2 if (NO) |
---|
[3293] | 182 | #endif |
---|
[3395] | 183 | |
---|
[3592] | 184 | #if HARD_DEBUG_LEVEL >= INFO |
---|
[3293] | 185 | #define PRINT3 \ |
---|
[3601] | 186 | if (SOFT_DEBUG_LEVEL >= INFO) \ |
---|
[3395] | 187 | printf |
---|
[4608] | 188 | #else |
---|
[3395] | 189 | #define PRINT3 if (NO) |
---|
[3293] | 190 | #endif |
---|
[3395] | 191 | |
---|
[4373] | 192 | #if HARD_DEBUG_LEVEL >= DEBUG |
---|
[3293] | 193 | #define PRINT4 \ |
---|
[4373] | 194 | if (SOFT_DEBUG_LEVEL >= DEBUG) \ |
---|
[3395] | 195 | printf |
---|
[4608] | 196 | #else |
---|
[3395] | 197 | #define PRINT4 if (NO) |
---|
[3293] | 198 | #endif |
---|
[3395] | 199 | |
---|
[4373] | 200 | #if HARD_DEBUG_LEVEL >= vDEBUG |
---|
[3548] | 201 | #define PRINT5 \ |
---|
[4373] | 202 | if (SOFT_DEBUG_LEVEL >= vDEBUG) \ |
---|
[3548] | 203 | printf("VERYDEBUG::%s:%d:", __FILE__, __LINE__) && printf |
---|
[4608] | 204 | #else |
---|
[3548] | 205 | #define PRINT5 if (NO) |
---|
| 206 | #endif |
---|
[3395] | 207 | |
---|
[3548] | 208 | |
---|
[4608] | 209 | #else |
---|
[3395] | 210 | #define PRINT(x) if (NO) |
---|
[3293] | 211 | #endif |
---|
| 212 | |
---|
| 213 | #define PRINT0 \ |
---|
[3395] | 214 | printf |
---|
[3293] | 215 | |
---|
[3204] | 216 | #endif /* _DEBUG_H */ |
---|