OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftmoderr.h */ | 3 /* ftmoderr.h */ |
4 /* */ | 4 /* */ |
5 /* FreeType module error offsets (specification). */ | 5 /* FreeType module error offsets (specification). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2001, 2002, 2003, 2004, 2005, 2010 by */ | 7 /* Copyright 2001-2005, 2010, 2013 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 /*************************************************************************/ | 19 /*************************************************************************/ |
20 /* */ | 20 /* */ |
21 /* This file is used to define the FreeType module error offsets. */ | 21 /* This file is used to define the FreeType module error codes. */ |
22 /* */ | 22 /* */ |
23 /* The lower byte gives the error code, the higher byte gives the */ | 23 /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */ |
24 /* module. The base module has error offset 0. For example, the error */ | 24 /* set, the lower byte of an error value identifies the error code as */ |
25 /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ | 25 /* usual. In addition, the higher byte identifies the module. For */ |
26 /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ | 26 /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */ |
27 /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ | 27 /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */ |
| 28 /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */ |
28 /* */ | 29 /* */ |
29 /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ | 30 /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */ |
30 /* to make the higher byte always zero (disabling the module error */ | 31 /* including the high byte. */ |
31 /* mechanism). */ | 32 /* */ |
| 33 /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */ |
| 34 /* an error value is set to zero. */ |
| 35 /* */ |
| 36 /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */ |
| 37 /* provides some macros in `fttypes.h'. */ |
| 38 /* */ |
| 39 /* FT_ERR( err ) */ |
| 40 /* Add current error module prefix (as defined with the */ |
| 41 /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */ |
| 42 /* the line */ |
| 43 /* */ |
| 44 /* error = FT_ERR( Invalid_Outline ); */ |
| 45 /* */ |
| 46 /* expands to */ |
| 47 /* */ |
| 48 /* error = BDF_Err_Invalid_Outline; */ |
| 49 /* */ |
| 50 /* For simplicity, you can always use `FT_Err_Ok' directly instead */ |
| 51 /* of `FT_ERR( Ok )'. */ |
| 52 /* */ |
| 53 /* FT_ERR_EQ( errcode, err ) */ |
| 54 /* FT_ERR_NEQ( errcode, err ) */ |
| 55 /* Compare error code `errcode' with the error `err' for equality */ |
| 56 /* and inequality, respectively. Example: */ |
| 57 /* */ |
| 58 /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */ |
| 59 /* ... */ |
| 60 /* */ |
| 61 /* Using this macro you don't have to think about error prefixes. */ |
| 62 /* Of course, if module errors are not active, the above example is */ |
| 63 /* the same as */ |
| 64 /* */ |
| 65 /* if ( error == FT_Err_Invalid_Outline ) */ |
| 66 /* ... */ |
| 67 /* */ |
| 68 /* FT_ERROR_BASE( errcode ) */ |
| 69 /* FT_ERROR_MODULE( errcode ) */ |
| 70 /* Get base error and module error code, respectively. */ |
| 71 /* */ |
32 /* */ | 72 /* */ |
33 /* It can also be used to create a module error message table easily */ | 73 /* It can also be used to create a module error message table easily */ |
34 /* with something like */ | 74 /* with something like */ |
35 /* */ | 75 /* */ |
36 /* { */ | 76 /* { */ |
37 /* #undef __FTMODERR_H__ */ | 77 /* #undef __FTMODERR_H__ */ |
38 /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ | 78 /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ |
39 /* #define FT_MODERR_START_LIST { */ | 79 /* #define FT_MODERR_START_LIST { */ |
40 /* #define FT_MODERR_END_LIST { 0, 0 } }; */ | 80 /* #define FT_MODERR_END_LIST { 0, 0 } }; */ |
41 /* */ | 81 /* */ |
42 /* const struct */ | 82 /* const struct */ |
43 /* { */ | 83 /* { */ |
44 /* int mod_err_offset; */ | 84 /* int mod_err_offset; */ |
45 /* const char* mod_err_msg */ | 85 /* const char* mod_err_msg */ |
46 /* } ft_mod_errors[] = */ | 86 /* } ft_mod_errors[] = */ |
47 /* */ | 87 /* */ |
48 /* #include FT_MODULE_ERRORS_H */ | 88 /* #include FT_MODULE_ERRORS_H */ |
49 /* } */ | 89 /* } */ |
50 /* */ | 90 /* */ |
51 /* To use such a table, all errors must be ANDed with 0xFF00 to remove */ | |
52 /* the error code. */ | |
53 /* */ | |
54 /*************************************************************************/ | 91 /*************************************************************************/ |
55 | 92 |
56 | 93 |
57 #ifndef __FTMODERR_H__ | 94 #ifndef __FTMODERR_H__ |
58 #define __FTMODERR_H__ | 95 #define __FTMODERR_H__ |
59 | 96 |
60 | 97 |
61 /*******************************************************************/ | 98 /*******************************************************************/ |
62 /*******************************************************************/ | 99 /*******************************************************************/ |
63 /***** *****/ | 100 /***** *****/ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) | 154 FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) |
118 FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) | 155 FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) |
119 FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) | 156 FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) |
120 FT_MODERRDEF( Raster, 0xF00, "raster module" ) | 157 FT_MODERRDEF( Raster, 0xF00, "raster module" ) |
121 FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) | 158 FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) |
122 FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) | 159 FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) |
123 FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) | 160 FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) |
124 FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) | 161 FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) |
125 FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) | 162 FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) |
126 FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) | 163 FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) |
| 164 FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) |
127 | 165 |
128 | 166 |
129 #ifdef FT_MODERR_END_LIST | 167 #ifdef FT_MODERR_END_LIST |
130 FT_MODERR_END_LIST | 168 FT_MODERR_END_LIST |
131 #endif | 169 #endif |
132 | 170 |
133 | 171 |
134 /*******************************************************************/ | 172 /*******************************************************************/ |
135 /*******************************************************************/ | 173 /*******************************************************************/ |
136 /***** *****/ | 174 /***** *****/ |
(...skipping 10 matching lines...) Expand all Loading... |
147 #undef FT_MODERR_START_LIST | 185 #undef FT_MODERR_START_LIST |
148 #undef FT_MODERR_END_LIST | 186 #undef FT_MODERR_END_LIST |
149 #undef FT_MODERRDEF | 187 #undef FT_MODERRDEF |
150 #undef FT_NEED_EXTERN_C | 188 #undef FT_NEED_EXTERN_C |
151 | 189 |
152 | 190 |
153 #endif /* __FTMODERR_H__ */ | 191 #endif /* __FTMODERR_H__ */ |
154 | 192 |
155 | 193 |
156 /* END */ | 194 /* END */ |
OLD | NEW |