1 /* Copyright (C) 1989, 1995, 1998, 1999 Aladdin Enterprises. All rights reserved. 2 3 This software is provided AS-IS with no warranty, either express or 4 implied. 5 6 This software is distributed under license and may not be copied, 7 modified or distributed except as expressly authorized under the terms 8 of the license contained in the file LICENSE in this distribution. 9 10 For more information about licensing, please refer to 11 http://www.ghostscript.com/licensing/. For information on 12 commercial licensing, go to http://www.artifex.com/licensing/ or 13 contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14 San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 */ 16 17 /* $Id: ierrors.h,v 1.2 2003/12/03 22:31:26 alexcher Exp $ */ 18 /* Definition of error codes */ 19 20 #ifndef ierrors_INCLUDED 21 # define ierrors_INCLUDED 22 23 /* 24 * DO NOT USE THIS FILE IN THE GRAPHICS LIBRARY. 25 * THIS FILE IS PART OF THE POSTSCRIPT INTERPRETER. 26 * USE gserrors.h IN THE LIBRARY. 27 */ 28 29 /* 30 * A procedure that may return an error always returns 31 * a non-negative value (zero, unless otherwise noted) for success, 32 * or negative for failure. 33 * We use ints rather than an enum to avoid a lot of casting. 34 */ 35 36 /* Define the error name table */ 37 extern const char *const gs_error_names[]; 38 39 /* ------ PostScript Level 1 errors ------ */ 40 41 #define e_unknownerror (-1) /* unknown error */ 42 #define e_dictfull (-2) 43 #define e_dictstackoverflow (-3) 44 #define e_dictstackunderflow (-4) 45 #define e_execstackoverflow (-5) 46 #define e_interrupt (-6) 47 /* We also need to define gs_error_interrupt, for gpcheck.h. */ 48 #undef gs_error_interrupt 49 #define gs_error_interrupt e_interrupt 50 #define e_invalidaccess (-7) 51 #define e_invalidexit (-8) 52 #define e_invalidfileaccess (-9) 53 #define e_invalidfont (-10) 54 #define e_invalidrestore (-11) 55 #define e_ioerror (-12) 56 #define e_limitcheck (-13) 57 #define e_nocurrentpoint (-14) 58 #define e_rangecheck (-15) 59 #define e_stackoverflow (-16) 60 #define e_stackunderflow (-17) 61 #define e_syntaxerror (-18) 62 #define e_timeout (-19) 63 #define e_typecheck (-20) 64 #define e_undefined (-21) 65 #define e_undefinedfilename (-22) 66 #define e_undefinedresult (-23) 67 #define e_unmatchedmark (-24) 68 #define e_VMerror (-25) 69 70 #define LEVEL1_ERROR_NAMES\ 71 "unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\ 72 "execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\ 73 "invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\ 74 "limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\ 75 "stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\ 76 "undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror" 77 78 /* ------ Additional Level 2 and DPS errors ------ */ 79 80 #define e_configurationerror (-26) 81 #define e_invalidcontext (-27) 82 #define e_undefinedresource (-28) 83 #define e_unregistered (-29) 84 /* invalidid is for the NeXT DPS extension. */ 85 #define e_invalidid (-30) 86 87 #define LEVEL2_ERROR_NAMES\ 88 "configurationerror", "invalidcontext", "undefinedresource",\ 89 "unregistered", "invalidid" 90 91 #define ERROR_NAMES LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES 92 93 /* ------ Pseudo-errors used internally ------ */ 94 95 /* 96 * Internal code for a fatal error. 97 * gs_interpret also returns this for a .quit with a positive exit code. 98 */ 99 #define e_Fatal (-100) 100 101 /* 102 * Internal code for the .quit operator. 103 * The real quit code is an integer on the operand stack. 104 * gs_interpret returns this only for a .quit with a zero exit code. 105 */ 106 #define e_Quit (-101) 107 108 /* 109 * Internal code for a normal exit from the interpreter. 110 * Do not use outside of interp.c. 111 */ 112 #define e_InterpreterExit (-102) 113 114 /* 115 * Internal code that indicates that a procedure has been stored in the 116 * remap_proc of the graphics state, and should be called before retrying 117 * the current token. This is used for color remapping involving a call 118 * back into the interpreter -- inelegant, but effective. 119 */ 120 #define e_RemapColor (-103) 121 122 /* 123 * Internal code to indicate we have underflowed the top block 124 * of the e-stack. 125 */ 126 #define e_ExecStackUnderflow (-104) 127 128 /* 129 * Internal code for the vmreclaim operator with a positive operand. 130 * We need to handle this as an error because otherwise the interpreter 131 * won't reload enough of its state when the operator returns. 132 */ 133 #define e_VMreclaim (-105) 134 135 /* 136 * Internal code for requesting more input from run_string. 137 */ 138 #define e_NeedInput (-106) 139 140 /* 141 * Internal code for stdin callout. 142 */ 143 #define e_NeedStdin (-107) 144 145 /* 146 * Internal code for stdout callout. 147 */ 148 #define e_NeedStdout (-108) 149 150 /* 151 * Internal code for stderr callout. 152 */ 153 #define e_NeedStderr (-109) 154 155 /* 156 * Internal code for a normal exit when usage info is displayed. 157 * This allows Window versions of Ghostscript to pause until 158 * the message can be read. 159 */ 160 #define e_Info (-110) 161 162 /* 163 * Define which error codes require re-executing the current object. 164 */ 165 #define ERROR_IS_INTERRUPT(ecode)\ 166 ((ecode) == e_interrupt || (ecode) == e_timeout) 167 168 #endif /* ierrors_INCLUDED */ 169