Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/freetype2/freetype/ftmoderr.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /****************************************************************************
0002  *
0003  * ftmoderr.h
0004  *
0005  *   FreeType module error offsets (specification).
0006  *
0007  * Copyright (C) 2001-2023 by
0008  * David Turner, Robert Wilhelm, and Werner Lemberg.
0009  *
0010  * This file is part of the FreeType project, and may only be used,
0011  * modified, and distributed under the terms of the FreeType project
0012  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
0013  * this file you indicate that you have read the license and
0014  * understand and accept it fully.
0015  *
0016  */
0017 
0018 
0019   /**************************************************************************
0020    *
0021    * This file is used to define the FreeType module error codes.
0022    *
0023    * If the macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` in `ftoption.h` is
0024    * set, the lower byte of an error value identifies the error code as
0025    * usual.  In addition, the higher byte identifies the module.  For
0026    * example, the error `FT_Err_Invalid_File_Format` has value 0x0003, the
0027    * error `TT_Err_Invalid_File_Format` has value 0x1303, the error
0028    * `T1_Err_Invalid_File_Format` has value 0x1403, etc.
0029    *
0030    * Note that `FT_Err_Ok`, `TT_Err_Ok`, etc. are always equal to zero,
0031    * including the high byte.
0032    *
0033    * If `FT_CONFIG_OPTION_USE_MODULE_ERRORS` isn't set, the higher byte of an
0034    * error value is set to zero.
0035    *
0036    * To hide the various `XXX_Err_` prefixes in the source code, FreeType
0037    * provides some macros in `fttypes.h`.
0038    *
0039    *   FT_ERR( err )
0040    *
0041    *     Add current error module prefix (as defined with the `FT_ERR_PREFIX`
0042    *     macro) to `err`.  For example, in the BDF module the line
0043    *
0044    *     ```
0045    *       error = FT_ERR( Invalid_Outline );
0046    *     ```
0047    *
0048    *     expands to
0049    *
0050    *     ```
0051    *       error = BDF_Err_Invalid_Outline;
0052    *     ```
0053    *
0054    *     For simplicity, you can always use `FT_Err_Ok` directly instead of
0055    *     `FT_ERR( Ok )`.
0056    *
0057    *   FT_ERR_EQ( errcode, err )
0058    *   FT_ERR_NEQ( errcode, err )
0059    *
0060    *     Compare error code `errcode` with the error `err` for equality and
0061    *     inequality, respectively.  Example:
0062    *
0063    *     ```
0064    *       if ( FT_ERR_EQ( error, Invalid_Outline ) )
0065    *         ...
0066    *     ```
0067    *
0068    *     Using this macro you don't have to think about error prefixes.  Of
0069    *     course, if module errors are not active, the above example is the
0070    *     same as
0071    *
0072    *     ```
0073    *       if ( error == FT_Err_Invalid_Outline )
0074    *         ...
0075    *     ```
0076    *
0077    *   FT_ERROR_BASE( errcode )
0078    *   FT_ERROR_MODULE( errcode )
0079    *
0080    *     Get base error and module error code, respectively.
0081    *
0082    * It can also be used to create a module error message table easily with
0083    * something like
0084    *
0085    * ```
0086    *   #undef FTMODERR_H_
0087    *   #define FT_MODERRDEF( e, v, s )  { FT_Mod_Err_ ## e, s },
0088    *   #define FT_MODERR_START_LIST     {
0089    *   #define FT_MODERR_END_LIST       { 0, 0 } };
0090    *
0091    *   const struct
0092    *   {
0093    *     int          mod_err_offset;
0094    *     const char*  mod_err_msg
0095    *   } ft_mod_errors[] =
0096    *
0097    *   #include <freetype/ftmoderr.h>
0098    * ```
0099    *
0100    */
0101 
0102 
0103 #ifndef FTMODERR_H_
0104 #define FTMODERR_H_
0105 
0106 
0107   /*******************************************************************/
0108   /*******************************************************************/
0109   /*****                                                         *****/
0110   /*****                       SETUP MACROS                      *****/
0111   /*****                                                         *****/
0112   /*******************************************************************/
0113   /*******************************************************************/
0114 
0115 
0116 #undef  FT_NEED_EXTERN_C
0117 
0118 #ifndef FT_MODERRDEF
0119 
0120 #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
0121 #define FT_MODERRDEF( e, v, s )  FT_Mod_Err_ ## e = v,
0122 #else
0123 #define FT_MODERRDEF( e, v, s )  FT_Mod_Err_ ## e = 0,
0124 #endif
0125 
0126 #define FT_MODERR_START_LIST  enum {
0127 #define FT_MODERR_END_LIST    FT_Mod_Err_Max };
0128 
0129 #ifdef __cplusplus
0130 #define FT_NEED_EXTERN_C
0131   extern "C" {
0132 #endif
0133 
0134 #endif /* !FT_MODERRDEF */
0135 
0136 
0137   /*******************************************************************/
0138   /*******************************************************************/
0139   /*****                                                         *****/
0140   /*****               LIST MODULE ERROR BASES                   *****/
0141   /*****                                                         *****/
0142   /*******************************************************************/
0143   /*******************************************************************/
0144 
0145 
0146 #ifdef FT_MODERR_START_LIST
0147   FT_MODERR_START_LIST
0148 #endif
0149 
0150 
0151   FT_MODERRDEF( Base,      0x000, "base module" )
0152   FT_MODERRDEF( Autofit,   0x100, "autofitter module" )
0153   FT_MODERRDEF( BDF,       0x200, "BDF module" )
0154   FT_MODERRDEF( Bzip2,     0x300, "Bzip2 module" )
0155   FT_MODERRDEF( Cache,     0x400, "cache module" )
0156   FT_MODERRDEF( CFF,       0x500, "CFF module" )
0157   FT_MODERRDEF( CID,       0x600, "CID module" )
0158   FT_MODERRDEF( Gzip,      0x700, "Gzip module" )
0159   FT_MODERRDEF( LZW,       0x800, "LZW module" )
0160   FT_MODERRDEF( OTvalid,   0x900, "OpenType validation module" )
0161   FT_MODERRDEF( PCF,       0xA00, "PCF module" )
0162   FT_MODERRDEF( PFR,       0xB00, "PFR module" )
0163   FT_MODERRDEF( PSaux,     0xC00, "PS auxiliary module" )
0164   FT_MODERRDEF( PShinter,  0xD00, "PS hinter module" )
0165   FT_MODERRDEF( PSnames,   0xE00, "PS names module" )
0166   FT_MODERRDEF( Raster,    0xF00, "raster module" )
0167   FT_MODERRDEF( SFNT,     0x1000, "SFNT module" )
0168   FT_MODERRDEF( Smooth,   0x1100, "smooth raster module" )
0169   FT_MODERRDEF( TrueType, 0x1200, "TrueType module" )
0170   FT_MODERRDEF( Type1,    0x1300, "Type 1 module" )
0171   FT_MODERRDEF( Type42,   0x1400, "Type 42 module" )
0172   FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
0173   FT_MODERRDEF( GXvalid,  0x1600, "GX validation module" )
0174   FT_MODERRDEF( Sdf,      0x1700, "Signed distance field raster module" )
0175 
0176 
0177 #ifdef FT_MODERR_END_LIST
0178   FT_MODERR_END_LIST
0179 #endif
0180 
0181 
0182   /*******************************************************************/
0183   /*******************************************************************/
0184   /*****                                                         *****/
0185   /*****                      CLEANUP                            *****/
0186   /*****                                                         *****/
0187   /*******************************************************************/
0188   /*******************************************************************/
0189 
0190 
0191 #ifdef FT_NEED_EXTERN_C
0192   }
0193 #endif
0194 
0195 #undef FT_MODERR_START_LIST
0196 #undef FT_MODERR_END_LIST
0197 #undef FT_MODERRDEF
0198 #undef FT_NEED_EXTERN_C
0199 
0200 
0201 #endif /* FTMODERR_H_ */
0202 
0203 
0204 /* END */