1 // TetiSoft: replaced vprintf() with KVPrintF() and commented out exit()
2 extern void __stdargs KVPrintF( const char *formatString, const void *values );
4 /***************************************************************************/
8 /* Debugging and logging component (body). */
10 /* Copyright 1996-2001 by */
11 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
13 /* This file is part of the FreeType project, and may only be used, */
14 /* modified, and distributed under the terms of the FreeType project */
15 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
16 /* this file you indicate that you have read the license and */
17 /* understand and accept it fully. */
19 /***************************************************************************/
22 /*************************************************************************/
24 /* This component contains various macros and functions used to ease the */
25 /* debugging of the FreeType engine. Its main purpose is in assertion */
26 /* checking, tracing, and error detection. */
28 /* There are now three debugging modes: */
32 /* Error and trace messages are sent to the log file (which can be the */
33 /* standard error output). */
37 /* Only error messages are generated. */
41 /* No error message is sent or generated. The code is free from any */
42 /* debugging parts. */
44 /*************************************************************************/
48 #include FT_INTERNAL_DEBUG_H
51 #ifdef FT_DEBUG_LEVEL_TRACE
52 char ft_trace_levels[trace_max];
56 #if defined( FT_DEBUG_LEVEL_ERROR ) || defined( FT_DEBUG_LEVEL_TRACE )
64 FT_Message( const char* fmt, ... )
70 // vprintf( fmt, ap );
77 FT_Panic( const char* fmt, ... )
83 // vprintf( fmt, ap );
87 // exit( EXIT_FAILURE );
92 /* since I don't know wether "getenv" is available on the Amiga */
93 /* I prefer to simply disable this code for now in all builds */
96 /* #ifdef FT_DEBUG_LEVEL_TRACE */
100 ft_debug_init( void )
102 const char* ft2_debug = getenv( "FT2_DEBUG" );
107 const char* p = ft2_debug;
113 /* skip leading whitespace and separators */
114 if ( *p == ' ' || *p == '\t' || *p == ',' || *p == ';' || *p == '=' )
117 /* read toggle name, followed by '=' */
119 while ( *p && *p != ':' )
122 if ( *p == ':' && p > q )
124 int n, i, len = p - q;
125 int level = -1, found = -1;
128 for ( n = 0; n < trace_count; n++ )
130 const char* toggle = ft_trace_toggles[n];
133 for ( i = 0; i < len; i++ )
135 if ( toggle[i] != q[i] )
139 if ( i == len && toggle[i] == 0 )
151 if ( level < 0 || level > 6 )
155 if ( found >= 0 && level >= 0 )
157 if ( found == trace_any )
159 /* special case for "any" */
160 for ( n = 0; n < trace_count; n++ )
161 ft_trace_levels[n] = level;
164 ft_trace_levels[found] = level;
172 #else /* !FT_DEBUG_LEVEL_TRACE */
176 ft_debug_init( void )
182 #endif /* !FT_DEBUG_LEVEL_TRACE */