Eneboo - Documentación para desarrolladores
|
00001 /* ************************************************************************** */ 00002 /* * For conditions of distribution and use, * */ 00003 /* * see copyright notice in libmng.h * */ 00004 /* ************************************************************************** */ 00005 /* * * */ 00006 /* * project : libmng * */ 00007 /* * file : libmng_error.h copyright (c) 2000 G.Juyn * */ 00008 /* * version : 1.0.0 * */ 00009 /* * * */ 00010 /* * purpose : Error functions (definition) * */ 00011 /* * * */ 00012 /* * author : G.Juyn * */ 00013 /* * web : http://www.3-t.com * */ 00014 /* * email : mailto:info@3-t.com * */ 00015 /* * * */ 00016 /* * comment : Definition of the generic error-codes and functions * */ 00017 /* * * */ 00018 /* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ 00019 /* * - added some errorcodes * */ 00020 /* * 0.5.1 - 05/08/2000 - G.Juyn * */ 00021 /* * - added some errorcodes * */ 00022 /* * - changed strict-ANSI stuff * */ 00023 /* * 0.5.1 - 05/11/2000 - G.Juyn * */ 00024 /* * - added application errorcodes (used with callbacks) * */ 00025 /* * - moved chunk-access errorcodes to severity 5 * */ 00026 /* * * */ 00027 /* * 0.5.2 - 05/20/2000 - G.Juyn * */ 00028 /* * - added JNG errorcodes * */ 00029 /* * 0.5.2 - 05/23/2000 - G.Juyn * */ 00030 /* * - added error tell-tale definition * */ 00031 /* * 0.5.2 - 05/30/2000 - G.Juyn * */ 00032 /* * - added errorcodes for delta-image processing * */ 00033 /* * 0.5.2 - 06/06/2000 - G.Juyn * */ 00034 /* * - added errorcode for delayed buffer-processing * */ 00035 /* * - moved errorcodes to "libmng.h" * */ 00036 /* * * */ 00037 /* * 0.9.1 - 07/15/2000 - G.Juyn * */ 00038 /* * - added macro + routine to set returncode without * */ 00039 /* * calling error callback * */ 00040 /* * * */ 00041 /* * 0.9.2 - 08/05/2000 - G.Juyn * */ 00042 /* * - changed file-prefixes * */ 00043 /* * * */ 00044 /* ************************************************************************** */ 00045 00046 #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) 00047 #pragma option -A /* force ANSI-C */ 00048 #endif 00049 00050 #ifndef _libmng_error_h_ 00051 #define _libmng_error_h_ 00052 00053 /* ************************************************************************** */ 00054 /* * * */ 00055 /* * Default error routines * */ 00056 /* * * */ 00057 /* ************************************************************************** */ 00058 00059 mng_bool mng_store_error (mng_datap pData, 00060 mng_retcode iError, 00061 mng_retcode iExtra1, 00062 mng_retcode iExtra2); 00063 00064 mng_bool mng_process_error (mng_datap pData, 00065 mng_retcode iError, 00066 mng_retcode iExtra1, 00067 mng_retcode iExtra2); 00068 00069 /* ************************************************************************** */ 00070 /* * * */ 00071 /* * Error handling macros * */ 00072 /* * * */ 00073 /* ************************************************************************** */ 00074 00075 #define MNG_ERROR(D,C) { mng_process_error (D, C, 0, 0); return C; } 00076 #define MNG_ERRORZ(D,Z) { mng_process_error (D, MNG_ZLIBERROR, Z, 0); return MNG_ZLIBERROR; } 00077 #define MNG_ERRORJ(D,J) { mng_process_error (D, MNG_JPEGERROR, J, 0); return MNG_JPEGERROR; } 00078 #define MNG_ERRORL(D,L) { mng_process_error (D, MNG_LCMSERROR, L, 0); return MNG_LCMSERROR; } 00079 00080 #define MNG_RETURN(D,C) { mng_store_error (D, C, 0, 0); return C; } 00081 00082 #define MNG_WARNING(D,C) { if (!mng_process_error (D, C, 0, 0)) return C; } 00083 00084 #define MNG_VALIDHANDLE(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \ 00085 return MNG_INVALIDHANDLE; } 00086 #define MNG_VALIDHANDLEX(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \ 00087 return 0; } 00088 #define MNG_VALIDCB(D,C) { if (!((mng_datap)D)->C) \ 00089 MNG_ERROR (((mng_datap)D), MNG_NOCALLBACK) } 00090 00091 /* ************************************************************************** */ 00092 /* * * */ 00093 /* * Error string-table entry * */ 00094 /* * * */ 00095 /* ************************************************************************** */ 00096 00097 typedef struct { 00098 mng_retcode iError; 00099 mng_pchar zErrortext; 00100 } mng_error_entry; 00101 typedef mng_error_entry * mng_error_entryp; 00102 00103 /* ************************************************************************** */ 00104 00105 #endif /* _libmng_error_h_ */ 00106 00107 /* ************************************************************************** */ 00108 /* * end of file * */ 00109 /* ************************************************************************** */