1 /***************************************************************************/ 2 /* */ 3 /* ftmoderr.h */ 4 /* */ 5 /* FreeType module error offsets (specification). */ 6 /* */ 7 /* Copyright 2001-2018 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 /*************************************************************************/ 20 /* */ 21 /* This file is used to define the FreeType module error codes. */ 22 /* */ 23 /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */ 24 /* set, the lower byte of an error value identifies the error code as */ 25 /* usual. In addition, the higher byte identifies the module. For */ 26 /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */ 27 /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */ 28 /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */ 29 /* */ 30 /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */ 31 /* including the high byte. */ 32 /* */ 33 /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */ 34 /* an error value is set to zero. */ 35 /* */ 36 /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */ 37 /* provides some macros in `fttypes.h'. */ 38 /* */ 39 /* FT_ERR( err ) */ 40 /* Add current error module prefix (as defined with the */ 41 /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */ 42 /* the line */ 43 /* */ 44 /* error = FT_ERR( Invalid_Outline ); */ 45 /* */ 46 /* expands to */ 47 /* */ 48 /* error = BDF_Err_Invalid_Outline; */ 49 /* */ 50 /* For simplicity, you can always use `FT_Err_Ok' directly instead */ 51 /* of `FT_ERR( Ok )'. */ 52 /* */ 53 /* FT_ERR_EQ( errcode, err ) */ 54 /* FT_ERR_NEQ( errcode, err ) */ 55 /* Compare error code `errcode' with the error `err' for equality */ 56 /* and inequality, respectively. Example: */ 57 /* */ 58 /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */ 59 /* ... */ 60 /* */ 61 /* Using this macro you don't have to think about error prefixes. */ 62 /* Of course, if module errors are not active, the above example is */ 63 /* the same as */ 64 /* */ 65 /* if ( error == FT_Err_Invalid_Outline ) */ 66 /* ... */ 67 /* */ 68 /* FT_ERROR_BASE( errcode ) */ 69 /* FT_ERROR_MODULE( errcode ) */ 70 /* Get base error and module error code, respectively. */ 71 /* */ 72 /* */ 73 /* It can also be used to create a module error message table easily */ 74 /* with something like */ 75 /* */ 76 /* { */ 77 /* #undef FTMODERR_H_ */ 78 /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ 79 /* #define FT_MODERR_START_LIST { */ 80 /* #define FT_MODERR_END_LIST { 0, 0 } }; */ 81 /* */ 82 /* const struct */ 83 /* { */ 84 /* int mod_err_offset; */ 85 /* const char* mod_err_msg */ 86 /* } ft_mod_errors[] = */ 87 /* */ 88 /* #include FT_MODULE_ERRORS_H */ 89 /* } */ 90 /* */ 91 /*************************************************************************/ 92 93 94 #ifndef FTMODERR_H_ 95 #define FTMODERR_H_ 96 97 98 /*******************************************************************/ 99 /*******************************************************************/ 100 /***** *****/ 101 /***** SETUP MACROS *****/ 102 /***** *****/ 103 /*******************************************************************/ 104 /*******************************************************************/ 105 106 107 #undef FT_NEED_EXTERN_C 108 109 #ifndef FT_MODERRDEF 110 111 #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS | 1 /**************************************************************************** 2 * 3 * ftmoderr.h 4 * 5 * FreeType module error offsets (specification). 6 * 7 * Copyright (C) 2001-2019 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 /************************************************************************** 20 * 21 * This file is used to define the FreeType module error codes. 22 * 23 * If the macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` in `ftoption.h` is 24 * set, the lower byte of an error value identifies the error code as 25 * usual. In addition, the higher byte identifies the module. For 26 * example, the error `FT_Err_Invalid_File_Format` has value 0x0003, the 27 * error `TT_Err_Invalid_File_Format` has value 0x1303, the error 28 * `T1_Err_Invalid_File_Format` has value 0x1403, etc. 29 * 30 * Note that `FT_Err_Ok`, `TT_Err_Ok`, etc. are always equal to zero, 31 * including the high byte. 32 * 33 * If `FT_CONFIG_OPTION_USE_MODULE_ERRORS` isn't set, the higher byte of an 34 * error value is set to zero. 35 * 36 * To hide the various `XXX_Err_` prefixes in the source code, FreeType 37 * provides some macros in `fttypes.h`. 38 * 39 * FT_ERR( err ) 40 * 41 * Add current error module prefix (as defined with the `FT_ERR_PREFIX` 42 * macro) to `err`. For example, in the BDF module the line 43 * 44 * ``` 45 * error = FT_ERR( Invalid_Outline ); 46 * ``` 47 * 48 * expands to 49 * 50 * ``` 51 * error = BDF_Err_Invalid_Outline; 52 * ``` 53 * 54 * For simplicity, you can always use `FT_Err_Ok` directly instead of 55 * `FT_ERR( Ok )`. 56 * 57 * FT_ERR_EQ( errcode, err ) 58 * FT_ERR_NEQ( errcode, err ) 59 * 60 * Compare error code `errcode` with the error `err` for equality and 61 * inequality, respectively. Example: 62 * 63 * ``` 64 * if ( FT_ERR_EQ( error, Invalid_Outline ) ) 65 * ... 66 * ``` 67 * 68 * Using this macro you don't have to think about error prefixes. Of 69 * course, if module errors are not active, the above example is the 70 * same as 71 * 72 * ``` 73 * if ( error == FT_Err_Invalid_Outline ) 74 * ... 75 * ``` 76 * 77 * FT_ERROR_BASE( errcode ) 78 * FT_ERROR_MODULE( errcode ) 79 * 80 * Get base error and module error code, respectively. 81 * 82 * It can also be used to create a module error message table easily with 83 * something like 84 * 85 * ``` 86 * #undef FTMODERR_H_ 87 * #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, 88 * #define FT_MODERR_START_LIST { 89 * #define FT_MODERR_END_LIST { 0, 0 } }; 90 * 91 * const struct 92 * { 93 * int mod_err_offset; 94 * const char* mod_err_msg 95 * } ft_mod_errors[] = 96 * 97 * #include FT_MODULE_ERRORS_H 98 * ``` 99 * 100 */ 101 102 103 #ifndef FTMODERR_H_ 104 #define FTMODERR_H_ 105 106 107 /*******************************************************************/ 108 /*******************************************************************/ 109 /***** *****/ 110 /***** SETUP MACROS *****/ 111 /***** *****/ 112 /*******************************************************************/ 113 /*******************************************************************/ 114 115 116 #undef FT_NEED_EXTERN_C 117 118 #ifndef FT_MODERRDEF 119 120 #ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS |