Add internal functions FT_Trace_Disable' and
FT_Trace_Enable'.
It sometimes makes sense to suppress tracing informations, for example, if it outputs identical messages again and again. * include/freetype/internal/ftdebug.h: Make `ft_trace_levels' a pointer. (FT_Trace_Disable, FT_Trace_Enable): New declarations. * src/base/ftdebug.c (ft_trace_levels): Rename to... (ft_trace_levels_enabled): ... this. (ft_trace_levels_disabled): New array. (ft_trace_levels): New pointer. (FT_Trace_Disable, FT_Trace_Enable): Implement. (ft_debug_init): Updated.
This commit is contained in:
parent
2e3dec5509
commit
c9bbc2419a
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2018-08-08 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Add internal functions `FT_Trace_Disable' and `FT_Trace_Enable'.
|
||||
|
||||
It sometimes makes sense to suppress tracing informations, for
|
||||
example, if it outputs identical messages again and again.
|
||||
|
||||
* include/freetype/internal/ftdebug.h: Make `ft_trace_levels' a
|
||||
pointer.
|
||||
(FT_Trace_Disable, FT_Trace_Enable): New declarations.
|
||||
|
||||
* src/base/ftdebug.c (ft_trace_levels): Rename to...
|
||||
(ft_trace_levels_enabled): ... this.
|
||||
(ft_trace_levels_disabled): New array.
|
||||
(ft_trace_levels): New pointer.
|
||||
(FT_Trace_Disable, FT_Trace_Enable): Implement.
|
||||
(ft_debug_init): Updated.
|
||||
|
||||
2018-08-08 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Debugging improvements.
|
||||
|
@ -62,8 +62,9 @@ FT_BEGIN_HEADER
|
||||
} FT_Trace;
|
||||
|
||||
|
||||
/* defining the array of trace levels, provided by `src/base/ftdebug.c' */
|
||||
extern int ft_trace_levels[trace_count];
|
||||
/* a pointer to the array of trace levels, */
|
||||
/* provided by `src/base/ftdebug.c' */
|
||||
extern int* ft_trace_levels;
|
||||
|
||||
#undef FT_TRACE_DEF
|
||||
|
||||
@ -111,7 +112,7 @@ FT_BEGIN_HEADER
|
||||
*
|
||||
* @note:
|
||||
* This function may be useful if you want to access elements of
|
||||
* the internal `ft_trace_levels' array by an index.
|
||||
* the internal trace levels array by an index.
|
||||
*/
|
||||
FT_BASE( FT_Int )
|
||||
FT_Trace_Get_Count( void );
|
||||
@ -130,20 +131,43 @@ FT_BEGIN_HEADER
|
||||
*
|
||||
* @return:
|
||||
* The name of the trace component. This is a statically allocated
|
||||
* C string, so do not free it after use. NULL if FreeType 2 is not
|
||||
* built with FT_DEBUG_LEVEL_TRACE definition.
|
||||
* C~string, so do not free it after use. NULL if FreeType is not built
|
||||
* with FT_DEBUG_LEVEL_TRACE definition.
|
||||
*
|
||||
* @note:
|
||||
* Use @FT_Trace_Get_Count to get the number of available trace
|
||||
* components.
|
||||
*
|
||||
* This function may be useful if you want to control FreeType 2's
|
||||
* debug level in your application.
|
||||
*/
|
||||
FT_BASE( const char* )
|
||||
FT_Trace_Get_Name( FT_Int idx );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @function:
|
||||
* FT_Trace_Disable
|
||||
*
|
||||
* @description:
|
||||
* Switch off tracing temporarily. It can be activated again with
|
||||
* @FT_Trace_Enable.
|
||||
*/
|
||||
FT_BASE( void )
|
||||
FT_Trace_Disable( void );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @function:
|
||||
* FT_Trace_Enable
|
||||
*
|
||||
* @description:
|
||||
* Activate tracing. Use it after tracing has been switched off with
|
||||
* @FT_Trace_Disable.
|
||||
*/
|
||||
FT_BASE( void )
|
||||
FT_Trace_Enable( void );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* You need two opening and closing parentheses!
|
||||
|
@ -100,9 +100,16 @@
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
/* array of trace levels, initialized to 0 */
|
||||
int ft_trace_levels[trace_count];
|
||||
/* array of trace levels, initialized to 0; */
|
||||
/* this gets adjusted at run-time */
|
||||
int ft_trace_levels_enabled[trace_count];
|
||||
|
||||
/* array of trace levels, always initialized to 0 */
|
||||
int ft_trace_levels_disabled[trace_count];
|
||||
|
||||
/* a pointer to either `ft_trace_levels_enabled' */
|
||||
/* or `ft_trace_levels_disabled' */
|
||||
int* ft_trace_levels;
|
||||
|
||||
/* define array of trace toggle names */
|
||||
#define FT_TRACE_DEF( x ) #x ,
|
||||
@ -140,6 +147,24 @@
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Trace_Disable( void )
|
||||
{
|
||||
ft_trace_levels = ft_trace_levels_disabled;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Trace_Enable( void )
|
||||
{
|
||||
ft_trace_levels = ft_trace_levels_enabled;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Initialize the tracing sub-system. This is done by retrieving the
|
||||
@ -223,14 +248,16 @@
|
||||
{
|
||||
/* special case for `any' */
|
||||
for ( n = 0; n < trace_count; n++ )
|
||||
ft_trace_levels[n] = level;
|
||||
ft_trace_levels_enabled[n] = level;
|
||||
}
|
||||
else
|
||||
ft_trace_levels[found] = level;
|
||||
ft_trace_levels_enabled[found] = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ft_trace_levels = ft_trace_levels_enabled;
|
||||
}
|
||||
|
||||
|
||||
@ -260,6 +287,22 @@
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Trace_Disable( void )
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftdebug.h */
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_Trace_Enable( void )
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
|
||||
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user