Article View: comp.lang.postscript
Article #3752Re: A question about //add
From: Jim Graham
Date: Wed, 21 Nov 1990 23:21
Date: Wed, 21 Nov 1990 23:21
35 lines
1859 bytes
1859 bytes
In article <21745@well.sf.ca.us>, shiva@well.sf.ca.us (Kenneth Porter) writes:
|> orthlieb@adobe.UUCP (Carl Orthlieb) writes:
|>
|> > It is suggested that // not be used, use bind or load
|> > depending on the effect you want.
|>
|> // is particularly useful for re-defining system operators in
|> heavily nested situations:
|>
|> /showpage { stuff //showpage more-stuff } def
|>
|> The problem here is that one has to test for whether the system operator
|> has be re-defined before; if so, then an exec has to be added after
|> the name:
|>
|> /systemname load operatortype { /systemname { //systemname } def } if
A robust method for performing this overriding behaviour would be the
following (assuming you are writing a package referred to as "AA"):
/preAAshowpage /showpage load def
/showpage {stuff preAAshowpage morestuff} bind def
If showpage were an operator prior to this code, then bind would
still bind the operator into the procedure (in which case
"/preAAshowpage" would be wasted"). If it were not an operator,
then the new showpage procedure would still execute correctly.
This technique adds to your userdict size more, but it eliminates
unnecessary tests and "exec" operators in the overriden operator
procedures.
...jim
Technical Details
Message-ID:
<3294@exodus.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!exodus!bendenweyr!flarReferences:
<1990Nov12.195235.13908@light.uucp> <321@heaven.woodside.ca.us> <1990Nov14.170020.16233@light.uucp> <21745@well.sf.ca.us>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!exodus!bendenweyr!flar From: flar@bendenweyr.Eng.Sun.COM (Jim Graham) Newsgroups: comp.lang.postscript Subject: Re: A question about //add Message-ID: <3294@exodus.Eng.Sun.COM> Date: 21 Nov 90 23:21:34 GMT References: <1990Nov12.195235.13908@light.uucp> <321@heaven.woodside.ca.us> <1990Nov14.170020.16233@light.uucp> <21745@well.sf.ca.us> Sender: news@exodus.Eng.Sun.COM Reply-To: flar@bendenweyr.Eng.Sun.COM (Jim Graham) Organization: Sun Microsystems, Inc. Lines: 35