1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftdebug.h */
|
|
|
|
/* */
|
|
|
|
/* Debugging and logging component (specification). */
|
|
|
|
/* */
|
2013-03-13 11:06:39 +01:00
|
|
|
/* Copyright 1996-2002, 2004, 2006-2009, 2013 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
2000-07-18 08:50:03 +02:00
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
2002-07-09 01:02:32 +02:00
|
|
|
/* */
|
|
|
|
/* IMPORTANT: A description of FreeType's debugging support can be */
|
2006-03-24 13:46:49 +01:00
|
|
|
/* found in `docs/DEBUG.TXT'. Read it if you need to use or */
|
2002-07-26 11:09:10 +02:00
|
|
|
/* understand this code. */
|
2002-07-09 01:02:32 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#ifndef __FTDEBUG_H__
|
|
|
|
#define __FTDEBUG_H__
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_CONFIG_CONFIG_H
|
2004-02-24 08:52:45 +01:00
|
|
|
#include FT_FREETYPE_H
|
2000-12-09 01:45:38 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_BEGIN_HEADER
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2002-03-30 00:23:28 +01:00
|
|
|
/* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
|
|
|
|
/* is already defined; this simplifies the following #ifdefs */
|
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
2002-02-22 01:58:04 +01:00
|
|
|
#undef FT_DEBUG_LEVEL_ERROR
|
|
|
|
#define FT_DEBUG_LEVEL_ERROR
|
2002-02-21 12:48:48 +01:00
|
|
|
#endif
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2002-03-30 00:23:28 +01:00
|
|
|
/* Define the trace enums as well as the trace levels array when they */
|
|
|
|
/* are needed. */
|
2002-02-21 12:48:48 +01:00
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
2000-06-03 08:03:11 +02:00
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
|
2002-02-22 01:58:04 +01:00
|
|
|
#define FT_TRACE_DEF( x ) trace_ ## x ,
|
2002-02-21 12:48:48 +01:00
|
|
|
|
2002-07-09 01:02:32 +02:00
|
|
|
/* defining the enumeration */
|
2008-05-29 00:17:28 +02:00
|
|
|
typedef enum FT_Trace_
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-07-09 01:02:32 +02:00
|
|
|
#include FT_INTERNAL_TRACE_H
|
2002-02-22 01:58:04 +01:00
|
|
|
trace_count
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
} FT_Trace;
|
|
|
|
|
2000-07-18 08:50:03 +02:00
|
|
|
|
2002-02-22 01:58:04 +01:00
|
|
|
/* defining the array of trace levels, provided by `src/base/ftdebug.c' */
|
2002-03-30 00:23:28 +01:00
|
|
|
extern int ft_trace_levels[trace_count];
|
2002-02-21 12:48:48 +01:00
|
|
|
|
2002-02-22 01:58:04 +01:00
|
|
|
#undef FT_TRACE_DEF
|
2002-02-21 12:48:48 +01:00
|
|
|
|
|
|
|
#endif /* FT_DEBUG_LEVEL_TRACE */
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2002-03-30 00:23:28 +01:00
|
|
|
/* Define the FT_TRACE macro */
|
2002-02-21 12:48:48 +01:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* IMPORTANT! */
|
|
|
|
/* */
|
2000-06-03 08:03:11 +02:00
|
|
|
/* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
|
|
|
|
/* value before using any TRACE macro. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-22 01:58:04 +01:00
|
|
|
#define FT_TRACE( level, varformat ) \
|
2000-06-03 08:03:11 +02:00
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if ( ft_trace_levels[FT_COMPONENT] >= level ) \
|
2000-11-29 16:18:54 +01:00
|
|
|
FT_Message varformat; \
|
2000-01-08 18:10:33 +01:00
|
|
|
} while ( 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#else /* !FT_DEBUG_LEVEL_TRACE */
|
|
|
|
|
2009-01-12 21:11:14 +01:00
|
|
|
#define FT_TRACE( level, varformat ) do { } while ( 0 ) /* nothing */
|
2002-02-21 12:48:48 +01:00
|
|
|
|
|
|
|
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-22 01:58:04 +01:00
|
|
|
|
2004-02-24 08:52:45 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_Trace_Get_Count */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Return the number of available trace components. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* The number of trace components. 0 if FreeType 2 is not built with */
|
|
|
|
/* FT_DEBUG_LEVEL_TRACE definition. */
|
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* This function may be useful if you want to access elements of */
|
|
|
|
/* the internal `ft_trace_levels' array by an index. */
|
|
|
|
/* */
|
* src/base/ftcalc.c (FT_MulTo64): Commented out.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed), src/base/ftcalc.c
(FT_SqrtFixed), include/freetype/internal/ftdebug.h
(FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message, FT_Panic),
src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message,
FT_Panic), include/freetype/internal/ftobjs.h (FT_New_Memory,
FT_Done_Memory), include/freetype/internal/ftstream.h
(FT_Stream_Open), src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory,
FT_Stream_Open): s/FT_EXPORT/FT_BASE/.
* builds/exports.mk: Manually add TT_New_Context to EXPORTS_LIST too.
2005-11-17 02:53:07 +01:00
|
|
|
FT_BASE( FT_Int )
|
2004-02-24 08:52:45 +01:00
|
|
|
FT_Trace_Get_Count( void );
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_Trace_Get_Name */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Return the name of a trace component. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* The index of the trace component. */
|
|
|
|
/* */
|
|
|
|
/* <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. */
|
|
|
|
/* */
|
|
|
|
/* <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 */
|
2007-01-29 15:49:59 +01:00
|
|
|
/* debug level in your application. */
|
2004-02-24 08:52:45 +01:00
|
|
|
/* */
|
* src/base/ftcalc.c (FT_MulTo64): Commented out.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed), src/base/ftcalc.c
(FT_SqrtFixed), include/freetype/internal/ftdebug.h
(FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message, FT_Panic),
src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message,
FT_Panic), include/freetype/internal/ftobjs.h (FT_New_Memory,
FT_Done_Memory), include/freetype/internal/ftstream.h
(FT_Stream_Open), src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory,
FT_Stream_Open): s/FT_EXPORT/FT_BASE/.
* builds/exports.mk: Manually add TT_New_Context to EXPORTS_LIST too.
2005-11-17 02:53:07 +01:00
|
|
|
FT_BASE( const char * )
|
2004-02-25 13:58:54 +01:00
|
|
|
FT_Trace_Get_Name( FT_Int idx );
|
2004-02-24 08:52:45 +01:00
|
|
|
|
|
|
|
|
2000-11-07 18:21:11 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2008-05-18 19:36:15 +02:00
|
|
|
/* You need two opening and closing parentheses! */
|
2000-11-07 18:21:11 +01:00
|
|
|
/* */
|
2002-02-21 12:48:48 +01:00
|
|
|
/* Example: FT_TRACE0(( "Value is %i", foo )) */
|
2000-11-07 18:21:11 +01:00
|
|
|
/* */
|
2008-05-18 19:36:15 +02:00
|
|
|
/* Output of the FT_TRACEX macros is sent to stderr. */
|
|
|
|
/* */
|
2002-02-21 12:48:48 +01:00
|
|
|
/*************************************************************************/
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )
|
|
|
|
#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )
|
|
|
|
#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )
|
|
|
|
#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )
|
|
|
|
#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )
|
|
|
|
#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )
|
|
|
|
#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )
|
|
|
|
#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2008-05-18 19:36:15 +02:00
|
|
|
/* Define the FT_ERROR macro. */
|
|
|
|
/* */
|
|
|
|
/* Output of this macro is sent to stderr. */
|
2002-02-21 12:48:48 +01:00
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#ifdef FT_DEBUG_LEVEL_ERROR
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-22 01:58:04 +01:00
|
|
|
#define FT_ERROR( varformat ) FT_Message varformat
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#else /* !FT_DEBUG_LEVEL_ERROR */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2009-01-12 21:11:14 +01:00
|
|
|
#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#endif /* !FT_DEBUG_LEVEL_ERROR */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2013-03-13 11:06:39 +01:00
|
|
|
/* Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw' */
|
|
|
|
/* makes it possible to easily set a breakpoint at this function. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#ifdef FT_DEBUG_LEVEL_ERROR
|
2000-06-03 08:03:11 +02:00
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#define FT_ASSERT( condition ) \
|
2000-01-08 18:10:33 +01:00
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if ( !( condition ) ) \
|
|
|
|
FT_Panic( "assertion failed on line %d of file %s\n", \
|
|
|
|
__LINE__, __FILE__ ); \
|
|
|
|
} while ( 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2013-03-13 11:06:39 +01:00
|
|
|
#define FT_THROW( e ) \
|
|
|
|
( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \
|
|
|
|
__LINE__, \
|
|
|
|
__FILE__ ) | \
|
|
|
|
FT_ERR_CAT( FT_ERR_PREFIX, e ) )
|
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#else /* !FT_DEBUG_LEVEL_ERROR */
|
|
|
|
|
2009-01-12 21:11:14 +01:00
|
|
|
#define FT_ASSERT( condition ) do { } while ( 0 )
|
2002-02-21 12:48:48 +01:00
|
|
|
|
2013-03-13 11:06:39 +01:00
|
|
|
#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )
|
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#endif /* !FT_DEBUG_LEVEL_ERROR */
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2008-05-18 19:36:15 +02:00
|
|
|
/* Define `FT_Message' and `FT_Panic' when needed. */
|
2002-02-21 12:48:48 +01:00
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_LEVEL_ERROR
|
|
|
|
|
2008-05-18 19:36:15 +02:00
|
|
|
#include "stdio.h" /* for vfprintf() */
|
2002-02-21 12:48:48 +01:00
|
|
|
|
2000-01-08 18:10:33 +01:00
|
|
|
/* print a message */
|
* src/base/ftcalc.c (FT_MulTo64): Commented out.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed), src/base/ftcalc.c
(FT_SqrtFixed), include/freetype/internal/ftdebug.h
(FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message, FT_Panic),
src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message,
FT_Panic), include/freetype/internal/ftobjs.h (FT_New_Memory,
FT_Done_Memory), include/freetype/internal/ftstream.h
(FT_Stream_Open), src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory,
FT_Stream_Open): s/FT_EXPORT/FT_BASE/.
* builds/exports.mk: Manually add TT_New_Context to EXPORTS_LIST too.
2005-11-17 02:53:07 +01:00
|
|
|
FT_BASE( void )
|
2008-05-18 19:36:15 +02:00
|
|
|
FT_Message( const char* fmt,
|
|
|
|
... );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* print a message and exit */
|
* src/base/ftcalc.c (FT_MulTo64): Commented out.
* include/freetype/internal/ftcalc.h (FT_SqrtFixed), src/base/ftcalc.c
(FT_SqrtFixed), include/freetype/internal/ftdebug.h
(FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message, FT_Panic),
src/base/ftdebug.c (FT_Trace_Get_Count, FT_Trace_Get_Name, FT_Message,
FT_Panic), include/freetype/internal/ftobjs.h (FT_New_Memory,
FT_Done_Memory), include/freetype/internal/ftstream.h
(FT_Stream_Open), src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory,
FT_Stream_Open): s/FT_EXPORT/FT_BASE/.
* builds/exports.mk: Manually add TT_New_Context to EXPORTS_LIST too.
2005-11-17 02:53:07 +01:00
|
|
|
FT_BASE( void )
|
2008-05-18 19:36:15 +02:00
|
|
|
FT_Panic( const char* fmt,
|
|
|
|
... );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2013-03-13 11:06:39 +01:00
|
|
|
/* report file name and line number of an error */
|
|
|
|
FT_BASE( int )
|
|
|
|
FT_Throw( FT_Error error,
|
|
|
|
int line,
|
|
|
|
const char* file );
|
|
|
|
|
2002-02-21 12:48:48 +01:00
|
|
|
#endif /* FT_DEBUG_LEVEL_ERROR */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2002-03-30 00:23:28 +01:00
|
|
|
FT_BASE( void )
|
|
|
|
ft_debug_init( void );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_END_HEADER
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#endif /* __FTDEBUG_H__ */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|