ftmoderr.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /***************************************************************************/
  2. /* */
  3. /* ftmoderr.h */
  4. /* */
  5. /* FreeType module error offsets (specification). */
  6. /* */
  7. /* Copyright 2001-2005, 2010, 2013 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 file is used to define the FreeType module error codes. */
  20. /* */
  21. /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */
  22. /* set, the lower byte of an error value identifies the error code as */
  23. /* usual. In addition, the higher byte identifies the module. For */
  24. /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */
  25. /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */
  26. /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */
  27. /* */
  28. /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */
  29. /* including the high byte. */
  30. /* */
  31. /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */
  32. /* an error value is set to zero. */
  33. /* */
  34. /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */
  35. /* provides some macros in `fttypes.h'. */
  36. /* */
  37. /* FT_ERR( err ) */
  38. /* Add current error module prefix (as defined with the */
  39. /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */
  40. /* the line */
  41. /* */
  42. /* error = FT_ERR( Invalid_Outline ); */
  43. /* */
  44. /* expands to */
  45. /* */
  46. /* error = BDF_Err_Invalid_Outline; */
  47. /* */
  48. /* For simplicity, you can always use `FT_Err_Ok' directly instead */
  49. /* of `FT_ERR( Ok )'. */
  50. /* */
  51. /* FT_ERR_EQ( errcode, err ) */
  52. /* FT_ERR_NEQ( errcode, err ) */
  53. /* Compare error code `errcode' with the error `err' for equality */
  54. /* and inequality, respectively. Example: */
  55. /* */
  56. /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */
  57. /* ... */
  58. /* */
  59. /* Using this macro you don't have to think about error prefixes. */
  60. /* Of course, if module errors are not active, the above example is */
  61. /* the same as */
  62. /* */
  63. /* if ( error == FT_Err_Invalid_Outline ) */
  64. /* ... */
  65. /* */
  66. /* FT_ERROR_BASE( errcode ) */
  67. /* FT_ERROR_MODULE( errcode ) */
  68. /* Get base error and module error code, respectively. */
  69. /* */
  70. /* */
  71. /* It can also be used to create a module error message table easily */
  72. /* with something like */
  73. /* */
  74. /* { */
  75. /* #undef __FTMODERR_H__ */
  76. /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */
  77. /* #define FT_MODERR_START_LIST { */
  78. /* #define FT_MODERR_END_LIST { 0, 0 } }; */
  79. /* */
  80. /* const struct */
  81. /* { */
  82. /* int mod_err_offset; */
  83. /* const char* mod_err_msg */
  84. /* } ft_mod_errors[] = */
  85. /* */
  86. /* #include FT_MODULE_ERRORS_H */
  87. /* } */
  88. /* */
  89. /*************************************************************************/
  90. #ifndef __FTMODERR_H__
  91. #define __FTMODERR_H__
  92. /*******************************************************************/
  93. /*******************************************************************/
  94. /***** *****/
  95. /***** SETUP MACROS *****/
  96. /***** *****/
  97. /*******************************************************************/
  98. /*******************************************************************/
  99. #undef FT_NEED_EXTERN_C
  100. #ifndef FT_MODERRDEF
  101. #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
  102. #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
  103. #else
  104. #define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
  105. #endif
  106. #define FT_MODERR_START_LIST enum {
  107. #define FT_MODERR_END_LIST FT_Mod_Err_Max };
  108. #ifdef __cplusplus
  109. #define FT_NEED_EXTERN_C
  110. extern "C" {
  111. #endif
  112. #endif /* !FT_MODERRDEF */
  113. /*******************************************************************/
  114. /*******************************************************************/
  115. /***** *****/
  116. /***** LIST MODULE ERROR BASES *****/
  117. /***** *****/
  118. /*******************************************************************/
  119. /*******************************************************************/
  120. #ifdef FT_MODERR_START_LIST
  121. FT_MODERR_START_LIST
  122. #endif
  123. FT_MODERRDEF( Base, 0x000, "base module" )
  124. FT_MODERRDEF( Autofit, 0x100, "autofitter module" )
  125. FT_MODERRDEF( BDF, 0x200, "BDF module" )
  126. FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" )
  127. FT_MODERRDEF( Cache, 0x400, "cache module" )
  128. FT_MODERRDEF( CFF, 0x500, "CFF module" )
  129. FT_MODERRDEF( CID, 0x600, "CID module" )
  130. FT_MODERRDEF( Gzip, 0x700, "Gzip module" )
  131. FT_MODERRDEF( LZW, 0x800, "LZW module" )
  132. FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" )
  133. FT_MODERRDEF( PCF, 0xA00, "PCF module" )
  134. FT_MODERRDEF( PFR, 0xB00, "PFR module" )
  135. FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" )
  136. FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" )
  137. FT_MODERRDEF( PSnames, 0xE00, "PS names module" )
  138. FT_MODERRDEF( Raster, 0xF00, "raster module" )
  139. FT_MODERRDEF( SFNT, 0x1000, "SFNT module" )
  140. FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" )
  141. FT_MODERRDEF( TrueType, 0x1200, "TrueType module" )
  142. FT_MODERRDEF( Type1, 0x1300, "Type 1 module" )
  143. FT_MODERRDEF( Type42, 0x1400, "Type 42 module" )
  144. FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" )
  145. FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" )
  146. #ifdef FT_MODERR_END_LIST
  147. FT_MODERR_END_LIST
  148. #endif
  149. /*******************************************************************/
  150. /*******************************************************************/
  151. /***** *****/
  152. /***** CLEANUP *****/
  153. /***** *****/
  154. /*******************************************************************/
  155. /*******************************************************************/
  156. #ifdef FT_NEED_EXTERN_C
  157. }
  158. #endif
  159. #undef FT_MODERR_START_LIST
  160. #undef FT_MODERR_END_LIST
  161. #undef FT_MODERRDEF
  162. #undef FT_NEED_EXTERN_C
  163. #endif /* __FTMODERR_H__ */
  164. /* END */