Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!draken!tut!santra!kampi.hut.fi!alo From: alo@kampi.hut.fi (Antti Louko) Newsgroups: comp.lang.postscript Subject: Re: The // operator Message-ID: <22580@santra.UUCP> Date: 6 Jun 89 07:56:01 GMT References: <3903@imagen.UUCP> Sender: news@santra.UUCP Reply-To: alo@kampi.hut.fi (Antti Louko) Organization: Helsinki University of Technology, Finland Lines: 79 In article <3903@imagen.UUCP> geof@apolling (Geof Cooper) writes: >Software developers, be careful how you use this feature. It is not >possible to test for the existence of a feature if you want to use // in >relation to it. For example, the latest Apple LaserPrep contains code >of the form: > > if then > > >This is all very well, but the "nifty thing" references LaserWriter >operators in serverdict using the // convention. This means that those >names must resolve to valid objects on ALL machines, not just the >LaserWriter, since the names are resolved in the scanner independent >of the result of the conditional. > >- Geof Software developers, you can use this little hack I just put together: skipblock is a procedure which skips a %%BeginProcSet .. %%EndProcSet region so that the interpreter won't scan the skipped text. The only problem is how to get big companies to use this procedure... Antti -------------------------------- %! %%BeginProcSet: skipblock 1.0 0 /stoppedreadline { /savedhandler errordict /rangecheck get def errordict /rangecheck { pop stop } put { readline } stopped errordict /rangecheck /savedhandler load put { exch pop true dup } { false } ifelse } bind def /readlinehead { /-str- exch def /-file- exch def -file- -str- stoppedreadline { { -file- (..............) stoppedreadline not { pop pop exit} if pop pop } loop } if } bind def /skipblock { /-save- save def /str 600 string def /str2 600 string def currentfile str readlinehead not { stop } if (%%BeginProcSet:) anchorsearch { pop /-name- exch def } { stop } ifelse { currentfile str2 readlinehead not { stop } if (%%EndProcSet:) anchorsearch { pop -name- eq { exit } if } { pop } ifelse } loop -save- restore } bind def %%EndProcSet: skipblock 1.0 0 %example skipblock %%BeginProcSet: foobar (This stuff should be skipped) == (This stuff should be skipped) == (This stuff should be skipped) == (This stuff should be skipped) == %%EndProcSet: foobar (This stuff should not be skipped) == --------------------------------