Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /***************************************************************************/ |
michael@0 | 2 | /* */ |
michael@0 | 3 | /* ftmoderr.h */ |
michael@0 | 4 | /* */ |
michael@0 | 5 | /* FreeType module error offsets (specification). */ |
michael@0 | 6 | /* */ |
michael@0 | 7 | /* Copyright 2001-2005, 2010, 2013 by */ |
michael@0 | 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
michael@0 | 9 | /* */ |
michael@0 | 10 | /* This file is part of the FreeType project, and may only be used, */ |
michael@0 | 11 | /* modified, and distributed under the terms of the FreeType project */ |
michael@0 | 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
michael@0 | 13 | /* this file you indicate that you have read the license and */ |
michael@0 | 14 | /* understand and accept it fully. */ |
michael@0 | 15 | /* */ |
michael@0 | 16 | /***************************************************************************/ |
michael@0 | 17 | |
michael@0 | 18 | |
michael@0 | 19 | /*************************************************************************/ |
michael@0 | 20 | /* */ |
michael@0 | 21 | /* This file is used to define the FreeType module error codes. */ |
michael@0 | 22 | /* */ |
michael@0 | 23 | /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */ |
michael@0 | 24 | /* set, the lower byte of an error value identifies the error code as */ |
michael@0 | 25 | /* usual. In addition, the higher byte identifies the module. For */ |
michael@0 | 26 | /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */ |
michael@0 | 27 | /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */ |
michael@0 | 28 | /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */ |
michael@0 | 29 | /* */ |
michael@0 | 30 | /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */ |
michael@0 | 31 | /* including the high byte. */ |
michael@0 | 32 | /* */ |
michael@0 | 33 | /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */ |
michael@0 | 34 | /* an error value is set to zero. */ |
michael@0 | 35 | /* */ |
michael@0 | 36 | /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */ |
michael@0 | 37 | /* provides some macros in `fttypes.h'. */ |
michael@0 | 38 | /* */ |
michael@0 | 39 | /* FT_ERR( err ) */ |
michael@0 | 40 | /* Add current error module prefix (as defined with the */ |
michael@0 | 41 | /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */ |
michael@0 | 42 | /* the line */ |
michael@0 | 43 | /* */ |
michael@0 | 44 | /* error = FT_ERR( Invalid_Outline ); */ |
michael@0 | 45 | /* */ |
michael@0 | 46 | /* expands to */ |
michael@0 | 47 | /* */ |
michael@0 | 48 | /* error = BDF_Err_Invalid_Outline; */ |
michael@0 | 49 | /* */ |
michael@0 | 50 | /* For simplicity, you can always use `FT_Err_Ok' directly instead */ |
michael@0 | 51 | /* of `FT_ERR( Ok )'. */ |
michael@0 | 52 | /* */ |
michael@0 | 53 | /* FT_ERR_EQ( errcode, err ) */ |
michael@0 | 54 | /* FT_ERR_NEQ( errcode, err ) */ |
michael@0 | 55 | /* Compare error code `errcode' with the error `err' for equality */ |
michael@0 | 56 | /* and inequality, respectively. Example: */ |
michael@0 | 57 | /* */ |
michael@0 | 58 | /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */ |
michael@0 | 59 | /* ... */ |
michael@0 | 60 | /* */ |
michael@0 | 61 | /* Using this macro you don't have to think about error prefixes. */ |
michael@0 | 62 | /* Of course, if module errors are not active, the above example is */ |
michael@0 | 63 | /* the same as */ |
michael@0 | 64 | /* */ |
michael@0 | 65 | /* if ( error == FT_Err_Invalid_Outline ) */ |
michael@0 | 66 | /* ... */ |
michael@0 | 67 | /* */ |
michael@0 | 68 | /* FT_ERROR_BASE( errcode ) */ |
michael@0 | 69 | /* FT_ERROR_MODULE( errcode ) */ |
michael@0 | 70 | /* Get base error and module error code, respectively. */ |
michael@0 | 71 | /* */ |
michael@0 | 72 | /* */ |
michael@0 | 73 | /* It can also be used to create a module error message table easily */ |
michael@0 | 74 | /* with something like */ |
michael@0 | 75 | /* */ |
michael@0 | 76 | /* { */ |
michael@0 | 77 | /* #undef __FTMODERR_H__ */ |
michael@0 | 78 | /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ |
michael@0 | 79 | /* #define FT_MODERR_START_LIST { */ |
michael@0 | 80 | /* #define FT_MODERR_END_LIST { 0, 0 } }; */ |
michael@0 | 81 | /* */ |
michael@0 | 82 | /* const struct */ |
michael@0 | 83 | /* { */ |
michael@0 | 84 | /* int mod_err_offset; */ |
michael@0 | 85 | /* const char* mod_err_msg */ |
michael@0 | 86 | /* } ft_mod_errors[] = */ |
michael@0 | 87 | /* */ |
michael@0 | 88 | /* #include FT_MODULE_ERRORS_H */ |
michael@0 | 89 | /* } */ |
michael@0 | 90 | /* */ |
michael@0 | 91 | /*************************************************************************/ |
michael@0 | 92 | |
michael@0 | 93 | |
michael@0 | 94 | #ifndef __FTMODERR_H__ |
michael@0 | 95 | #define __FTMODERR_H__ |
michael@0 | 96 | |
michael@0 | 97 | |
michael@0 | 98 | /*******************************************************************/ |
michael@0 | 99 | /*******************************************************************/ |
michael@0 | 100 | /***** *****/ |
michael@0 | 101 | /***** SETUP MACROS *****/ |
michael@0 | 102 | /***** *****/ |
michael@0 | 103 | /*******************************************************************/ |
michael@0 | 104 | /*******************************************************************/ |
michael@0 | 105 | |
michael@0 | 106 | |
michael@0 | 107 | #undef FT_NEED_EXTERN_C |
michael@0 | 108 | |
michael@0 | 109 | #ifndef FT_MODERRDEF |
michael@0 | 110 | |
michael@0 | 111 | #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS |
michael@0 | 112 | #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, |
michael@0 | 113 | #else |
michael@0 | 114 | #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, |
michael@0 | 115 | #endif |
michael@0 | 116 | |
michael@0 | 117 | #define FT_MODERR_START_LIST enum { |
michael@0 | 118 | #define FT_MODERR_END_LIST FT_Mod_Err_Max }; |
michael@0 | 119 | |
michael@0 | 120 | #ifdef __cplusplus |
michael@0 | 121 | #define FT_NEED_EXTERN_C |
michael@0 | 122 | extern "C" { |
michael@0 | 123 | #endif |
michael@0 | 124 | |
michael@0 | 125 | #endif /* !FT_MODERRDEF */ |
michael@0 | 126 | |
michael@0 | 127 | |
michael@0 | 128 | /*******************************************************************/ |
michael@0 | 129 | /*******************************************************************/ |
michael@0 | 130 | /***** *****/ |
michael@0 | 131 | /***** LIST MODULE ERROR BASES *****/ |
michael@0 | 132 | /***** *****/ |
michael@0 | 133 | /*******************************************************************/ |
michael@0 | 134 | /*******************************************************************/ |
michael@0 | 135 | |
michael@0 | 136 | |
michael@0 | 137 | #ifdef FT_MODERR_START_LIST |
michael@0 | 138 | FT_MODERR_START_LIST |
michael@0 | 139 | #endif |
michael@0 | 140 | |
michael@0 | 141 | |
michael@0 | 142 | FT_MODERRDEF( Base, 0x000, "base module" ) |
michael@0 | 143 | FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) |
michael@0 | 144 | FT_MODERRDEF( BDF, 0x200, "BDF module" ) |
michael@0 | 145 | FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) |
michael@0 | 146 | FT_MODERRDEF( Cache, 0x400, "cache module" ) |
michael@0 | 147 | FT_MODERRDEF( CFF, 0x500, "CFF module" ) |
michael@0 | 148 | FT_MODERRDEF( CID, 0x600, "CID module" ) |
michael@0 | 149 | FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) |
michael@0 | 150 | FT_MODERRDEF( LZW, 0x800, "LZW module" ) |
michael@0 | 151 | FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) |
michael@0 | 152 | FT_MODERRDEF( PCF, 0xA00, "PCF module" ) |
michael@0 | 153 | FT_MODERRDEF( PFR, 0xB00, "PFR module" ) |
michael@0 | 154 | FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) |
michael@0 | 155 | FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) |
michael@0 | 156 | FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) |
michael@0 | 157 | FT_MODERRDEF( Raster, 0xF00, "raster module" ) |
michael@0 | 158 | FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) |
michael@0 | 159 | FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) |
michael@0 | 160 | FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) |
michael@0 | 161 | FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) |
michael@0 | 162 | FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) |
michael@0 | 163 | FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) |
michael@0 | 164 | FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) |
michael@0 | 165 | |
michael@0 | 166 | |
michael@0 | 167 | #ifdef FT_MODERR_END_LIST |
michael@0 | 168 | FT_MODERR_END_LIST |
michael@0 | 169 | #endif |
michael@0 | 170 | |
michael@0 | 171 | |
michael@0 | 172 | /*******************************************************************/ |
michael@0 | 173 | /*******************************************************************/ |
michael@0 | 174 | /***** *****/ |
michael@0 | 175 | /***** CLEANUP *****/ |
michael@0 | 176 | /***** *****/ |
michael@0 | 177 | /*******************************************************************/ |
michael@0 | 178 | /*******************************************************************/ |
michael@0 | 179 | |
michael@0 | 180 | |
michael@0 | 181 | #ifdef FT_NEED_EXTERN_C |
michael@0 | 182 | } |
michael@0 | 183 | #endif |
michael@0 | 184 | |
michael@0 | 185 | #undef FT_MODERR_START_LIST |
michael@0 | 186 | #undef FT_MODERR_END_LIST |
michael@0 | 187 | #undef FT_MODERRDEF |
michael@0 | 188 | #undef FT_NEED_EXTERN_C |
michael@0 | 189 | |
michael@0 | 190 | |
michael@0 | 191 | #endif /* __FTMODERR_H__ */ |
michael@0 | 192 | |
michael@0 | 193 | |
michael@0 | 194 | /* END */ |