Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!mailrus!tut.cis.ohio-state.edu!rutgers!topaz.rutgers.edu!hobbit From: hobbit@topaz.rutgers.edu (*Hobbit*) Newsgroups: comp.lang.postscript Subject: Why does this lose? Message-ID: Date: 2 Aug 88 23:27:57 GMT Organization: LCS Expert gang, Rutgers Lines: 55 The following is an attempt to print pages in "four-up" mode, four little frames per real page, with appropriate reduction and such. This is raw postscript, not something you plug into your favorite text formatter. The bit Q here is: Why does it fail?! The error comes at the indicated "show", which wimps out claiming "invalidaccess". Does it have something to do with redefining showpage? What's with it? The manual tells me nothing about why "show" would fail this way; usually when I shove a string on the stack, I can do what I want with it. Replies, if any, to me... _H* **************** %!PS-ack %%% Attempt to print regular pages in 4-up mode. /realshowpage {showpage} bind def %% hide showpage % finish it up %%% Ignore the fact that these borders aren't centered. I didn't get a chance %%% to fix them up before this other problem came along... /borders { 0 setlinewidth 20 10 moveto 20 780 lineto 590 780 lineto 590 10 lineto closepath stroke 20 380 moveto 590 380 lineto 290 10 moveto 290 780 lineto stroke } def % really print the page if done, otherwise move to stored place, skrunch, and % do the next one. We're really courting disaster by assuming that everything % under here doesn't leave turds on the stack. This is alleviated somewhat % by using save/restore instead of gsave/restore... /showpage { State restore dup 0 eq {clear borders realshowpage} { /State save def translate .5 .5 scale } ifelse } def % new showpage %% instead of getting fancy, throw all these initial thingies on the %% stack and pop 'em out as we need to move around the page. 0 0 290 10 20 10 290 380 % other 3 border ll corners % start doing first one /State save def 20 380 translate .5 .5 scale %%% Okay, now we start with a simpleminded example of what I wanted to print /Times-Bold findfont 12 scalefont setfont 50 650 moveto (Page 1) show showpage 50 250 moveto %%% the following successfully dumps the stack, rcheck produces "true", and %%% then you get "invalidaccess" for show. WTF??!!? (Page 2, fucked up) dup rcheck pstack flush pop show %%% If you comment out the preceding line, the following works [draws a line %%% from 50,250 to 0,0 in the second frame, so it's not a problem with having %%% moved there in the first place. Otherwise it should go from the end of %%% the string to the current origin. 0 0 lineto stroke showpage %%% For the sake of brevity, simulate the end of it all grestore borders realshowpage %% that's it..