From: jaap@alice.att.com (jaap)
Newsgroups: comp.lang.postscript
Subject: Re: Multiple %%EOF's??
Date: 14 Aug 92 16:22:06 GMT
Article-I.D.: alice.23451
Reply-To: jaap@alice.UUCP ()
Organization: AT&T, Bell Labs

In article <1992Aug12.210018.5361@wuecl.wustl.edu> qarl@wuecl.wustl.edu (Karl Stiefvater) writes:
 > I have a dilemma which I'm sure the PostScript community can answer for me...
 > 
 > I have a program (dvips) which generates PS code containing multiple "%%EOF"
 > statments. (It does so when including EPS figures.)
 > 
 > I have a printer filter (cap's papif) which looks for the first "%%EOF" as
 > the end of input, and stops there.
 > 
 > Who's at fault?
 > 

It is a symptom of a more generic problem:  What to do with comments
in epsf?  If one leaves them alone, you can get problems as sketched
above.

So there are two posible solutions:

(1) After interpreting the comments needed, remove all of them when
    inserting the epsf in the printer stream.


(2) Thinker with them, so the spoler/page reverser etc. won't get
    confused.


The first solution might throw away useful stuff.  One might for
instance want to pick up the epsf out of a huge document and having
the original comments still in in some form might help.

That's why I prefer the second option.  Because the basic epsf (and
most other document structure conventions) have the simple scheme

	<beginning of line>%%<Comment:...>

the thinkering doesn't need to be that elaborate.  Just add an extra %
so one gets something like:

	<beginning of line>%%%<Comment:...>

will make it a non-standard DSC and should preven this type of
problems iff filters/spoolers parse official DSC's.  Of course, there
are filters out there which have a less strict implementation of DSC,
so they still might trip over.

Of course, with DSC version 3.0, things are not that easy anymore.  If
there is a preview section in you epsf, you probably want to leave the
the percent signs alone, from the %%BeginPreview up and including
%%EndPreview comment.  That way a postscript previewer can still show
the epsf portion.

As a more general comment, I think that this whole bussines of hiding
information in comments is a dubious method(*).  Since it isn't part
of the language, the interpretation can be whatever people/programs
seems fit.  It leaves room for ad-hoc solutions and infinite expansion
of more and more bells and whistles.  Even Adobe seems confused by all
this, in the red book (E.2) they say that the %! is the only Adobe
comment which doesn't start with %%.  However, the data in the preview
section is apparently encoded (hidden from the interpreter) with only
a single %.  Of course, one can fight about whether this hidden data
is a DSC conforming comment or not.  The rules for the DSC 3.0 now
consists of 126 pages in the second edition of the Red book.  To put
this in perspective, the description of the basic operators in edition
one of the red book, took a mere 139 pages (and DSC 1.0 only 7).

Some more statistics:  the operator section in edition 2 consists of
211 pages.  I wonder whether the DSC section in edition 3 will be
bigger then the PostScript Language operator section.

Somehow things seem to go out of hand.


	jaap

(*)  Often called ``hiding information under a rock''.
Newsgroups: comp.lang.postscript