/src/compiler/android-ndk/jni/freetype/include/freetype/fterrors.h

http://ftk.googlecode.com/ · C++ Header · 206 lines · 54 code · 44 blank · 108 comment · 0 complexity · 1ab702bcd64b97d7ae63b0c92d9e9777 MD5 · raw file

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