* docs/CHANGES: Updated.

* include/freetype/internal/ftdebug.h: Include FT_FREETYPE_H.


Provide a simple API to control FreeType's tracing levels.

* include/freetype/internal/ftdebug.h (FT_Trace_Get_Count,
FT_Trace_Get_Name): New declarations.

* src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name): New
functions.
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index 48a2143..d8ccd80 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Debugging and logging component (body).                              */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  Copyright 1996-2001, 2002, 2004 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -82,8 +82,9 @@
   /* array of trace levels, initialized to 0 */
   int  ft_trace_levels[trace_count];
 
+
   /* define array of trace toggle names */
-#define FT_TRACE_DEF(x)  #x ,
+#define FT_TRACE_DEF( x )  #x ,
 
   static const char*  ft_trace_toggles[trace_count + 1] =
   {
@@ -94,19 +95,43 @@
 #undef FT_TRACE_DEF
 
 
+  /* documentation is in ftdebug.h */
+
+  FT_EXPORT_DEF( FT_Int )
+  FT_Trace_Get_Count( void )
+  {
+    return trace_count;
+  }
+
+
+  /* documentation is in ftdebug.h */
+
+  FT_EXPORT_DEF( const char * )
+  FT_Trace_Get_Name( FT_Int  index )
+  {
+    int  max = FT_Trace_Get_Count();
+
+
+    if ( index < max )
+      return ft_trace_toggles[index];
+    else
+      return NULL;
+  }
+
+
   /*************************************************************************/
   /*                                                                       */
   /* Initialize the tracing sub-system.  This is done by retrieving the    */
-  /* value of the "FT2_DEBUG" environment variable.  It must be a list of  */
-  /* toggles, separated by spaces, `;' or `,'.  Example:                   */
+  /* value of the `FT2_DEBUG' environment variable.  It must be a list of  */
+  /* toggles, separated by spaces, `;', or `,'.  Example:                  */
   /*                                                                       */
-  /*    "any:3 memory:6 stream:5"                                          */
+  /*    export FT2_DEBUG="any:3 memory:6 stream:5"                         */
   /*                                                                       */
-  /* This will request that all levels be set to 3, except the trace level */
-  /* for the memory and stream components which are set to 6 and 5,        */
+  /* This requests that all levels be set to 3, except the trace level for */
+  /* the memory and stream components which are set to 6 and 5,            */
   /* respectively.                                                         */
   /*                                                                       */
-  /* See the file <freetype/internal/fttrace.h> for details of the         */
+  /* See the file <include/freetype/internal/fttrace.h> for details of the */
   /* available toggle names.                                               */
   /*                                                                       */
   /* The level must be between 0 and 6; 0 means quiet (except for serious  */
@@ -117,6 +142,7 @@
   {
     const char*  ft2_debug = getenv( "FT2_DEBUG" );
 
+
     if ( ft2_debug )
     {
       const char*  p = ft2_debug;
@@ -136,7 +162,7 @@
           
         if ( *p == ':' && p > q )
         {
-          FT_Int  n, i, len = (FT_Int)(p - q);
+          FT_Int  n, i, len = (FT_Int)( p - q );
           FT_Int  level = -1, found = -1;
 
 
@@ -171,7 +197,7 @@
           {
             if ( found == trace_any )
             {
-              /* special case for "any" */
+              /* special case for `any' */
               for ( n = 0; n < trace_count; n++ )
                 ft_trace_levels[n] = level;
             }
@@ -183,14 +209,31 @@
     }
   }
 
+
 #else  /* !FT_DEBUG_LEVEL_TRACE */
 
+
   FT_BASE_DEF( void )
   ft_debug_init( void )
   {
     /* nothing */
   }
 
+
+  FT_EXPORT_DEF( FT_Int )
+  FT_Trace_Get_Count( void ) 
+  {
+    return 0; 
+  }
+
+
+  FT_EXPORT_DEF( const char * )
+  FT_Trace_Get_Name( FT_Int  index ) 
+  { 
+    return NULL; 
+  }
+
+
 #endif /* !FT_DEBUG_LEVEL_TRACE */