| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ftdebug.c */ | 3 /* ftdebug.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* Debugging and logging component (body). */ | 5 /* Debugging and logging component (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2001, 2002, 2004, 2008 by */ | 7 /* Copyright 1996-2001, 2002, 2004, 2008, 2013 by */ |
| 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
| 11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
| 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
| 14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
| 15 /* */ | 15 /* */ |
| 16 /***************************************************************************/ | 16 /***************************************************************************/ |
| 17 | 17 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 44 #include <ft2build.h> | 44 #include <ft2build.h> |
| 45 #include FT_FREETYPE_H | 45 #include FT_FREETYPE_H |
| 46 #include FT_INTERNAL_DEBUG_H | 46 #include FT_INTERNAL_DEBUG_H |
| 47 | 47 |
| 48 | 48 |
| 49 #ifdef FT_DEBUG_LEVEL_ERROR | 49 #ifdef FT_DEBUG_LEVEL_ERROR |
| 50 | 50 |
| 51 /* documentation is in ftdebug.h */ | 51 /* documentation is in ftdebug.h */ |
| 52 | 52 |
| 53 FT_BASE_DEF( void ) | 53 FT_BASE_DEF( void ) |
| 54 FT_Message( const char* fmt, ... ) | 54 FT_Message( const char* fmt, |
| 55 ... ) |
| 55 { | 56 { |
| 56 va_list ap; | 57 va_list ap; |
| 57 | 58 |
| 58 | 59 |
| 59 va_start( ap, fmt ); | 60 va_start( ap, fmt ); |
| 60 vfprintf( stderr, fmt, ap ); | 61 vfprintf( stderr, fmt, ap ); |
| 61 va_end( ap ); | 62 va_end( ap ); |
| 62 } | 63 } |
| 63 | 64 |
| 64 | 65 |
| 65 /* documentation is in ftdebug.h */ | 66 /* documentation is in ftdebug.h */ |
| 66 | 67 |
| 67 FT_BASE_DEF( void ) | 68 FT_BASE_DEF( void ) |
| 68 FT_Panic( const char* fmt, ... ) | 69 FT_Panic( const char* fmt, |
| 70 ... ) |
| 69 { | 71 { |
| 70 va_list ap; | 72 va_list ap; |
| 71 | 73 |
| 72 | 74 |
| 73 va_start( ap, fmt ); | 75 va_start( ap, fmt ); |
| 74 vfprintf( stderr, fmt, ap ); | 76 vfprintf( stderr, fmt, ap ); |
| 75 va_end( ap ); | 77 va_end( ap ); |
| 76 | 78 |
| 77 exit( EXIT_FAILURE ); | 79 exit( EXIT_FAILURE ); |
| 78 } | 80 } |
| 79 | 81 |
| 82 |
| 83 /* documentation is in ftdebug.h */ |
| 84 |
| 85 FT_BASE_DEF( int ) |
| 86 FT_Throw( FT_Error error, |
| 87 int line, |
| 88 const char* file ) |
| 89 { |
| 90 FT_UNUSED( error ); |
| 91 FT_UNUSED( line ); |
| 92 FT_UNUSED( file ); |
| 93 |
| 94 return 0; |
| 95 } |
| 96 |
| 80 #endif /* FT_DEBUG_LEVEL_ERROR */ | 97 #endif /* FT_DEBUG_LEVEL_ERROR */ |
| 81 | 98 |
| 82 | 99 |
| 83 | 100 |
| 84 #ifdef FT_DEBUG_LEVEL_TRACE | 101 #ifdef FT_DEBUG_LEVEL_TRACE |
| 85 | 102 |
| 86 /* array of trace levels, initialized to 0 */ | 103 /* array of trace levels, initialized to 0 */ |
| 87 int ft_trace_levels[trace_count]; | 104 int ft_trace_levels[trace_count]; |
| 88 | 105 |
| 89 | 106 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 { | 174 { |
| 158 /* skip leading whitespace and separators */ | 175 /* skip leading whitespace and separators */ |
| 159 if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' ) | 176 if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' ) |
| 160 continue; | 177 continue; |
| 161 | 178 |
| 162 /* read toggle name, followed by ':' */ | 179 /* read toggle name, followed by ':' */ |
| 163 q = p; | 180 q = p; |
| 164 while ( *p && *p != ':' ) | 181 while ( *p && *p != ':' ) |
| 165 p++; | 182 p++; |
| 166 | 183 |
| 184 if ( !*p ) |
| 185 break; |
| 186 |
| 167 if ( *p == ':' && p > q ) | 187 if ( *p == ':' && p > q ) |
| 168 { | 188 { |
| 169 FT_Int n, i, len = (FT_Int)( p - q ); | 189 FT_Int n, i, len = (FT_Int)( p - q ); |
| 170 FT_Int level = -1, found = -1; | 190 FT_Int level = -1, found = -1; |
| 171 | 191 |
| 172 | 192 |
| 173 for ( n = 0; n < trace_count; n++ ) | 193 for ( n = 0; n < trace_count; n++ ) |
| 174 { | 194 { |
| 175 const char* toggle = ft_trace_toggles[n]; | 195 const char* toggle = ft_trace_toggles[n]; |
| 176 | 196 |
| 177 | 197 |
| 178 for ( i = 0; i < len; i++ ) | 198 for ( i = 0; i < len; i++ ) |
| 179 { | 199 { |
| 180 if ( toggle[i] != q[i] ) | 200 if ( toggle[i] != q[i] ) |
| 181 break; | 201 break; |
| 182 } | 202 } |
| 183 | 203 |
| 184 if ( i == len && toggle[i] == 0 ) | 204 if ( i == len && toggle[i] == 0 ) |
| 185 { | 205 { |
| 186 found = n; | 206 found = n; |
| 187 break; | 207 break; |
| 188 } | 208 } |
| 189 } | 209 } |
| 190 | 210 |
| 191 /* read level */ | 211 /* read level */ |
| 192 p++; | 212 p++; |
| 193 if ( *p ) | 213 if ( *p ) |
| 194 { | 214 { |
| 195 level = *p++ - '0'; | 215 level = *p - '0'; |
| 196 if ( level < 0 || level > 7 ) | 216 if ( level < 0 || level > 7 ) |
| 197 level = -1; | 217 level = -1; |
| 198 } | 218 } |
| 199 | 219 |
| 200 if ( found >= 0 && level >= 0 ) | 220 if ( found >= 0 && level >= 0 ) |
| 201 { | 221 { |
| 202 if ( found == trace_any ) | 222 if ( found == trace_any ) |
| 203 { | 223 { |
| 204 /* special case for `any' */ | 224 /* special case for `any' */ |
| 205 for ( n = 0; n < trace_count; n++ ) | 225 for ( n = 0; n < trace_count; n++ ) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 FT_UNUSED( idx ); | 257 FT_UNUSED( idx ); |
| 238 | 258 |
| 239 return NULL; | 259 return NULL; |
| 240 } | 260 } |
| 241 | 261 |
| 242 | 262 |
| 243 #endif /* !FT_DEBUG_LEVEL_TRACE */ | 263 #endif /* !FT_DEBUG_LEVEL_TRACE */ |
| 244 | 264 |
| 245 | 265 |
| 246 /* END */ | 266 /* END */ |
| OLD | NEW |