Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!decvax!decwrl!ucbvax!laser-lovers From: reid@SU-GLACIER.ARPA (Brian Reid) Newsgroups: mod.computers.laser-printers Subject: Re: Flaw in Postscript? Message-ID: <8601150645.AA04513@ucbvax.berkeley.edu> Date: Tue, 14-Jan-86 22:45:00 EST Article-I.D.: ucbvax.8601150645.AA04513 Posted: Tue Jan 14 22:45:00 1986 Date-Received: Thu, 16-Jan-86 00:58:44 EST References: Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 53 Approved: laser-lovers@washington.arpa This is the sort of issue that can be difficult to understand until you fully understand PostScript. Let me offer a brief explanation. (1) PostScript implementations come with a barrier, namely the server loop boundary, inside which the system manager can change things, but the user cannot. So the system manager can redefine "showpage" inside the server loop so that it does whatever kind of accounting he wants, in such a way that nobody can access the original definition of showpage, and therefore there is no way to print a page without calling his redefined version of showpage. This is accomplished by exiting the server loop, retrieving the value of the name "showpage", then defining a new symbol named "showpage" whose contents is some form of accounting followed by an execution of the value that was retrieved from the old showpage operator before it was redefined. If the resulting definition is marked "execute-only", then it cannot be picked apart, and the old value cannot be extracted from it. Once the server loop is re-entered, the new showpage is indistinguishable from the old showpage--it is a "built in" operator, because the user cannot execute a restore that will un-do the redefinition, and cannot get his hands on the old version of the operator. (2) Referring to things like the 2-up header as "redefining" showpage is a bit misleading. It doesn't really redefine the showpage operator, it redefines the meaning of the name "showpage". It does this by stacking a new dictionary on top of the existing dictionary stack, and putting in that new dictionary a function named "showpage". That function will do the necessary 2-up trickery, and then call the "original" showpage. The "original" showpage here means the definition of the operator that was in force at the time the 2-up header dictionary was stacked. This can be accomplished in several different ways; my favorite is for each kind of header (such as the 2-up header) to extract the old definition of showpage and put it in a safe place, then stack a new definition; and at the end pop back to the previous definition. In this way it is easy to take a header that throws decorative borders around the page and combine it with a header that prints in 2-up, each of which relies on a redefinition of the name "showpage", in such a way that the resulting combination prints decorated pages in 2-up, or so that it prints 2-up pages with a combined decorative border, by reversing the order of the two header files. Summary: page accounting changes are done by redefining the OPERATOR that is called "showpage". 2-up printing and other such headers are done by stacking a new definition for the NAME "showpage", regardless of its contents. As long as the 2-up header works by stacking the new definition, rather than overwriting the old one, then it can be arbitrarily combined with other headers. In no event can a header undo the effect of an operator redefinition by the system manager. Brian Reid Stanford