Bug 696317

Summary: e_Fatal e_ExecStackUnderflow e_NeedInput (and others) missing since Ghostscript 9.18
Product: Ghostscript Reporter: jsmeix
Component: Build ProcessAssignee: Chris Liddell (chrisl) <chris.liddell>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 9.18   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---

Description jsmeix 2015-11-02 03:44:17 UTC
It seems since Ghostscript 9.18
e_Fatal e_ExecStackUnderflow e_NeedInput
are missing (and many more).

Those existed in Ghostscript 9.16 as follows:
---------------------------------------------------------------------------
$ egrep 'define e_Fatal|define e_ExecStackUnderflow|define e_NeedInput' \
  ghostscript-9.16/psi/ierrors.h
#define e_Fatal (-100)
#define e_ExecStackUnderflow (-104)
#define e_NeedInput (-106)
---------------------------------------------------------------------------

In Ghostscript 9.18 those error defines do no longer exist.
A diff of psi/ierrors.h between Ghostscript 9.16 and Ghostscript 9.18
shows that many such error defines do no longer exist.
Currently I do not know hwy they are dropped in Ghostscript 9.18.

As a consequence in the openSUSE Build Service
with Ghostscript 9.18 plus the fix for
http://bugs.ghostscript.com/show_bug.cgi?id=696301
libspectre build fails currently with
---------------------------------------------------------------------------
spectre-gs.c: In function 'critic_error_code':
spectre-gs.c:46:9: error: 'e_Fatal' undeclared (first use in this function)
    case e_Fatal:
         ^
spectre-gs.c:46:9: note: each undeclared identifier is reported only
 once for each function it appears in
spectre-gs.c:51:9: error: 'e_ExecStackUnderflow' undeclared (first use
 in this function)
    case e_ExecStackUnderflow:
         ^
spectre-gs.c: In function 'spectre_gs_process':
spectre-gs.c:112:20: error: 'e_NeedInput' undeclared (first use in
 this function)
    error = error == e_NeedInput ? 0 : error;
                     ^
---------------------------------------------------------------------------

At least e_NeedInput is still mentioned for Ghostscript 9.18
in doc/API.htm and doc/Develop.htm and it is used in
toolbin/halftone/gen_stochastic/gen_stochastic.c
Comment 1 Chris Liddell (chrisl) 2015-11-02 04:04:56 UTC
The PS interpreter errors were amalgamated with the errors in the graphics library (gserrors.h). We felt that two separate lists of error code that had to stay synchronized was a disaster waiting to happen.


e_ExecStackUnderflow == gs_error_ExecStackUnderflow
e_Fatal == gs_error_Fatal
e_NeedInput == gs_error_NeedInput

Note that gserrors.h was erroneously left out of the installed files, so you'll want to pick up this commit to ensure it's available:
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=feafe5e5

You could, as an interim measure, add:

#define e_ExecStackUnderflow gs_error_ExecStackUnderflow
#define e_Fatal gs_error_Fatal
#define e_NeedInput gs_error_NeedInput

But I would strongly urge that be no more than an interim measure, since we'll be moving forward using the "gs_error_*" style error codes.

I'll fix the remaining references to the "e_" style codes shortly.
Comment 2 jsmeix 2015-11-02 04:23:30 UTC
Chris,
many thanks for your prompt reply!

I know about http://bugs.ghostscript.com/show_bug.cgi?id=696301
and I have your fix for it in the openSUSE Ghaostscript 9.18
(see my initial comment#0).
Comment 3 Chris Liddell (chrisl) 2015-11-02 06:51:14 UTC
(In reply to jsmeix from comment #2)
> Chris,
> many thanks for your prompt reply!
> 
> I know about http://bugs.ghostscript.com/show_bug.cgi?id=696301
> and I have your fix for it in the openSUSE Ghaostscript 9.18
> (see my initial comment#0).

No problem, sorry for the confusion. I actually (when I made those changes to the errors) thought that ierrors.h had been deprecated for some time, but I can't now find a reference for that - had I not thought that, I'd have been more conservative and given more notice of the change.

Anyway, I believe the remaining references to the "e_*" style errors are removed with this commit:
http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=6b1b1d72e