The BIG graph update
[rrdtool.git] / libraries / freetype-2.0.5 / ftdebug.c
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftdebug.c                                                              */
4 /*                                                                         */
5 /*    Debugging and logging component (body).                              */
6 /*                                                                         */
7 /*  Copyright 1996-2001 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 <ft2build.h>
45 #include FT_INTERNAL_DEBUG_H
46
47
48 #ifdef FT_DEBUG_LEVEL_TRACE
49   char  ft_trace_levels[trace_max];
50 #endif
51
52
53 #if defined( FT_DEBUG_LEVEL_ERROR ) || defined( FT_DEBUG_LEVEL_TRACE )
54
55
56 #include <stdarg.h>
57 #include <stdlib.h>
58 #include <string.h>
59
60
61   FT_EXPORT_DEF( void )
62   FT_Message( const char*  fmt, ... )
63   {
64     va_list  ap;
65
66
67     va_start( ap, fmt );
68     vprintf( fmt, ap );
69     va_end( ap );
70   }
71
72
73   FT_EXPORT_DEF( void )
74   FT_Panic( const char*  fmt, ... )
75   {
76     va_list  ap;
77
78
79     va_start( ap, fmt );
80     vprintf( fmt, ap );
81     va_end( ap );
82
83     exit( EXIT_FAILURE );
84   }
85
86
87 #ifdef FT_DEBUG_LEVEL_TRACE
88
89   FT_EXPORT_DEF( void )
90   FT_SetTraceLevel( FT_Trace  component,
91                     char      level )
92   {
93     if ( component >= trace_max )
94       return;
95
96     /* if component is `trace_any', change _all_ levels at once */
97     if ( component == trace_any )
98     {
99       int  n;
100
101
102       for ( n = trace_any; n < trace_max; n++ )
103         ft_trace_levels[n] = level;
104     }
105     else        /* otherwise, only change individual component */
106       ft_trace_levels[component] = level;
107   }
108
109 #endif /* FT_DEBUG_LEVEL_TRACE */
110
111 #endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
112
113
114   /* ANSI C doesn't allow empty files, so we insert a dummy symbol */
115   extern const int  ft_debug_dummy;
116
117
118 /* END */