vrshoot
diff 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 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/ft2static/freetype/fterrors.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,206 @@ 1.4 +/***************************************************************************/ 1.5 +/* */ 1.6 +/* fterrors.h */ 1.7 +/* */ 1.8 +/* FreeType error code handling (specification). */ 1.9 +/* */ 1.10 +/* Copyright 1996-2001, 2002, 2004, 2007 by */ 1.11 +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ 1.12 +/* */ 1.13 +/* This file is part of the FreeType project, and may only be used, */ 1.14 +/* modified, and distributed under the terms of the FreeType project */ 1.15 +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 1.16 +/* this file you indicate that you have read the license and */ 1.17 +/* understand and accept it fully. */ 1.18 +/* */ 1.19 +/***************************************************************************/ 1.20 + 1.21 + 1.22 + /*************************************************************************/ 1.23 + /* */ 1.24 + /* This special header file is used to define the handling of FT2 */ 1.25 + /* enumeration constants. It can also be used to generate error message */ 1.26 + /* strings with a small macro trick explained below. */ 1.27 + /* */ 1.28 + /* I - Error Formats */ 1.29 + /* ----------------- */ 1.30 + /* */ 1.31 + /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ 1.32 + /* defined in ftoption.h in order to make the higher byte indicate */ 1.33 + /* the module where the error has happened (this is not compatible */ 1.34 + /* with standard builds of FreeType 2). You can then use the macro */ 1.35 + /* FT_ERROR_BASE macro to extract the generic error code from an */ 1.36 + /* FT_Error value. */ 1.37 + /* */ 1.38 + /* */ 1.39 + /* II - Error Message strings */ 1.40 + /* -------------------------- */ 1.41 + /* */ 1.42 + /* The error definitions below are made through special macros that */ 1.43 + /* allow client applications to build a table of error message strings */ 1.44 + /* if they need it. The strings are not included in a normal build of */ 1.45 + /* FreeType 2 to save space (most client applications do not use */ 1.46 + /* them). */ 1.47 + /* */ 1.48 + /* To do so, you have to define the following macros before including */ 1.49 + /* this file: */ 1.50 + /* */ 1.51 + /* FT_ERROR_START_LIST :: */ 1.52 + /* This macro is called before anything else to define the start of */ 1.53 + /* the error list. It is followed by several FT_ERROR_DEF calls */ 1.54 + /* (see below). */ 1.55 + /* */ 1.56 + /* FT_ERROR_DEF( e, v, s ) :: */ 1.57 + /* This macro is called to define one single error. */ 1.58 + /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ 1.59 + /* `v' is the error numerical value. */ 1.60 + /* `s' is the corresponding error string. */ 1.61 + /* */ 1.62 + /* FT_ERROR_END_LIST :: */ 1.63 + /* This macro ends the list. */ 1.64 + /* */ 1.65 + /* Additionally, you have to undefine __FTERRORS_H__ before #including */ 1.66 + /* this file. */ 1.67 + /* */ 1.68 + /* Here is a simple example: */ 1.69 + /* */ 1.70 + /* { */ 1.71 + /* #undef __FTERRORS_H__ */ 1.72 + /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ 1.73 + /* #define FT_ERROR_START_LIST { */ 1.74 + /* #define FT_ERROR_END_LIST { 0, 0 } }; */ 1.75 + /* */ 1.76 + /* const struct */ 1.77 + /* { */ 1.78 + /* int err_code; */ 1.79 + /* const char* err_msg; */ 1.80 + /* } ft_errors[] = */ 1.81 + /* */ 1.82 + /* #include FT_ERRORS_H */ 1.83 + /* } */ 1.84 + /* */ 1.85 + /*************************************************************************/ 1.86 + 1.87 + 1.88 +#ifndef __FTERRORS_H__ 1.89 +#define __FTERRORS_H__ 1.90 + 1.91 + 1.92 + /* include module base error codes */ 1.93 +#include FT_MODULE_ERRORS_H 1.94 + 1.95 + 1.96 + /*******************************************************************/ 1.97 + /*******************************************************************/ 1.98 + /***** *****/ 1.99 + /***** SETUP MACROS *****/ 1.100 + /***** *****/ 1.101 + /*******************************************************************/ 1.102 + /*******************************************************************/ 1.103 + 1.104 + 1.105 +#undef FT_NEED_EXTERN_C 1.106 + 1.107 +#undef FT_ERR_XCAT 1.108 +#undef FT_ERR_CAT 1.109 + 1.110 +#define FT_ERR_XCAT( x, y ) x ## y 1.111 +#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) 1.112 + 1.113 + 1.114 + /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ 1.115 + /* By default, we use `FT_Err_'. */ 1.116 + /* */ 1.117 +#ifndef FT_ERR_PREFIX 1.118 +#define FT_ERR_PREFIX FT_Err_ 1.119 +#endif 1.120 + 1.121 + 1.122 + /* FT_ERR_BASE is used as the base for module-specific errors. */ 1.123 + /* */ 1.124 +#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS 1.125 + 1.126 +#ifndef FT_ERR_BASE 1.127 +#define FT_ERR_BASE FT_Mod_Err_Base 1.128 +#endif 1.129 + 1.130 +#else 1.131 + 1.132 +#undef FT_ERR_BASE 1.133 +#define FT_ERR_BASE 0 1.134 + 1.135 +#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ 1.136 + 1.137 + 1.138 + /* If FT_ERRORDEF is not defined, we need to define a simple */ 1.139 + /* enumeration type. */ 1.140 + /* */ 1.141 +#ifndef FT_ERRORDEF 1.142 + 1.143 +#define FT_ERRORDEF( e, v, s ) e = v, 1.144 +#define FT_ERROR_START_LIST enum { 1.145 +#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; 1.146 + 1.147 +#ifdef __cplusplus 1.148 +#define FT_NEED_EXTERN_C 1.149 + extern "C" { 1.150 +#endif 1.151 + 1.152 +#endif /* !FT_ERRORDEF */ 1.153 + 1.154 + 1.155 + /* this macro is used to define an error */ 1.156 +#define FT_ERRORDEF_( e, v, s ) \ 1.157 + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) 1.158 + 1.159 + /* this is only used for <module>_Err_Ok, which must be 0! */ 1.160 +#define FT_NOERRORDEF_( e, v, s ) \ 1.161 + FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) 1.162 + 1.163 + 1.164 +#ifdef FT_ERROR_START_LIST 1.165 + FT_ERROR_START_LIST 1.166 +#endif 1.167 + 1.168 + 1.169 + /* now include the error codes */ 1.170 +#include FT_ERROR_DEFINITIONS_H 1.171 + 1.172 + 1.173 +#ifdef FT_ERROR_END_LIST 1.174 + FT_ERROR_END_LIST 1.175 +#endif 1.176 + 1.177 + 1.178 + /*******************************************************************/ 1.179 + /*******************************************************************/ 1.180 + /***** *****/ 1.181 + /***** SIMPLE CLEANUP *****/ 1.182 + /***** *****/ 1.183 + /*******************************************************************/ 1.184 + /*******************************************************************/ 1.185 + 1.186 +#ifdef FT_NEED_EXTERN_C 1.187 + } 1.188 +#endif 1.189 + 1.190 +#undef FT_ERROR_START_LIST 1.191 +#undef FT_ERROR_END_LIST 1.192 + 1.193 +#undef FT_ERRORDEF 1.194 +#undef FT_ERRORDEF_ 1.195 +#undef FT_NOERRORDEF_ 1.196 + 1.197 +#undef FT_NEED_EXTERN_C 1.198 +#undef FT_ERR_CONCAT 1.199 +#undef FT_ERR_BASE 1.200 + 1.201 + /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ 1.202 +#ifndef FT_KEEP_ERR_PREFIX 1.203 +#undef FT_ERR_PREFIX 1.204 +#endif 1.205 + 1.206 +#endif /* __FTERRORS_H__ */ 1.207 + 1.208 + 1.209 +/* END */