| 
                Last change
                  on this file since 3609 was
                  3294,
                  checked in by bensch, 21 years ago
           | 
        
        
          | 
               
orxonox/branches/updater: merged debug.h from trunk, and just some doxy-tags added 
 
           | 
        
        | 
            File size:
            2.4 KB
           | 
      
      
        
  | Line |   | 
|---|
| 1 | #ifndef _DEBUG_H | 
|---|
| 2 | #define _DEBUG_H | 
|---|
| 3 |  | 
|---|
| 4 |  | 
|---|
| 5 | /////////////////////////////////////////////////// | 
|---|
| 6 | /// PRINTF: prints with filename and linenumber /// | 
|---|
| 7 | /////////////////////////////////////////////////// | 
|---|
| 8 |  | 
|---|
| 9 | #ifdef  DEBUG | 
|---|
| 10 | #define PRINTF(x) \ | 
|---|
| 11 |            PRINTF ## x | 
|---|
| 12 |  | 
|---|
| 13 | #if DEBUG >= 1 | 
|---|
| 14 | #define PRINTF1 \ | 
|---|
| 15 |     if (verbose >= 1 ) \ | 
|---|
| 16 |       printf("%s:%d::", __FILE__, __LINE__) && printf | 
|---|
| 17 | #else  | 
|---|
| 18 | #define PRINTF1 // | 
|---|
| 19 | #endif | 
|---|
| 20 |       | 
|---|
| 21 | #if DEBUG >= 2 | 
|---|
| 22 | #define PRINTF2 \ | 
|---|
| 23 |      if (verbose >= 2 ) \ | 
|---|
| 24 |        printf("%s:%d::", __FILE__, __LINE__) && printf | 
|---|
| 25 |           | 
|---|
| 26 | #else  | 
|---|
| 27 | #define PRINTF2 // | 
|---|
| 28 | #endif | 
|---|
| 29 |       | 
|---|
| 30 | #if DEBUG >= 3 | 
|---|
| 31 | #define PRINTF3 \ | 
|---|
| 32 |      if (verbose >= 3 ) \ | 
|---|
| 33 |        printf("%s:%d::", __FILE__, __LINE__) && printf | 
|---|
| 34 | #else  | 
|---|
| 35 | #define PRINTF3 // | 
|---|
| 36 | #endif | 
|---|
| 37 |       | 
|---|
| 38 | #if DEBUG >= 4 | 
|---|
| 39 | #define PRINTF4 \ | 
|---|
| 40 |      if (verbose >= 4 ) \ | 
|---|
| 41 |        printf("%s:%d::", __FILE__, __LINE__) && printf | 
|---|
| 42 | #else  | 
|---|
| 43 | #define PRINTF4 // | 
|---|
| 44 | #endif | 
|---|
| 45 |       | 
|---|
| 46 |       | 
|---|
| 47 | #else   | 
|---|
| 48 | #define PRINTF(x) // | 
|---|
| 49 | #endif | 
|---|
| 50 |  | 
|---|
| 51 | #define PRINTF0 \ | 
|---|
| 52 |     printf("%s:%d::", __FILE__, __LINE__) && printf | 
|---|
| 53 |  | 
|---|
| 54 |  | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | /////////////////////////////////////////////////// | 
|---|
| 58 | ///  PRINT: just prints output as is            /// | 
|---|
| 59 | /////////////////////////////////////////////////// | 
|---|
| 60 |  | 
|---|
| 61 | #ifdef  DEBUG | 
|---|
| 62 | #define PRINT(x) \ | 
|---|
| 63 |            PRINT ## x | 
|---|
| 64 |  | 
|---|
| 65 | #if DEBUG >= 1 | 
|---|
| 66 | #define PRINT1 \ | 
|---|
| 67 |     if (verbose >= 1 ) \ | 
|---|
| 68 |       printf | 
|---|
| 69 | #else  | 
|---|
| 70 | #define PRINT1 // | 
|---|
| 71 | #endif | 
|---|
| 72 |       | 
|---|
| 73 | #if DEBUG >= 2 | 
|---|
| 74 | #define PRINT2 \ | 
|---|
| 75 |      if (verbose >= 2 ) \ | 
|---|
| 76 |        printf | 
|---|
| 77 |  | 
|---|
| 78 | #else  | 
|---|
| 79 | #define PRINT2 // | 
|---|
| 80 | #endif | 
|---|
| 81 |       | 
|---|
| 82 | #if DEBUG >= 3 | 
|---|
| 83 | #define PRINT3 \ | 
|---|
| 84 |      if (verbose >= 3 ) \ | 
|---|
| 85 |        printf | 
|---|
| 86 | #else | 
|---|
| 87 | #define PRINT3 // | 
|---|
| 88 | #endif | 
|---|
| 89 |       | 
|---|
| 90 | #if DEBUG >= 4 | 
|---|
| 91 | #define PRINT4 \ | 
|---|
| 92 |      if (verbose >= 4 ) \ | 
|---|
| 93 |        printf | 
|---|
| 94 | #else  | 
|---|
| 95 | #define PRINT4 // | 
|---|
| 96 | #endif | 
|---|
| 97 |       | 
|---|
| 98 |       | 
|---|
| 99 | #else   | 
|---|
| 100 | #define PRINT(x) // | 
|---|
| 101 | #endif | 
|---|
| 102 |  | 
|---|
| 103 | #define PRINT0 \ | 
|---|
| 104 |            printf | 
|---|
| 105 |  | 
|---|
| 106 |  | 
|---|
| 107 | /////////////////////////////////////////////////// | 
|---|
| 108 | /// COUT: simple cout print with verbose-check  /// | 
|---|
| 109 | /////////////////////////////////////////////////// | 
|---|
| 110 | #ifdef  DEBUG | 
|---|
| 111 | #define COUT(x) \ | 
|---|
| 112 |            COUT ## x | 
|---|
| 113 |  | 
|---|
| 114 | #if DEBUG >= 1 | 
|---|
| 115 | #define COUT1 \ | 
|---|
| 116 |     if (verbose >= 1 ) \ | 
|---|
| 117 |       cout | 
|---|
| 118 | #else  | 
|---|
| 119 | #define COUT1 // | 
|---|
| 120 | #endif | 
|---|
| 121 |       | 
|---|
| 122 | #if DEBUG >= 2 | 
|---|
| 123 | #define COUT2 \ | 
|---|
| 124 |      if (verbose >= 2 ) \ | 
|---|
| 125 |        cout | 
|---|
| 126 |  | 
|---|
| 127 | #else  | 
|---|
| 128 | #define COUT2 // | 
|---|
| 129 | #endif | 
|---|
| 130 |       | 
|---|
| 131 | #if DEBUG >= 3 | 
|---|
| 132 | #define COUT3 \ | 
|---|
| 133 |      if (verbose >= 3 ) \ | 
|---|
| 134 |        cout | 
|---|
| 135 | #else | 
|---|
| 136 | #define COUT3 // | 
|---|
| 137 | #endif | 
|---|
| 138 |       | 
|---|
| 139 | #if DEBUG >= 4 | 
|---|
| 140 | #define COUT4 \ | 
|---|
| 141 |      if (verbose >= 4 ) \ | 
|---|
| 142 |        cout | 
|---|
| 143 | #else  | 
|---|
| 144 | #define COUT4 // | 
|---|
| 145 | #endif | 
|---|
| 146 |       | 
|---|
| 147 |       | 
|---|
| 148 | #else   | 
|---|
| 149 | #define COUT(x) // | 
|---|
| 150 | #endif | 
|---|
| 151 |  | 
|---|
| 152 | #define COUT0 \ | 
|---|
| 153 |            cout | 
|---|
| 154 |  | 
|---|
| 155 | #endif /* _DEBUG_H */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.