freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] accessor for traces array


From: Masatake YAMATO
Subject: Re: [Devel] accessor for traces array
Date: Mon, 23 Feb 2004 20:31:52 +0900 (JST)

> > Currently, a program using FT2 cannot know what kind of traces are
> > existing. How do you think export the names of traces?  I'm using
> > the attached patch for exporting the names of traces from FT2.
> 
> This is a good idea!  Can you refine your patch a bit by providing
> documentation (in ftdebug.h) similar to other exported functions?
> 
> 
>     Werner

Here, it is!

2004-02-23  Masatake YAMATO  <address@hidden>

        * 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.

Index: src/base/ftdebug.c
===================================================================
RCS file: /cvsroot/freetype2/src/base/ftdebug.c,v
retrieving revision 1.24
diff -u -r1.24 ftdebug.c
--- ftdebug.c   2002/09/27 11:09:22     1.24
+++ ftdebug.c   2004/02/23 11:26:54
@@ -93,6 +93,21 @@
 
 #undef FT_TRACE_DEF
 
+  FT_EXPORT_DEF( int )
+  FT_Trace_Get_Count ( void )
+  {
+    return trace_count;
+  }
+
+  FT_EXPORT_DEF( const char * )
+  FT_Trace_Get_Name ( int index )
+  {
+    int max = FT_Trace_Get_Count ();
+    if ( index < max )
+      return ft_trace_toggles[ index ];
+    else
+      return NULL;
+  }
 
   /*************************************************************************/
   /*                                                                       */
@@ -189,6 +204,18 @@
   ft_debug_init( void )
   {
     /* nothing */
+  }
+
+  FT_EXPORT_DEF( FT_ULong )
+  FT_Trace_Get_Count ( void ) 
+  {
+    return 0; 
+  }
+
+  FT_EXPORT_DEF( const char * )
+  FT_Trace_Get_Name ( FT_ULong index ) 
+  { 
+    return NULL; 
   }
 
 #endif /* !FT_DEBUG_LEVEL_TRACE */
Index: include/freetype/internal/ftdebug.h
===================================================================
RCS file: /cvsroot/freetype2/include/freetype/internal/ftdebug.h,v
retrieving revision 1.33
diff -u -r1.33 ftdebug.h
--- ftdebug.h   2002/07/26 09:09:08     1.33
+++ ftdebug.h   2004/02/23 11:26:55
@@ -95,6 +95,47 @@
 
 #endif /* !FT_DEBUG_LEVEL_TRACE */
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Trace_Get_Count                                                 */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Returns the number of traces.                                      */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The number of traces. 0 if FreeType2 is not built with             */
+  /*    FT_DEBUG_LEVEL_TRACE definition.                                   */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This function may be useful if you want to access the element of   */
+  /*    @ft_trace_levels by an index.                                      */
+  /*                                                                       */
+  FT_EXPORT( int )
+  FT_Trace_Get_Count ( void );
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Trace_Get_Name                                                  */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Returns the name of a trace.                                       */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    The index of trace.                                                */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    The name of C string. It is statically allocated so do not free it */
+  /*   after using. Null if FreeType2 is not built with                   */
+  /*    FT_DEBUG_LEVEL_TRACE definition.                                   */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    To get the max of INDEX, use @FT_Trace_Get_Count.                  */
+  /*    This function may be useful if you want to add a control the       */
+  /*    FreeType2's debug level in your appliaciton.                       */
+  FT_EXPORT( const char * )
+  FT_Trace_Get_Name ( int index );
 
   /*************************************************************************/
   /*                                                                       */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]