]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/base/ftdebug.c
Removed a bunch of unreachable BREAK statements that BCC compilation complains about.
[wxWidgets.git] / src / freetype / base / ftdebug.c
1 /***************************************************************************/
2 /* */
3 /* ftdebug.c */
4 /* */
5 /* Debugging and logging component (body). */
6 /* */
7 /* Copyright 1996-2000 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
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 */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17
18
19 /*************************************************************************/
20 /* */
21 /* This component contains various macros and functions used to ease the */
22 /* debugging of the FreeType engine. Its main purpose is in assertion */
23 /* checking, tracing, and error detection. */
24 /* */
25 /* There are now three debugging modes: */
26 /* */
27 /* - trace mode */
28 /* */
29 /* Error and trace messages are sent to the log file (which can be the */
30 /* standard error output). */
31 /* */
32 /* - error mode */
33 /* */
34 /* Only error messages are generated. */
35 /* */
36 /* - release mode: */
37 /* */
38 /* No error message is sent or generated. The code is free from any */
39 /* debugging parts. */
40 /* */
41 /*************************************************************************/
42
43
44 #include <freetype/internal/ftdebug.h>
45
46 #ifdef FT_DEBUG_LEVEL_TRACE
47 char ft_trace_levels[trace_max];
48 #endif
49
50
51 #if defined( FT_DEBUG_LEVEL_ERROR ) || defined( FT_DEBUG_LEVEL_TRACE )
52
53
54 #include <stdarg.h>
55 #include <stdlib.h>
56 #include <string.h>
57
58
59 FT_EXPORT_FUNC( void ) FT_Message( const char* fmt, ... )
60 {
61 va_list ap;
62
63
64 va_start( ap, fmt );
65 vprintf( fmt, ap );
66 va_end( ap );
67 }
68
69
70 FT_EXPORT_FUNC( void ) FT_Panic( const char* fmt, ... )
71 {
72 va_list ap;
73
74
75 va_start( ap, fmt );
76 vprintf( fmt, ap );
77 va_end( ap );
78
79 exit( EXIT_FAILURE );
80 }
81
82
83 #ifdef FT_DEBUG_LEVEL_TRACE
84
85
86 /*************************************************************************/
87 /* */
88 /* <Function> */
89 /* FT_SetTraceLevel */
90 /* */
91 /* <Description> */
92 /* Sets the trace level for debugging. */
93 /* */
94 /* <Input> */
95 /* component :: The component which should be traced. See ftdebug.h */
96 /* for a complete list. If set to `trace_any', all */
97 /* components will be traced. */
98 /* level :: The tracing level. */
99 /* */
100 FT_EXPORT_FUNC( void ) FT_SetTraceLevel( FT_Trace component,
101 char level )
102 {
103 if ( component >= trace_max )
104 return;
105
106 /* if component is `trace_any', change _all_ levels at once */
107 if ( component == trace_any )
108 {
109 int n;
110
111
112 for ( n = trace_any; n < trace_max; n++ )
113 ft_trace_levels[n] = level;
114 }
115 else /* otherwise, only change individual component */
116 ft_trace_levels[component] = level;
117 }
118
119 #endif /* FT_DEBUG_LEVEL_TRACE */
120
121 #endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
122
123
124 /* END */