]> git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/errors.h
Import cups.org releases
[thirdparty/cups.git] / pstoraster / errors.h
1 /* Copyright (C) 1989, 1995 Aladdin Enterprises. All rights reserved.
2
3 This file is part of GNU Ghostscript.
4
5 GNU Ghostscript is distributed in the hope that it will be useful, but
6 WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to
7 anyone for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing. Refer to
9 the GNU General Public License for full details.
10
11 Everyone is granted permission to copy, modify and redistribute GNU
12 Ghostscript, but only under the conditions described in the GNU General
13 Public License. A copy of this license is supposed to have been given to
14 you along with GNU Ghostscript so you can know your rights and
15 responsibilities. It should be in a file named COPYING. Among other
16 things, the copyright notice and this notice must be preserved on all
17 copies.
18
19 Aladdin Enterprises is not affiliated with the Free Software Foundation or
20 the GNU Project. GNU Ghostscript, as distributed by Aladdin Enterprises,
21 does not depend on any other GNU software.
22 */
23
24 /* errors.h */
25 /* Definition of error codes */
26
27 /*
28 * A procedure that may return an error always returns
29 * a non-negative value (zero, unless otherwise noted) for success,
30 * or negative for failure.
31 * We use ints rather than an enum to avoid a lot of casting.
32 */
33
34 /*
35 * The following peculiar structure allows us to include this file
36 * wherever error code definitions are needed, and use the same file
37 * to generate the table of error names by setting INCLUDE_ERROR_NAMES.
38 */
39
40 # ifdef INCLUDE_ERROR_NAMES
41
42 /* Define the error name table */
43 const char _ds *gs_error_names[] = {
44 #define _e_(code,name) name,
45
46 # else /* !INCLUDE_ERROR_NAMES */
47
48 extern const char _ds *gs_error_names[];
49 # define _e_(code,name)
50
51 #endif /* (!)INCLUDE_ERROR_NAMES */
52
53 /* ------ PostScript Level 1 errors ------ */
54
55 #define e_unknownerror (-1) /* unknown error */
56 _e_(e_unknown, "unknownerror")
57 #define e_dictfull (-2)
58 _e_(e_dictfull, "dictfull")
59 #define e_dictstackoverflow (-3)
60 _e_(e_dictstackoverflow, "dictstackoverflow")
61 #define e_dictstackunderflow (-4)
62 _e_(e_dictstackunderflow, "dictstackunderflow")
63 #define e_execstackoverflow (-5)
64 _e_(e_execstackoverflow, "execstackoverflow")
65 #define e_interrupt (-6)
66 /* We also need to define gs_error_interrupt, for gpcheck.h. */
67 #undef gs_error_interrupt
68 #define gs_error_interrupt e_interrupt
69 _e_(e_interrupt, "interrupt")
70 #define e_invalidaccess (-7)
71 _e_(e_invalidaccess, "invalidaccess")
72 #define e_invalidexit (-8)
73 _e_(e_invalidexit, "invalidexit")
74 #define e_invalidfileaccess (-9)
75 _e_(e_invalidfileaccess, "invalidfileaccess")
76 #define e_invalidfont (-10)
77 _e_(e_invalidfont, "invalidfont")
78 #define e_invalidrestore (-11)
79 _e_(e_invalidrestore, "invalidrestore")
80 #define e_ioerror (-12)
81 _e_(e_ioerror, "ioerror")
82 #define e_limitcheck (-13)
83 _e_(e_limitcheck, "limitcheck")
84 #define e_nocurrentpoint (-14)
85 _e_(e_nocurrentpoint, "nocurrentpoint")
86 #define e_rangecheck (-15)
87 _e_(e_rangecheck, "rangecheck")
88 #define e_stackoverflow (-16)
89 _e_(e_stackoverflow, "stackoverflow")
90 #define e_stackunderflow (-17)
91 _e_(e_stackunderflow, "stackunderflow")
92 #define e_syntaxerror (-18)
93 _e_(e_syntaxerror, "syntaxerror")
94 #define e_timeout (-19)
95 _e_(e_timeout, "timeout")
96 #define e_typecheck (-20)
97 _e_(e_typecheck, "typecheck")
98 #define e_undefined (-21)
99 _e_(e_undefined, "undefined")
100 #define e_undefinedfilename (-22)
101 _e_(e_undefinedfilename, "undefinedfilename")
102 #define e_undefinedresult (-23)
103 _e_(e_undefinedresult, "undefinedresult")
104 #define e_unmatchedmark (-24)
105 _e_(e_unmatchedmark, "unmatchedmark")
106 #define e_VMerror (-25)
107 _e_(e_VMerror, "VMerror")
108
109 /* ------ Additional Level 2 and DPS errors ------ */
110
111 #define e_configurationerror (-26)
112 _e_(e_configurationerror, "configurationerror")
113 #define e_invalidcontext (-27)
114 _e_(e_invalidcontext, "invalidcontext")
115 #define e_undefinedresource (-28)
116 _e_(e_undefinedresource, "undefinedresource")
117 #define e_unregistered (-29)
118 _e_(e_unregistered, "unregistered")
119
120 # ifdef INCLUDE_ERROR_NAMES
121
122 /* End of error name table */
123 0
124 };
125
126 # endif /* INCLUDE_ERROR_NAMES */
127
128 /* ------ Pseudo-errors used internally ------ */
129
130 /*
131 * Internal code for a fatal error.
132 * gs_interpret also returns this for a .quit with a positive exit code.
133 */
134 #define e_Fatal (-100)
135
136 /*
137 * Internal code for the .quit operator.
138 * The real quit code is an integer on the operand stack.
139 * gs_interpret returns this only for a .quit with a zero exit code.
140 */
141 #define e_Quit (-101)
142
143 /*
144 * Internal code for a normal exit from the interpreter.
145 * Do not use outside of interp.c.
146 */
147 #define e_InterpreterExit (-102)
148
149 /*
150 * Internal code that indicates that a procedure has been inserted
151 * on the e-stack at (former) esp+2, to be executed before retrying
152 * the current token. This is used for color remapping
153 * involving a call back into the interpreter -- inelegant, but effective.
154 */
155 #define e_InsertProc (-103)
156
157 /*
158 * Internal code to indicate we have underflowed the top block
159 * of the e-stack.
160 */
161 #define e_ExecStackUnderflow (-104)
162
163 /*
164 * Internal code for the vmreclaim operator with a positive operand.
165 * We need to handle this as an error because otherwise the interpreter
166 * won't reload enough of its state when the operator returns.
167 */
168 #define e_VMreclaim (-105)
169
170 /*
171 * Internal code for requesting more input from run_string.
172 */
173 #define e_NeedInput (-106)
174
175 /*
176 * Define which error codes require re-executing the current object.
177 */
178 #define error_is_interrupt(ecode)\
179 ((ecode) == e_interrupt || (ecode) == e_timeout)