1 /* Copyright (C) 2001-2006 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, modified 8 or distributed except as expressly authorized under the terms of that 9 license. Refer to licensing information at http://www.artifex.com/ 10 or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, 11 San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. 12 */ 13 14 /* $Id: ierrors.h 8022 2007-06-05 22:23:38Z giles $ */ 15 /* Definition of error codes */ 16 17 #ifndef ierrors_INCLUDED 18 # define ierrors_INCLUDED 19 20 /* 21 * DO NOT USE THIS FILE IN THE GRAPHICS LIBRARY. 22 * THIS FILE IS PART OF THE POSTSCRIPT INTERPRETER. 23 * USE gserrors.h IN THE LIBRARY. 24 */ 25 26 /* 27 * A procedure that may return an error always returns 28 * a non-negative value (zero, unless otherwise noted) for success, 29 * or negative for failure. 30 * We use ints rather than an enum to avoid a lot of casting. 31 */ 32 33 /* Define the error name table */ 34 extern const char *const gs_error_names[]; 35 36 /* ------ PostScript Level 1 errors ------ */ 37 38 #define e_unknownerror (-1) /* unknown error */ 39 #define e_dictfull (-2) 40 #define e_dictstackoverflow (-3) 41 #define e_dictstackunderflow (-4) 42 #define e_execstackoverflow (-5) 43 #define e_interrupt (-6) 44 #define e_invalidaccess (-7) 45 #define e_invalidexit (-8) 46 #define e_invalidfileaccess (-9) 47 #define e_invalidfont (-10) 48 #define e_invalidrestore (-11) 49 #define e_ioerror (-12) 50 #define e_limitcheck (-13) 51 #define e_nocurrentpoint (-14) 52 #define e_rangecheck (-15) 53 #define e_stackoverflow (-16) 54 #define e_stackunderflow (-17) 55 #define e_syntaxerror (-18) 56 #define e_timeout (-19) 57 #define e_typecheck (-20) 58 #define e_undefined (-21) 59 #define e_undefinedfilename (-22) 60 #define e_undefinedresult (-23) 61 #define e_unmatchedmark (-24) 62 #define e_VMerror (-25) /* must be the last Level 1 error */ 63 64 #define LEVEL1_ERROR_NAMES\ 65 "unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\ 66 "execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\ 67 "invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\ 68 "limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\ 69 "stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\ 70 "undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror" 71 72 /* ------ Additional Level 2 errors (also in DPS) ------ */ 73 74 #define e_configurationerror (-26) 75 #define e_undefinedresource (-27) 76 #define e_unregistered (-28) 77 78 #define LEVEL2_ERROR_NAMES\ 79 "configurationerror", "undefinedresource", "unregistered" 80 81 /* ------ Additional DPS errors ------ */ 82 83 #define e_invalidcontext (-29) 84 /* invalidid is for the NeXT DPS extension. */ 85 #define e_invalidid (-30) 86 87 #define DPS_ERROR_NAMES\ 88 "invalidcontext", "invalidid" 89 90 #define ERROR_NAMES\ 91 LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES, DPS_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 a normal exit when usage info is displayed. 142 * This allows Window versions of Ghostscript to pause until 143 * the message can be read. 144 */ 145 #define e_Info (-110) 146 147 /* 148 * Define which error codes require re-executing the current object. 149 */ 150 #define ERROR_IS_INTERRUPT(ecode)\ 151 ((ecode) == e_interrupt || (ecode) == e_timeout) 152 153 #endif /* ierrors_INCLUDED */ 154