vrshoot

diff libs/ft2static/freetype/internal/ftdebug.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/ft2static/freetype/internal/ftdebug.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,250 @@
     1.4 +/***************************************************************************/
     1.5 +/*                                                                         */
     1.6 +/*  ftdebug.h                                                              */
     1.7 +/*                                                                         */
     1.8 +/*    Debugging and logging component (specification).                     */
     1.9 +/*                                                                         */
    1.10 +/*  Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008, 2009 by             */
    1.11 +/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    1.12 +/*                                                                         */
    1.13 +/*  This file is part of the FreeType project, and may only be used,       */
    1.14 +/*  modified, and distributed under the terms of the FreeType project      */
    1.15 +/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    1.16 +/*  this file you indicate that you have read the license and              */
    1.17 +/*  understand and accept it fully.                                        */
    1.18 +/*                                                                         */
    1.19 +/*                                                                         */
    1.20 +/*  IMPORTANT: A description of FreeType's debugging support can be        */
    1.21 +/*             found in `docs/DEBUG.TXT'.  Read it if you need to use or   */
    1.22 +/*             understand this code.                                       */
    1.23 +/*                                                                         */
    1.24 +/***************************************************************************/
    1.25 +
    1.26 +
    1.27 +#ifndef __FTDEBUG_H__
    1.28 +#define __FTDEBUG_H__
    1.29 +
    1.30 +
    1.31 +#include <ft2build.h>
    1.32 +#include FT_CONFIG_CONFIG_H
    1.33 +#include FT_FREETYPE_H
    1.34 +
    1.35 +
    1.36 +FT_BEGIN_HEADER
    1.37 +
    1.38 +
    1.39 +  /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
    1.40 +  /* is already defined; this simplifies the following #ifdefs            */
    1.41 +  /*                                                                      */
    1.42 +#ifdef FT_DEBUG_LEVEL_TRACE
    1.43 +#undef  FT_DEBUG_LEVEL_ERROR
    1.44 +#define FT_DEBUG_LEVEL_ERROR
    1.45 +#endif
    1.46 +
    1.47 +
    1.48 +  /*************************************************************************/
    1.49 +  /*                                                                       */
    1.50 +  /* Define the trace enums as well as the trace levels array when they    */
    1.51 +  /* are needed.                                                           */
    1.52 +  /*                                                                       */
    1.53 +  /*************************************************************************/
    1.54 +
    1.55 +#ifdef FT_DEBUG_LEVEL_TRACE
    1.56 +
    1.57 +#define FT_TRACE_DEF( x )  trace_ ## x ,
    1.58 +
    1.59 +  /* defining the enumeration */
    1.60 +  typedef enum  FT_Trace_
    1.61 +  {
    1.62 +#include FT_INTERNAL_TRACE_H
    1.63 +    trace_count
    1.64 +
    1.65 +  } FT_Trace;
    1.66 +
    1.67 +
    1.68 +  /* defining the array of trace levels, provided by `src/base/ftdebug.c' */
    1.69 +  extern int  ft_trace_levels[trace_count];
    1.70 +
    1.71 +#undef FT_TRACE_DEF
    1.72 +
    1.73 +#endif /* FT_DEBUG_LEVEL_TRACE */
    1.74 +
    1.75 +
    1.76 +  /*************************************************************************/
    1.77 +  /*                                                                       */
    1.78 +  /* Define the FT_TRACE macro                                             */
    1.79 +  /*                                                                       */
    1.80 +  /* IMPORTANT!                                                            */
    1.81 +  /*                                                                       */
    1.82 +  /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
    1.83 +  /* value before using any TRACE macro.                                   */
    1.84 +  /*                                                                       */
    1.85 +  /*************************************************************************/
    1.86 +
    1.87 +#ifdef FT_DEBUG_LEVEL_TRACE
    1.88 +
    1.89 +#define FT_TRACE( level, varformat )                      \
    1.90 +          do                                              \
    1.91 +          {                                               \
    1.92 +            if ( ft_trace_levels[FT_COMPONENT] >= level ) \
    1.93 +              FT_Message varformat;                       \
    1.94 +          } while ( 0 )
    1.95 +
    1.96 +#else /* !FT_DEBUG_LEVEL_TRACE */
    1.97 +
    1.98 +#define FT_TRACE( level, varformat )  do { } while ( 0 )      /* nothing */
    1.99 +
   1.100 +#endif /* !FT_DEBUG_LEVEL_TRACE */
   1.101 +
   1.102 +
   1.103 +  /*************************************************************************/
   1.104 +  /*                                                                       */
   1.105 +  /* <Function>                                                            */
   1.106 +  /*    FT_Trace_Get_Count                                                 */
   1.107 +  /*                                                                       */
   1.108 +  /* <Description>                                                         */
   1.109 +  /*    Return the number of available trace components.                   */
   1.110 +  /*                                                                       */
   1.111 +  /* <Return>                                                              */
   1.112 +  /*    The number of trace components.  0 if FreeType 2 is not built with */
   1.113 +  /*    FT_DEBUG_LEVEL_TRACE definition.                                   */
   1.114 +  /*                                                                       */
   1.115 +  /* <Note>                                                                */
   1.116 +  /*    This function may be useful if you want to access elements of      */
   1.117 +  /*    the internal `ft_trace_levels' array by an index.                  */
   1.118 +  /*                                                                       */
   1.119 +  FT_BASE( FT_Int )
   1.120 +  FT_Trace_Get_Count( void );
   1.121 +
   1.122 +
   1.123 +  /*************************************************************************/
   1.124 +  /*                                                                       */
   1.125 +  /* <Function>                                                            */
   1.126 +  /*    FT_Trace_Get_Name                                                  */
   1.127 +  /*                                                                       */
   1.128 +  /* <Description>                                                         */
   1.129 +  /*    Return the name of a trace component.                              */
   1.130 +  /*                                                                       */
   1.131 +  /* <Input>                                                               */
   1.132 +  /*    The index of the trace component.                                  */
   1.133 +  /*                                                                       */
   1.134 +  /* <Return>                                                              */
   1.135 +  /*    The name of the trace component.  This is a statically allocated   */
   1.136 +  /*    C string, so do not free it after use.  NULL if FreeType 2 is not  */
   1.137 +  /*    built with FT_DEBUG_LEVEL_TRACE definition.                        */
   1.138 +  /*                                                                       */
   1.139 +  /* <Note>                                                                */
   1.140 +  /*    Use @FT_Trace_Get_Count to get the number of available trace       */
   1.141 +  /*    components.                                                        */
   1.142 +  /*                                                                       */
   1.143 +  /*    This function may be useful if you want to control FreeType 2's    */
   1.144 +  /*    debug level in your application.                                   */
   1.145 +  /*                                                                       */
   1.146 +  FT_BASE( const char * )
   1.147 +  FT_Trace_Get_Name( FT_Int  idx );
   1.148 +
   1.149 +
   1.150 +  /*************************************************************************/
   1.151 +  /*                                                                       */
   1.152 +  /* You need two opening and closing parentheses!                         */
   1.153 +  /*                                                                       */
   1.154 +  /* Example: FT_TRACE0(( "Value is %i", foo ))                            */
   1.155 +  /*                                                                       */
   1.156 +  /* Output of the FT_TRACEX macros is sent to stderr.                     */
   1.157 +  /*                                                                       */
   1.158 +  /*************************************************************************/
   1.159 +
   1.160 +#define FT_TRACE0( varformat )  FT_TRACE( 0, varformat )
   1.161 +#define FT_TRACE1( varformat )  FT_TRACE( 1, varformat )
   1.162 +#define FT_TRACE2( varformat )  FT_TRACE( 2, varformat )
   1.163 +#define FT_TRACE3( varformat )  FT_TRACE( 3, varformat )
   1.164 +#define FT_TRACE4( varformat )  FT_TRACE( 4, varformat )
   1.165 +#define FT_TRACE5( varformat )  FT_TRACE( 5, varformat )
   1.166 +#define FT_TRACE6( varformat )  FT_TRACE( 6, varformat )
   1.167 +#define FT_TRACE7( varformat )  FT_TRACE( 7, varformat )
   1.168 +
   1.169 +
   1.170 +  /*************************************************************************/
   1.171 +  /*                                                                       */
   1.172 +  /* Define the FT_ERROR macro.                                            */
   1.173 +  /*                                                                       */
   1.174 +  /* Output of this macro is sent to stderr.                               */
   1.175 +  /*                                                                       */
   1.176 +  /*************************************************************************/
   1.177 +
   1.178 +#ifdef FT_DEBUG_LEVEL_ERROR
   1.179 +
   1.180 +#define FT_ERROR( varformat )  FT_Message  varformat
   1.181 +
   1.182 +#else  /* !FT_DEBUG_LEVEL_ERROR */
   1.183 +
   1.184 +#define FT_ERROR( varformat )  do { } while ( 0 )      /* nothing */
   1.185 +
   1.186 +#endif /* !FT_DEBUG_LEVEL_ERROR */
   1.187 +
   1.188 +
   1.189 +  /*************************************************************************/
   1.190 +  /*                                                                       */
   1.191 +  /* Define the FT_ASSERT macro.                                           */
   1.192 +  /*                                                                       */
   1.193 +  /*************************************************************************/
   1.194 +
   1.195 +#ifdef FT_DEBUG_LEVEL_ERROR
   1.196 +
   1.197 +#define FT_ASSERT( condition )                                      \
   1.198 +          do                                                        \
   1.199 +          {                                                         \
   1.200 +            if ( !( condition ) )                                   \
   1.201 +              FT_Panic( "assertion failed on line %d of file %s\n", \
   1.202 +                        __LINE__, __FILE__ );                       \
   1.203 +          } while ( 0 )
   1.204 +
   1.205 +#else /* !FT_DEBUG_LEVEL_ERROR */
   1.206 +
   1.207 +#define FT_ASSERT( condition )  do { } while ( 0 )
   1.208 +
   1.209 +#endif /* !FT_DEBUG_LEVEL_ERROR */
   1.210 +
   1.211 +
   1.212 +  /*************************************************************************/
   1.213 +  /*                                                                       */
   1.214 +  /* Define `FT_Message' and `FT_Panic' when needed.                       */
   1.215 +  /*                                                                       */
   1.216 +  /*************************************************************************/
   1.217 +
   1.218 +#ifdef FT_DEBUG_LEVEL_ERROR
   1.219 +
   1.220 +#include "stdio.h"  /* for vfprintf() */
   1.221 +
   1.222 +  /* print a message */
   1.223 +  FT_BASE( void )
   1.224 +  FT_Message( const char*  fmt,
   1.225 +              ... );
   1.226 +
   1.227 +  /* print a message and exit */
   1.228 +  FT_BASE( void )
   1.229 +  FT_Panic( const char*  fmt,
   1.230 +            ... );
   1.231 +
   1.232 +#endif /* FT_DEBUG_LEVEL_ERROR */
   1.233 +
   1.234 +
   1.235 +  FT_BASE( void )
   1.236 +  ft_debug_init( void );
   1.237 +
   1.238 +
   1.239 +#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */
   1.240 +
   1.241 +  /* We disable the warning `conditional expression is constant' here */
   1.242 +  /* in order to compile cleanly with the maximum level of warnings.  */
   1.243 +#pragma warning( disable : 4127 )
   1.244 +
   1.245 +#endif /* _MSC_VER */
   1.246 +
   1.247 +
   1.248 +FT_END_HEADER
   1.249 +
   1.250 +#endif /* __FTDEBUG_H__ */
   1.251 +
   1.252 +
   1.253 +/* END */