freetype2/include/fterrors.h

199 lines
9.1 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* fterrors.h */
/* */
/* FreeType error code handling (specification). */
/* */
/* Copyright 1996-2002, 2004, 2007, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
2001-06-20 01:03:41 +02:00
/*************************************************************************/
/* */
/* This special header file is used to define the handling of FT2 */
/* enumeration constants. It can also be used to generate error message */
/* strings with a small macro trick explained below. */
2001-06-20 01:03:41 +02:00
/* */
/* I - Error Formats */
/* ----------------- */
/* */
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
/* defined in ftoption.h in order to make the higher byte indicate */
/* the module where the error has happened (this is not compatible */
/* with standard builds of FreeType 2). See the file `ftmoderr.h' for */
/* more details. */
2001-06-20 01:03:41 +02:00
/* */
/* */
/* II - Error Message strings */
/* -------------------------- */
/* */
/* The error definitions below are made through special macros that */
/* allow client applications to build a table of error message strings */
/* if they need it. The strings are not included in a normal build of */
/* FreeType 2 to save space (most client applications do not use */
/* them). */
/* */
/* To do so, you have to define the following macros before including */
/* this file: */
/* */
/* FT_ERROR_START_LIST :: */
/* This macro is called before anything else to define the start of */
/* the error list. It is followed by several FT_ERROR_DEF calls */
/* (see below). */
/* */
/* FT_ERROR_DEF( e, v, s ) :: */
/* This macro is called to define one single error. */
/* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */
/* `v' is the error numerical value. */
/* `s' is the corresponding error string. */
/* */
/* FT_ERROR_END_LIST :: */
/* This macro ends the list. */
/* */
/* Additionally, you have to undefine __FTERRORS_H__ before #including */
/* this file. */
/* */
/* Here is a simple example: */
/* */
/* { */
/* #undef __FTERRORS_H__ */
/* #define FT_ERRORDEF( e, v, s ) { e, s }, */
/* #define FT_ERROR_START_LIST { */
/* #define FT_ERROR_END_LIST { 0, 0 } }; */
2001-06-20 01:03:41 +02:00
/* */
/* const struct */
/* { */
/* int err_code; */
2007-01-23 07:29:23 +01:00
/* const char* err_msg; */
2001-06-20 01:03:41 +02:00
/* } ft_errors[] = */
/* */
/* #include FT_ERRORS_H */
/* } */
/* */
/*************************************************************************/
#ifndef __FTERRORS_H__
#define __FTERRORS_H__
2001-06-20 01:03:41 +02:00
/* include module base error codes */
#include FT_MODULE_ERRORS_H
2001-06-20 01:03:41 +02:00
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SETUP MACROS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
2001-06-20 01:03:41 +02:00
2001-06-20 01:03:41 +02:00
#undef FT_NEED_EXTERN_C
2001-06-20 01:03:41 +02:00
/* FT_ERR_PREFIX is used as a prefix for error identifiers. */
/* By default, we use `FT_Err_'. */
/* */
#ifndef FT_ERR_PREFIX
#define FT_ERR_PREFIX FT_Err_
#endif
2001-06-20 01:03:41 +02:00
/* FT_ERR_BASE is used as the base for module-specific errors. */
/* */
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
2001-06-20 01:03:41 +02:00
#ifndef FT_ERR_BASE
#define FT_ERR_BASE FT_Mod_Err_Base
#endif
2001-06-20 01:03:41 +02:00
#else
#undef FT_ERR_BASE
2001-06-20 01:03:41 +02:00
#define FT_ERR_BASE 0
2001-06-20 01:03:41 +02:00
#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
Complete redesign of error codes. Please check ftmoderr.h for more details. * include/freetype/internal/cfferrs.h, include/freetype/internal/tterrors.h, include/freetype/internal/t1errors.h: Removed. Replaced with files local to the module. All extra error codes have been moved to `fterrors.h'. * src/sfnt/ttpost.h: Move error codes to `fterrors.h'. * src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h, src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h, src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h, src/smooth/ftsmerrs.h, src/truetype/tterrors.h, src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the error names for the module it belongs to. * include/freetype/ftmoderr.h: New file, defining the module error offsets. Its structure is similar to `fterrors.h'. * include/freetype/fterrors.h (FT_NOERRORDEF): New macro. (FT_ERRORDEF): Redefined to use module error offsets. All internal error codes are now public; unused error codes have been removed, some are new. * include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New macro. * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro. All other source files have been updated to use the new error codes; some already existing (internal) error codes local to a module have been renamed to give them the same name as in the base module. All make files have been updated to include the local error files. * src/cid/cidtokens.h: Replaced with... * src/cid/cidtoken.h: This file for 8+3 consistency. * src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
2001-06-20 01:03:41 +02:00
/* If FT_ERRORDEF is not defined, we need to define a simple */
/* enumeration type. */
/* */
#ifndef FT_ERRORDEF
2001-06-20 01:03:41 +02:00
#define FT_ERRORDEF( e, v, s ) e = v,
#define FT_ERROR_START_LIST enum {
#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
2001-06-20 01:03:41 +02:00
#ifdef __cplusplus
#define FT_NEED_EXTERN_C
extern "C" {
#endif
2001-06-20 01:03:41 +02:00
#endif /* !FT_ERRORDEF */
2001-06-20 01:03:41 +02:00
/* this macro is used to define an error */
#define FT_ERRORDEF_( e, v, s ) \
2001-06-20 01:03:41 +02:00
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
/* this is only used for <module>_Err_Ok, which must be 0! */
#define FT_NOERRORDEF_( e, v, s ) \
2001-06-20 01:03:41 +02:00
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
#ifdef FT_ERROR_START_LIST
FT_ERROR_START_LIST
#endif
Complete redesign of error codes. Please check ftmoderr.h for more details. * include/freetype/internal/cfferrs.h, include/freetype/internal/tterrors.h, include/freetype/internal/t1errors.h: Removed. Replaced with files local to the module. All extra error codes have been moved to `fterrors.h'. * src/sfnt/ttpost.h: Move error codes to `fterrors.h'. * src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h, src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h, src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h, src/smooth/ftsmerrs.h, src/truetype/tterrors.h, src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the error names for the module it belongs to. * include/freetype/ftmoderr.h: New file, defining the module error offsets. Its structure is similar to `fterrors.h'. * include/freetype/fterrors.h (FT_NOERRORDEF): New macro. (FT_ERRORDEF): Redefined to use module error offsets. All internal error codes are now public; unused error codes have been removed, some are new. * include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New macro. * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro. All other source files have been updated to use the new error codes; some already existing (internal) error codes local to a module have been renamed to give them the same name as in the base module. All make files have been updated to include the local error files. * src/cid/cidtokens.h: Replaced with... * src/cid/cidtoken.h: This file for 8+3 consistency. * src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
2001-06-20 01:03:41 +02:00
/* now include the error codes */
#include FT_ERROR_DEFINITIONS_H
#ifdef FT_ERROR_END_LIST
FT_ERROR_END_LIST
#endif
2001-06-20 01:03:41 +02:00
/*******************************************************************/
/*******************************************************************/
/***** *****/
2001-06-20 01:03:41 +02:00
/***** SIMPLE CLEANUP *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_NEED_EXTERN_C
}
#endif
#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
#undef FT_ERRORDEF
#undef FT_ERRORDEF_
#undef FT_NOERRORDEF_
#undef FT_NEED_EXTERN_C
#undef FT_ERR_BASE
/* FT_ERR_PREFIX is needed internally */
#ifndef FT2_BUILD_LIBRARY
#undef FT_ERR_PREFIX
#endif
#endif /* __FTERRORS_H__ */
/* END */