home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / errors.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  4.5 KB  |  143 lines

  1. /* Copyright (C) 1989, 1995, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: errors.h,v 1.2 2000/09/19 19:00:10 lpd Exp $ */
  20. /* Definition of error codes */
  21.  
  22. #ifndef errors_INCLUDED
  23. #  define errors_INCLUDED
  24.  
  25. /*
  26.  * A procedure that may return an error always returns
  27.  * a non-negative value (zero, unless otherwise noted) for success,
  28.  * or negative for failure.
  29.  * We use ints rather than an enum to avoid a lot of casting.
  30.  */
  31.  
  32. /* Define the error name table */
  33. extern const char *const gs_error_names[];
  34.  
  35.         /* ------ PostScript Level 1 errors ------ */
  36.  
  37. #define e_unknownerror (-1)    /* unknown error */
  38. #define e_dictfull (-2)
  39. #define e_dictstackoverflow (-3)
  40. #define e_dictstackunderflow (-4)
  41. #define e_execstackoverflow (-5)
  42. #define e_interrupt (-6)
  43. /* We also need to define gs_error_interrupt, for gpcheck.h. */
  44. #undef gs_error_interrupt
  45. #define gs_error_interrupt e_interrupt
  46. #define e_invalidaccess (-7)
  47. #define e_invalidexit (-8)
  48. #define e_invalidfileaccess (-9)
  49. #define e_invalidfont (-10)
  50. #define e_invalidrestore (-11)
  51. #define e_ioerror (-12)
  52. #define e_limitcheck (-13)
  53. #define e_nocurrentpoint (-14)
  54. #define e_rangecheck (-15)
  55. #define e_stackoverflow (-16)
  56. #define e_stackunderflow (-17)
  57. #define e_syntaxerror (-18)
  58. #define e_timeout (-19)
  59. #define e_typecheck (-20)
  60. #define e_undefined (-21)
  61. #define e_undefinedfilename (-22)
  62. #define e_undefinedresult (-23)
  63. #define e_unmatchedmark (-24)
  64. #define e_VMerror (-25)
  65.  
  66. #define LEVEL1_ERROR_NAMES\
  67.  "unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\
  68.  "execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\
  69.  "invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\
  70.  "limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\
  71.  "stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\
  72.  "undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror"
  73.  
  74.         /* ------ Additional Level 2 and DPS errors ------ */
  75.  
  76. #define e_configurationerror (-26)
  77. #define e_invalidcontext (-27)
  78. #define e_undefinedresource (-28)
  79. #define e_unregistered (-29)
  80. /* invalidid is for the NeXT DPS extension. */
  81. #define e_invalidid (-30)
  82.  
  83. #define LEVEL2_ERROR_NAMES\
  84.  "configurationerror", "invalidcontext", "undefinedresource",\
  85.  "unregistered", "invalidid"
  86.  
  87. #define ERROR_NAMES   LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES
  88.  
  89.         /* ------ Pseudo-errors used internally ------ */
  90.  
  91. /*
  92.  * Internal code for a fatal error.
  93.  * gs_interpret also returns this for a .quit with a positive exit code.
  94.  */
  95. #define e_Fatal (-100)
  96.  
  97. /*
  98.  * Internal code for the .quit operator.
  99.  * The real quit code is an integer on the operand stack.
  100.  * gs_interpret returns this only for a .quit with a zero exit code.
  101.  */
  102. #define e_Quit (-101)
  103.  
  104. /*
  105.  * Internal code for a normal exit from the interpreter.
  106.  * Do not use outside of interp.c.
  107.  */
  108. #define e_InterpreterExit (-102)
  109.  
  110. /*
  111.  * Internal code that indicates that a procedure has been stored in the
  112.  * remap_proc of the graphics state, and should be called before retrying
  113.  * the current token.  This is used for color remapping involving a call
  114.  * back into the interpreter -- inelegant, but effective.
  115.  */
  116. #define e_RemapColor (-103)
  117.  
  118. /*
  119.  * Internal code to indicate we have underflowed the top block
  120.  * of the e-stack.
  121.  */
  122. #define e_ExecStackUnderflow (-104)
  123.  
  124. /*
  125.  * Internal code for the vmreclaim operator with a positive operand.
  126.  * We need to handle this as an error because otherwise the interpreter
  127.  * won't reload enough of its state when the operator returns.
  128.  */
  129. #define e_VMreclaim (-105)
  130.  
  131. /*
  132.  * Internal code for requesting more input from run_string.
  133.  */
  134. #define e_NeedInput (-106)
  135.  
  136. /*
  137.  * Define which error codes require re-executing the current object.
  138.  */
  139. #define ERROR_IS_INTERRUPT(ecode)\
  140.   ((ecode) == e_interrupt || (ecode) == e_timeout)
  141.  
  142. #endif /* errors_INCLUDED */
  143.