Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!adobe!greid From: greid@adobe.com (Glenn Reid) Newsgroups: comp.lang.postscript Subject: Re: BeginSetup/EndSetup Message-ID: <825@adobe.UUCP> Date: 11 May 89 17:56:56 GMT References: <9059@polya.Stanford.EDU> Sender: news@adobe.COM Reply-To: greid@adobe.COM (Glenn Reid) Organization: Adobe Systems Incorporated, Mountain View Lines: 81 In article <9059@polya.Stanford.EDU> rokicki@polya.Stanford.EDU (Tomas G. Rokicki) writes: >Howdy! I'm playing with the document structuring conventions, and I >want to be sure I understand something. Is it true that, assuming a >well-structured PostScript file and a correctly behaving server, that >the following file > >%!PS-Adobe-2.0... >... >%%BeginSetup >% we possibly change the CTM here, maybe even stash it away >% for later use >6 array currentmatrix print flush % this is the *last* thing in setup >%%EndSetup >%%Page 1 1 >6 array currentmatrix print flush % this is the *first* thing in page >%%Trailer > >will show two *different* matrices? Is it safe to `save' the CTM >during the `Setup' so it can be used in the actual pages themselves? I'm not entirely sure I understand the way you've presented this question, but I'll try to answer it anyway. Your main question reads like this: "Is it true that ... the following file ... will show two different matrices?" My first answer is "NO." Given that the only thing between the two calls to "currentmatrix" is a few comments, the matrices should be identical. But the way in which individual pages use the setup code is up to you. The only requirement is that it must not depend on the order in which the pages are executed, or even depend on all the pages being present at all. Servers can strip out pages, rearrange them, etc. However, you were asking about the comments and the structure. Basically, it works like this: %!PS-Adobe-2.1 %%BeginProcSet % You can make any definitions you want here, but cannot % change the state of the interpreter. %%EndProcSet %%EndProlog %%BeginSetup % You can change the state of the interpreter here, and % provide any job-specific setup like reencoding fonts. % Bear in mind that YOU are responsible for any state % you set here and how it is used by each page. The % structuring conventions just guarantee that it will % always be executed first, before any of the pages. The % structuring conventions to not dictate *which* page % will be the one to execute after setup. It could be % page 1, page 4, or page 15, depending on page selection % and reordering that may be done by the server. %%EndSetup %%Page: "label" m % any code can go here. It may rely on prologue definitions % made before the %%EndProlog comment, and it may rely on % state set up in the Setup section ONLY IF it also leaves % that state set at the end of the page. This is because % the pages must not be interdependent, and any of them may % be executed in any order. % If a matrix representing the current matrix is stored into % a variable during setup, it is reasonable to use this value % with "setmatrix" to establish the coordinate system at the % beginning of each page. %%Page: "label" n % This is exactly the same as page "m" %%Trailer % The structuring conventions guarantee only that this code % will be executed last, after the final page. It is % appropriate here to remove your dictionaries from the % dictionary stack and to make sure you've left nothing % on the operand stack. %%EOF % If this is the end of job and an end-of-file would normally % appear here, this comment may be used to indicate end-of- % file in a transport-mechanism-independent manner. I hope this helps. I think you basically have it right. Glenn Reid Adobe Systems