OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* fterrors.h */ | 3 /* fterrors.h */ |
4 /* */ | 4 /* */ |
5 /* FreeType error code handling (specification). */ | 5 /* FreeType error code handling (specification). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2002, 2004, 2007, 2013 by */ | 7 /* Copyright 1996-2015 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 special header file is used to define the handling of FT2 */ | 21 /* <Section> */ |
22 /* enumeration constants. It can also be used to generate error message */ | 22 /* error_enumerations */ |
23 /* strings with a small macro trick explained below. */ | |
24 /* */ | 23 /* */ |
25 /* I - Error Formats */ | 24 /* <Title> */ |
26 /* ----------------- */ | 25 /* Error Enumerations */ |
| 26 /* */ |
| 27 /* <Abstract> */ |
| 28 /* How to handle errors and error strings. */ |
| 29 /* */ |
| 30 /* <Description> */ |
| 31 /* The header file `fterrors.h' (which is automatically included by */ |
| 32 /* `freetype.h' defines the handling of FreeType's enumeration */ |
| 33 /* constants. It can also be used to generate error message strings */ |
| 34 /* with a small macro trick explained below. */ |
| 35 /* */ |
| 36 /* *Error* *Formats* */ |
27 /* */ | 37 /* */ |
28 /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ | 38 /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ |
29 /* defined in ftoption.h in order to make the higher byte indicate */ | 39 /* defined in `ftoption.h' in order to make the higher byte indicate */ |
30 /* the module where the error has happened (this is not compatible */ | 40 /* the module where the error has happened (this is not compatible */ |
31 /* with standard builds of FreeType 2). See the file `ftmoderr.h' for */ | 41 /* with standard builds of FreeType 2, however). See the file */ |
32 /* more details. */ | 42 /* `ftmoderr.h' for more details. */ |
33 /* */ | 43 /* */ |
| 44 /* *Error* *Message* *Strings* */ |
34 /* */ | 45 /* */ |
35 /* II - Error Message strings */ | 46 /* Error definitions are set up with special macros that allow client */ |
36 /* -------------------------- */ | 47 /* applications to build a table of error message strings. The */ |
37 /* */ | 48 /* strings are not included in a normal build of FreeType 2 to */ |
38 /* The error definitions below are made through special macros that */ | 49 /* save space (most client applications do not use them). */ |
39 /* allow client applications to build a table of error message strings */ | |
40 /* if they need it. The strings are not included in a normal build of */ | |
41 /* FreeType 2 to save space (most client applications do not use */ | |
42 /* them). */ | |
43 /* */ | 50 /* */ |
44 /* To do so, you have to define the following macros before including */ | 51 /* To do so, you have to define the following macros before including */ |
45 /* this file: */ | |
46 /* */ | |
47 /* FT_ERROR_START_LIST :: */ | |
48 /* This macro is called before anything else to define the start of */ | |
49 /* the error list. It is followed by several FT_ERROR_DEF calls */ | |
50 /* (see below). */ | |
51 /* */ | |
52 /* FT_ERROR_DEF( e, v, s ) :: */ | |
53 /* This macro is called to define one single error. */ | |
54 /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ | |
55 /* `v' is the error numerical value. */ | |
56 /* `s' is the corresponding error string. */ | |
57 /* */ | |
58 /* FT_ERROR_END_LIST :: */ | |
59 /* This macro ends the list. */ | |
60 /* */ | |
61 /* Additionally, you have to undefine __FTERRORS_H__ before #including */ | |
62 /* this file. */ | 52 /* this file. */ |
63 /* */ | 53 /* */ |
64 /* Here is a simple example: */ | 54 /* { */ |
| 55 /* FT_ERROR_START_LIST */ |
| 56 /* } */ |
65 /* */ | 57 /* */ |
| 58 /* This macro is called before anything else to define the start of */ |
| 59 /* the error list. It is followed by several FT_ERROR_DEF calls. */ |
| 60 /* */ |
| 61 /* { */ |
| 62 /* FT_ERROR_DEF( e, v, s ) */ |
| 63 /* } */ |
| 64 /* */ |
| 65 /* This macro is called to define one single error. `e' is the error */ |
| 66 /* code identifier (e.g., `Invalid_Argument'), `v' is the error's */ |
| 67 /* numerical value, and `s' is the corresponding error string. */ |
| 68 /* */ |
| 69 /* { */ |
| 70 /* FT_ERROR_END_LIST */ |
| 71 /* } */ |
| 72 /* */ |
| 73 /* This macro ends the list. */ |
| 74 /* */ |
| 75 /* Additionally, you have to undefine `__FTERRORS_H__' before */ |
| 76 /* #including this file. */ |
| 77 /* */ |
| 78 /* Here is a simple example. */ |
| 79 /* */ |
| 80 /* { */ |
| 81 /* #undef __FTERRORS_H__ */ |
| 82 /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ |
| 83 /* #define FT_ERROR_START_LIST { */ |
| 84 /* #define FT_ERROR_END_LIST { 0, NULL } }; */ |
| 85 /* */ |
| 86 /* const struct */ |
66 /* { */ | 87 /* { */ |
67 /* #undef __FTERRORS_H__ */ | 88 /* int err_code; */ |
68 /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ | 89 /* const char* err_msg; */ |
69 /* #define FT_ERROR_START_LIST { */ | 90 /* } ft_errors[] = */ |
70 /* #define FT_ERROR_END_LIST { 0, 0 } }; */ | |
71 /* */ | 91 /* */ |
72 /* const struct */ | 92 /* #include FT_ERRORS_H */ |
73 /* { */ | 93 /* } */ |
74 /* int err_code; */ | |
75 /* const char* err_msg; */ | |
76 /* } ft_errors[] = */ | |
77 /* */ | 94 /* */ |
78 /* #include FT_ERRORS_H */ | 95 /* Note that `FT_Err_Ok' is _not_ defined with `FT_ERRORDEF' but with */ |
79 /* } */ | 96 /* `FT_NOERRORDEF'; it is always zero. */ |
80 /* */ | 97 /* */ |
81 /*************************************************************************/ | 98 /*************************************************************************/ |
82 | 99 |
| 100 /* */ |
83 | 101 |
84 #ifndef __FTERRORS_H__ | 102 #ifndef __FTERRORS_H__ |
85 #define __FTERRORS_H__ | 103 #define __FTERRORS_H__ |
86 | 104 |
87 | 105 |
88 /* include module base error codes */ | 106 /* include module base error codes */ |
89 #include FT_MODULE_ERRORS_H | 107 #include FT_MODULE_ERRORS_H |
90 | 108 |
91 | 109 |
92 /*******************************************************************/ | 110 /*******************************************************************/ |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 207 |
190 /* FT_ERR_PREFIX is needed internally */ | 208 /* FT_ERR_PREFIX is needed internally */ |
191 #ifndef FT2_BUILD_LIBRARY | 209 #ifndef FT2_BUILD_LIBRARY |
192 #undef FT_ERR_PREFIX | 210 #undef FT_ERR_PREFIX |
193 #endif | 211 #endif |
194 | 212 |
195 #endif /* __FTERRORS_H__ */ | 213 #endif /* __FTERRORS_H__ */ |
196 | 214 |
197 | 215 |
198 /* END */ | 216 /* END */ |
OLD | NEW |