Bug 688150

Summary: ReusableStreamDecode available but failing at languagelevel 2
Product: Ghostscript Reporter: SaGS <sags5495>
Component: PS InterpreterAssignee: Stefan Kemper <stefan.kemper>
Status: NOTIFIED FIXED    
Severity: normal    
Priority: P3    
Version: master   
Hardware: PC   
OS: All   
Customer: Word Size: ---
Attachments: Suggested patch.

Description SaGS 2005-06-21 11:24:37 UTC
Languagelevel 3-specific filters /ReusableStreamDecode, /FlateEncode, and 
/FlateDecode are available at languagelevel 2 too. Implementing extra 
filters is not a bug, but attempts to use /ReusableStreamDecode at LL2 
fail with an "Error: /undefined in /.bigstring".

Normally, LL2 PostScript programs do not use LL3-specific features. But, 
see bug #688151 "PDF interpreter needs languagelevel 3, not 2" for details 
why the present bug matters.

Code fragment that triggers this error:

    2 .setlanguagelevel
    () /ReusableStreamDecode filter

Cause:

The filter's implementation (lib\gs_frsd.ps::.reusablestreamdecode), uses 
lib\gs_ll3.ps::.bigstring, defined as a LL3-specific proc and put into 
"ll3dict". ".bigstring" is not bound into ".reusablestreamdecode" because:

  - it's not defined at that point;
  - even if it were defined, it's a procedure so "bind" has no effect.

The implementation of "filter" allows using all filters, even the LL3 
ones, at LL2. When ".reusablestreamdecode" is executed, the name 
".bigstring" is looked up but not found, being LL3-specific.
Comment 1 SaGS 2005-06-21 11:31:59 UTC
Created attachment 1459 [details]
Suggested patch.

The patch makes /ReusableStreamDecode work at LL2 by inserting the body 
of ".bigstring" into ".reusablestreamdecode". (Of course, an alternative 
is to make ".bigstring" & co. available at LL2, since these are generally 
usefull procedures.)

The question whether LL3 filters should be available at LL2 remains.
Comment 2 Ray Johnston 2005-08-25 08:35:59 UTC
Thanks to mat. Gheorghe Savulescu for the patch. I've committed it in order
to close the bug.

DETAILS:

In general, running at Language Level 2 by using .setlanguagelevel is not
supported when using features that are part of LanguageLevel 3, such as
filters that are part of LL3, but this patch is simple and low risk so
I am adding it and closing the bug.