ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

fterrors.h
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  fterrors.h                                                             */
00004 /*                                                                         */
00005 /*    FreeType error code handling (specification).                        */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2002, 2004, 2007 by                               */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019   /*************************************************************************/
00020   /*                                                                       */
00021   /* This special header file is used to define the handling of FT2        */
00022   /* enumeration constants.  It can also be used to generate error message */
00023   /* strings with a small macro trick explained below.                     */
00024   /*                                                                       */
00025   /* I - Error Formats                                                     */
00026   /* -----------------                                                     */
00027   /*                                                                       */
00028   /*   The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be   */
00029   /*   defined in ftoption.h in order to make the higher byte indicate     */
00030   /*   the module where the error has happened (this is not compatible     */
00031   /*   with standard builds of FreeType 2).  You can then use the macro    */
00032   /*   FT_ERROR_BASE macro to extract the generic error code from an       */
00033   /*   FT_Error value.                                                     */
00034   /*                                                                       */
00035   /*                                                                       */
00036   /* II - Error Message strings                                            */
00037   /* --------------------------                                            */
00038   /*                                                                       */
00039   /*   The error definitions below are made through special macros that    */
00040   /*   allow client applications to build a table of error message strings */
00041   /*   if they need it.  The strings are not included in a normal build of */
00042   /*   FreeType 2 to save space (most client applications do not use       */
00043   /*   them).                                                              */
00044   /*                                                                       */
00045   /*   To do so, you have to define the following macros before including  */
00046   /*   this file:                                                          */
00047   /*                                                                       */
00048   /*   FT_ERROR_START_LIST ::                                              */
00049   /*     This macro is called before anything else to define the start of  */
00050   /*     the error list.  It is followed by several FT_ERROR_DEF calls     */
00051   /*     (see below).                                                      */
00052   /*                                                                       */
00053   /*   FT_ERROR_DEF( e, v, s ) ::                                          */
00054   /*     This macro is called to define one single error.                  */
00055   /*     `e' is the error code identifier (e.g. FT_Err_Invalid_Argument).  */
00056   /*     `v' is the error numerical value.                                 */
00057   /*     `s' is the corresponding error string.                            */
00058   /*                                                                       */
00059   /*   FT_ERROR_END_LIST ::                                                */
00060   /*     This macro ends the list.                                         */
00061   /*                                                                       */
00062   /*   Additionally, you have to undefine __FTERRORS_H__ before #including */
00063   /*   this file.                                                          */
00064   /*                                                                       */
00065   /*   Here is a simple example:                                           */
00066   /*                                                                       */
00067   /*     {                                                                 */
00068   /*       #undef __FTERRORS_H__                                           */
00069   /*       #define FT_ERRORDEF( e, v, s )  { e, s },                       */
00070   /*       #define FT_ERROR_START_LIST     {                               */
00071   /*       #define FT_ERROR_END_LIST       { 0, 0 } };                     */
00072   /*                                                                       */
00073   /*       const struct                                                    */
00074   /*       {                                                               */
00075   /*         int          err_code;                                        */
00076   /*         const char*  err_msg;                                         */
00077   /*       } ft_errors[] =                                                 */
00078   /*                                                                       */
00079   /*       #include FT_ERRORS_H                                            */
00080   /*     }                                                                 */
00081   /*                                                                       */
00082   /*************************************************************************/
00083 
00084 
00085 #ifndef __FTERRORS_H__
00086 #define __FTERRORS_H__
00087 
00088 
00089   /* include module base error codes */
00090 #include FT_MODULE_ERRORS_H
00091 
00092 
00093   /*******************************************************************/
00094   /*******************************************************************/
00095   /*****                                                         *****/
00096   /*****                       SETUP MACROS                      *****/
00097   /*****                                                         *****/
00098   /*******************************************************************/
00099   /*******************************************************************/
00100 
00101 
00102 #undef  FT_NEED_EXTERN_C
00103 
00104 #undef  FT_ERR_XCAT
00105 #undef  FT_ERR_CAT
00106 
00107 #define FT_ERR_XCAT( x, y )  x ## y
00108 #define FT_ERR_CAT( x, y )   FT_ERR_XCAT( x, y )
00109 
00110 
00111   /* FT_ERR_PREFIX is used as a prefix for error identifiers. */
00112   /* By default, we use `FT_Err_'.                            */
00113   /*                                                          */
00114 #ifndef FT_ERR_PREFIX
00115 #define FT_ERR_PREFIX  FT_Err_
00116 #endif
00117 
00118 
00119   /* FT_ERR_BASE is used as the base for module-specific errors. */
00120   /*                                                             */
00121 #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
00122 
00123 #ifndef FT_ERR_BASE
00124 #define FT_ERR_BASE  FT_Mod_Err_Base
00125 #endif
00126 
00127 #else
00128 
00129 #undef FT_ERR_BASE
00130 #define FT_ERR_BASE  0
00131 
00132 #endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
00133 
00134 
00135   /* If FT_ERRORDEF is not defined, we need to define a simple */
00136   /* enumeration type.                                         */
00137   /*                                                           */
00138 #ifndef FT_ERRORDEF
00139 
00140 #define FT_ERRORDEF( e, v, s )  e = v,
00141 #define FT_ERROR_START_LIST     enum {
00142 #define FT_ERROR_END_LIST       FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
00143 
00144 #ifdef __cplusplus
00145 #define FT_NEED_EXTERN_C
00146   extern "C" {
00147 #endif
00148 
00149 #endif /* !FT_ERRORDEF */
00150 
00151 
00152   /* this macro is used to define an error */
00153 #define FT_ERRORDEF_( e, v, s )   \
00154           FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
00155 
00156   /* this is only used for <module>_Err_Ok, which must be 0! */
00157 #define FT_NOERRORDEF_( e, v, s ) \
00158           FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
00159 
00160 
00161 #ifdef FT_ERROR_START_LIST
00162   FT_ERROR_START_LIST
00163 #endif
00164 
00165 
00166   /* now include the error codes */
00167 #include FT_ERROR_DEFINITIONS_H
00168 
00169 
00170 #ifdef FT_ERROR_END_LIST
00171   FT_ERROR_END_LIST
00172 #endif
00173 
00174 
00175   /*******************************************************************/
00176   /*******************************************************************/
00177   /*****                                                         *****/
00178   /*****                      SIMPLE CLEANUP                     *****/
00179   /*****                                                         *****/
00180   /*******************************************************************/
00181   /*******************************************************************/
00182 
00183 #ifdef FT_NEED_EXTERN_C
00184   }
00185 #endif
00186 
00187 #undef FT_ERROR_START_LIST
00188 #undef FT_ERROR_END_LIST
00189 
00190 #undef FT_ERRORDEF
00191 #undef FT_ERRORDEF_
00192 #undef FT_NOERRORDEF_
00193 
00194 #undef FT_NEED_EXTERN_C
00195 #undef FT_ERR_CONCAT
00196 #undef FT_ERR_BASE
00197 
00198   /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */
00199 #ifndef FT_KEEP_ERR_PREFIX
00200 #undef FT_ERR_PREFIX
00201 #endif
00202 
00203 #endif /* __FTERRORS_H__ */
00204 
00205 
00206 /* END */

Generated on Sat May 26 2012 04:32:25 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.