source: trunk/src/3rdparty/libmng/libmng_error.h

Last change on this file was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 6.7 KB
Line 
1/* ************************************************************************** */
2/* * For conditions of distribution and use, * */
3/* * see copyright notice in libmng.h * */
4/* ************************************************************************** */
5/* * * */
6/* * project : libmng * */
7/* * file : libmng_error.h copyright (c) 2000 G.Juyn * */
8/* * version : 1.0.0 * */
9/* * * */
10/* * purpose : Error functions (definition) * */
11/* * * */
12/* * author : G.Juyn * */
13/* * web : http://www.3-t.com * */
14/* * email : mailto:info@3-t.com * */
15/* * * */
16/* * comment : Definition of the generic error-codes and functions * */
17/* * * */
18/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */
19/* * - added some errorcodes * */
20/* * 0.5.1 - 05/08/2000 - G.Juyn * */
21/* * - added some errorcodes * */
22/* * - changed strict-ANSI stuff * */
23/* * 0.5.1 - 05/11/2000 - G.Juyn * */
24/* * - added application errorcodes (used with callbacks) * */
25/* * - moved chunk-access errorcodes to severity 5 * */
26/* * * */
27/* * 0.5.2 - 05/20/2000 - G.Juyn * */
28/* * - added JNG errorcodes * */
29/* * 0.5.2 - 05/23/2000 - G.Juyn * */
30/* * - added error tell-tale definition * */
31/* * 0.5.2 - 05/30/2000 - G.Juyn * */
32/* * - added errorcodes for delta-image processing * */
33/* * 0.5.2 - 06/06/2000 - G.Juyn * */
34/* * - added errorcode for delayed buffer-processing * */
35/* * - moved errorcodes to "libmng.h" * */
36/* * * */
37/* * 0.9.1 - 07/15/2000 - G.Juyn * */
38/* * - added macro + routine to set returncode without * */
39/* * calling error callback * */
40/* * * */
41/* * 0.9.2 - 08/05/2000 - G.Juyn * */
42/* * - changed file-prefixes * */
43/* * * */
44/* ************************************************************************** */
45
46#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
47#pragma option -A /* force ANSI-C */
48#endif
49
50#ifndef _libmng_error_h_
51#define _libmng_error_h_
52
53/* ************************************************************************** */
54/* * * */
55/* * Default error routines * */
56/* * * */
57/* ************************************************************************** */
58
59mng_bool mng_store_error (mng_datap pData,
60 mng_retcode iError,
61 mng_retcode iExtra1,
62 mng_retcode iExtra2);
63
64mng_bool mng_process_error (mng_datap pData,
65 mng_retcode iError,
66 mng_retcode iExtra1,
67 mng_retcode iExtra2);
68
69/* ************************************************************************** */
70/* * * */
71/* * Error handling macros * */
72/* * * */
73/* ************************************************************************** */
74
75#define MNG_ERROR(D,C) { mng_process_error (D, C, 0, 0); return C; }
76#define MNG_ERRORZ(D,Z) { mng_process_error (D, MNG_ZLIBERROR, Z, 0); return MNG_ZLIBERROR; }
77#define MNG_ERRORJ(D,J) { mng_process_error (D, MNG_JPEGERROR, J, 0); return MNG_JPEGERROR; }
78#define MNG_ERRORL(D,L) { mng_process_error (D, MNG_LCMSERROR, L, 0); return MNG_LCMSERROR; }
79
80#define MNG_RETURN(D,C) { mng_store_error (D, C, 0, 0); return C; }
81
82#define MNG_WARNING(D,C) { if (!mng_process_error (D, C, 0, 0)) return C; }
83
84#define MNG_VALIDHANDLE(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \
85 return MNG_INVALIDHANDLE; }
86#define MNG_VALIDHANDLEX(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \
87 return 0; }
88#define MNG_VALIDCB(D,C) { if (!((mng_datap)D)->C) \
89 MNG_ERROR (((mng_datap)D), MNG_NOCALLBACK) }
90
91/* ************************************************************************** */
92/* * * */
93/* * Error string-table entry * */
94/* * * */
95/* ************************************************************************** */
96
97typedef struct {
98 mng_retcode iError;
99 mng_pchar zErrortext;
100 } mng_error_entry;
101typedef mng_error_entry * mng_error_entryp;
102
103/* ************************************************************************** */
104
105#endif /* _libmng_error_h_ */
106
107/* ************************************************************************** */
108/* * end of file * */
109/* ************************************************************************** */
Note: See TracBrowser for help on using the repository browser.