Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!exodus!wind.Eng.Sun.COM From: naughton@wind.Eng.Sun.COM (Patrick Naughton) Newsgroups: comp.lang.postscript Subject: Re: Pageview problem Keywords: pageview %! structuring conventions Message-ID: <11202@exodus.Eng.Sun.COM> Date: 6 Apr 91 21:53:09 GMT References: <1561@vidiot.UUCP> <464@heaven.woodside.ca.us> Sender: news@exodus.Eng.Sun.COM Reply-To: naughton@wind.Eng.Sun.COM (Patrick Naughton) Organization: Sun Microsystems, Inc. - Mountain View, CA Lines: 65 In article <464@heaven.woodside.ca.us>, glenn@heaven.woodside.ca.us (Glenn Reid) writes: |> |> There is a specific convention for dealing with embedded PS files, and |> looking for %! is not it. After all, %! means very little, in that it is |> not even claming to be a conforming document. In addition, the %%Trailer |> comment is optional, and may contain code following the trailer in any |> case. It is certainly a bad idea to do what pageview is described as |> doing. |> |> The comments %%BeginDocument and %%EndDocument were created for this |> purpose; a spooler could safely skip matching pairs of these comments, |> and the comments between them, when scanning a document. Looking for |> %! and %%Trailer is simply not reliable, and in fact would almost never |> work, it seems to me. I was motivated to look for %! when I found a large number of non-conforming files constructed of many (possibly conforming) files concatenated together; as well as properly formatted EPSF documents inserted into a document *without* the %%Begin/EndDocument pair surrounding them. I needed to ignore the %%Page (which was also unnecessarily included) in the EPSF document and the only means at my disposal was to ignore all comments between %! and %%Trailer (the comments which were in the "EPSF" documents...) Since then pageview is more strict about the first line matching the "%!PS-Adobe-#.# EPSF-#.#" format. Basically all of the problems that ANY previewer faces trying to parse arbitrarily mangled "PostScript" files is that the PostScript language was under-specified in the first place. Using *comments* to describe such important features of the language as *scope* and *flow control* is totally ludicrous! (especially in a non-serialized, non-laserwriter-like, real world scenario) The failure to completely define the language has given developers enough rope to produce volumes of VERY BAD "PostScript". Writing a previewer which only previews documents which conform to the latest revision of the "commenting conventions" is almost useless... Writing one which ignores the comments and relies on showpage being called to find pagebreaks is also useless for people who want to read the 300'th page of a document without wadeing through the whole thing. Writers of previewers are forced to write heuristics and hacks to interpret the miriad of garbage that many people call PostScript simply because it produces a printed document on an Apple LaserWriter! |> |> The BROKEN_SPOOLER constant is useful, although perhaps it should be |> BROKEN_PREVIEWER. useful comment there glenn, thanks for the input... |> |> Remember, %! just means that the file is PostScript, not that it represents |> a document or anything else. It can appear an arbitrary number of times |> within a document. It is only significant as the very first two characters |> in a file. |> |> -- |> Glenn Reid RightBrain Software |> glenn@heaven.woodside.ca.us NeXT/PostScript developers |> ..{adobe,next}!heaven!glenn 415-851-1785 (fax 851-1470) -- ______________________________________________________________________ Patrick J. Naughton email: naughton@sun.com Sun Laboratories voice: (415) 336 - 1080