home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / program / gs300sr1 / gs300sr1.exe / ERRORS.H < prev    next >
C/C++ Source or Header  |  1994-07-27  |  6KB  |  155 lines

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