vrshoot

annotate libs/ft2static/freetype/fterrors.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
rev   line source
nuclear@0 1 /***************************************************************************/
nuclear@0 2 /* */
nuclear@0 3 /* fterrors.h */
nuclear@0 4 /* */
nuclear@0 5 /* FreeType error code handling (specification). */
nuclear@0 6 /* */
nuclear@0 7 /* Copyright 1996-2001, 2002, 2004, 2007 by */
nuclear@0 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
nuclear@0 9 /* */
nuclear@0 10 /* This file is part of the FreeType project, and may only be used, */
nuclear@0 11 /* modified, and distributed under the terms of the FreeType project */
nuclear@0 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
nuclear@0 13 /* this file you indicate that you have read the license and */
nuclear@0 14 /* understand and accept it fully. */
nuclear@0 15 /* */
nuclear@0 16 /***************************************************************************/
nuclear@0 17
nuclear@0 18
nuclear@0 19 /*************************************************************************/
nuclear@0 20 /* */
nuclear@0 21 /* This special header file is used to define the handling of FT2 */
nuclear@0 22 /* enumeration constants. It can also be used to generate error message */
nuclear@0 23 /* strings with a small macro trick explained below. */
nuclear@0 24 /* */
nuclear@0 25 /* I - Error Formats */
nuclear@0 26 /* ----------------- */
nuclear@0 27 /* */
nuclear@0 28 /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
nuclear@0 29 /* defined in ftoption.h in order to make the higher byte indicate */
nuclear@0 30 /* the module where the error has happened (this is not compatible */
nuclear@0 31 /* with standard builds of FreeType 2). You can then use the macro */
nuclear@0 32 /* FT_ERROR_BASE macro to extract the generic error code from an */
nuclear@0 33 /* FT_Error value. */
nuclear@0 34 /* */
nuclear@0 35 /* */
nuclear@0 36 /* II - Error Message strings */
nuclear@0 37 /* -------------------------- */
nuclear@0 38 /* */
nuclear@0 39 /* The error definitions below are made through special macros that */
nuclear@0 40 /* allow client applications to build a table of error message strings */
nuclear@0 41 /* if they need it. The strings are not included in a normal build of */
nuclear@0 42 /* FreeType 2 to save space (most client applications do not use */
nuclear@0 43 /* them). */
nuclear@0 44 /* */
nuclear@0 45 /* To do so, you have to define the following macros before including */
nuclear@0 46 /* this file: */
nuclear@0 47 /* */
nuclear@0 48 /* FT_ERROR_START_LIST :: */
nuclear@0 49 /* This macro is called before anything else to define the start of */
nuclear@0 50 /* the error list. It is followed by several FT_ERROR_DEF calls */
nuclear@0 51 /* (see below). */
nuclear@0 52 /* */
nuclear@0 53 /* FT_ERROR_DEF( e, v, s ) :: */
nuclear@0 54 /* This macro is called to define one single error. */
nuclear@0 55 /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */
nuclear@0 56 /* `v' is the error numerical value. */
nuclear@0 57 /* `s' is the corresponding error string. */
nuclear@0 58 /* */
nuclear@0 59 /* FT_ERROR_END_LIST :: */
nuclear@0 60 /* This macro ends the list. */
nuclear@0 61 /* */
nuclear@0 62 /* Additionally, you have to undefine __FTERRORS_H__ before #including */
nuclear@0 63 /* this file. */
nuclear@0 64 /* */
nuclear@0 65 /* Here is a simple example: */
nuclear@0 66 /* */
nuclear@0 67 /* { */
nuclear@0 68 /* #undef __FTERRORS_H__ */
nuclear@0 69 /* #define FT_ERRORDEF( e, v, s ) { e, s }, */
nuclear@0 70 /* #define FT_ERROR_START_LIST { */
nuclear@0 71 /* #define FT_ERROR_END_LIST { 0, 0 } }; */
nuclear@0 72 /* */
nuclear@0 73 /* const struct */
nuclear@0 74 /* { */
nuclear@0 75 /* int err_code; */
nuclear@0 76 /* const char* err_msg; */
nuclear@0 77 /* } ft_errors[] = */
nuclear@0 78 /* */
nuclear@0 79 /* #include FT_ERRORS_H */
nuclear@0 80 /* } */
nuclear@0 81 /* */
nuclear@0 82 /*************************************************************************/
nuclear@0 83
nuclear@0 84
nuclear@0 85 #ifndef __FTERRORS_H__
nuclear@0 86 #define __FTERRORS_H__
nuclear@0 87
nuclear@0 88
nuclear@0 89 /* include module base error codes */
nuclear@0 90 #include FT_MODULE_ERRORS_H
nuclear@0 91
nuclear@0 92
nuclear@0 93 /*******************************************************************/
nuclear@0 94 /*******************************************************************/
nuclear@0 95 /***** *****/
nuclear@0 96 /***** SETUP MACROS *****/
nuclear@0 97 /***** *****/
nuclear@0 98 /*******************************************************************/
nuclear@0 99 /*******************************************************************/
nuclear@0 100
nuclear@0 101
nuclear@0 102 #undef FT_NEED_EXTERN_C
nuclear@0 103
nuclear@0 104 #undef FT_ERR_XCAT
nuclear@0 105 #undef FT_ERR_CAT
nuclear@0 106
nuclear@0 107 #define FT_ERR_XCAT( x, y ) x ## y
nuclear@0 108 #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
nuclear@0 109
nuclear@0 110
nuclear@0 111 /* FT_ERR_PREFIX is used as a prefix for error identifiers. */
nuclear@0 112 /* By default, we use `FT_Err_'. */
nuclear@0 113 /* */
nuclear@0 114 #ifndef FT_ERR_PREFIX
nuclear@0 115 #define FT_ERR_PREFIX FT_Err_
nuclear@0 116 #endif
nuclear@0 117
nuclear@0 118
nuclear@0 119 /* FT_ERR_BASE is used as the base for module-specific errors. */
nuclear@0 120 /* */
nuclear@0 121 #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
nuclear@0 122
nuclear@0 123 #ifndef FT_ERR_BASE
nuclear@0 124 #define FT_ERR_BASE FT_Mod_Err_Base
nuclear@0 125 #endif
nuclear@0 126
nuclear@0 127 #else
nuclear@0 128
nuclear@0 129 #undef FT_ERR_BASE
nuclear@0 130 #define FT_ERR_BASE 0
nuclear@0 131
nuclear@0 132 #endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
nuclear@0 133
nuclear@0 134
nuclear@0 135 /* If FT_ERRORDEF is not defined, we need to define a simple */
nuclear@0 136 /* enumeration type. */
nuclear@0 137 /* */
nuclear@0 138 #ifndef FT_ERRORDEF
nuclear@0 139
nuclear@0 140 #define FT_ERRORDEF( e, v, s ) e = v,
nuclear@0 141 #define FT_ERROR_START_LIST enum {
nuclear@0 142 #define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
nuclear@0 143
nuclear@0 144 #ifdef __cplusplus
nuclear@0 145 #define FT_NEED_EXTERN_C
nuclear@0 146 extern "C" {
nuclear@0 147 #endif
nuclear@0 148
nuclear@0 149 #endif /* !FT_ERRORDEF */
nuclear@0 150
nuclear@0 151
nuclear@0 152 /* this macro is used to define an error */
nuclear@0 153 #define FT_ERRORDEF_( e, v, s ) \
nuclear@0 154 FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
nuclear@0 155
nuclear@0 156 /* this is only used for <module>_Err_Ok, which must be 0! */
nuclear@0 157 #define FT_NOERRORDEF_( e, v, s ) \
nuclear@0 158 FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
nuclear@0 159
nuclear@0 160
nuclear@0 161 #ifdef FT_ERROR_START_LIST
nuclear@0 162 FT_ERROR_START_LIST
nuclear@0 163 #endif
nuclear@0 164
nuclear@0 165
nuclear@0 166 /* now include the error codes */
nuclear@0 167 #include FT_ERROR_DEFINITIONS_H
nuclear@0 168
nuclear@0 169
nuclear@0 170 #ifdef FT_ERROR_END_LIST
nuclear@0 171 FT_ERROR_END_LIST
nuclear@0 172 #endif
nuclear@0 173
nuclear@0 174
nuclear@0 175 /*******************************************************************/
nuclear@0 176 /*******************************************************************/
nuclear@0 177 /***** *****/
nuclear@0 178 /***** SIMPLE CLEANUP *****/
nuclear@0 179 /***** *****/
nuclear@0 180 /*******************************************************************/
nuclear@0 181 /*******************************************************************/
nuclear@0 182
nuclear@0 183 #ifdef FT_NEED_EXTERN_C
nuclear@0 184 }
nuclear@0 185 #endif
nuclear@0 186
nuclear@0 187 #undef FT_ERROR_START_LIST
nuclear@0 188 #undef FT_ERROR_END_LIST
nuclear@0 189
nuclear@0 190 #undef FT_ERRORDEF
nuclear@0 191 #undef FT_ERRORDEF_
nuclear@0 192 #undef FT_NOERRORDEF_
nuclear@0 193
nuclear@0 194 #undef FT_NEED_EXTERN_C
nuclear@0 195 #undef FT_ERR_CONCAT
nuclear@0 196 #undef FT_ERR_BASE
nuclear@0 197
nuclear@0 198 /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */
nuclear@0 199 #ifndef FT_KEEP_ERR_PREFIX
nuclear@0 200 #undef FT_ERR_PREFIX
nuclear@0 201 #endif
nuclear@0 202
nuclear@0 203 #endif /* __FTERRORS_H__ */
nuclear@0 204
nuclear@0 205
nuclear@0 206 /* END */