🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #2369

Re: A useful def for self-contained packages

#2369
From: Woody Baker Eagle Signal
Date: Tue, 12 Jun 1990 02:02
61 lines
2352 bytes
In article <6656@umd5.umd.edu>, zben@umd5.umd.edu (Ben Cranston) writes:
> I am in the midst of trying to write "the canonical gray letters diagonally
> across each page, like DRAFT" postscript program, and stumbled across a real
> hairy gotcha.  Thought I would share the problem and solution.
> 
> Suppose you want to redefine the meaning of a PostScript verb, but keep access
> to the old definition.  For example, you want to redefine showpage to impose
> a landscape coordinate system upon each new page.  You can do something like:
> 
> /showpage [
>     /showpage load
>     611.76 0 /translate load 90 /rotate load
> ] cvx def
> 

Here is how I did it....

currentdict
/*moveto known not
	{
	/*moveto /moveto load def
	} if
	

/moveto
	{
	disableflag 1 eq
		{
		*moveto	% do original moveto
		}
		{
		% anything you want
		} ifelse
	} def

In my application, disableflag was used to enable and disable the
operation of the original showpage operator.  It worked well.

from Don Lancasters laserwriter column #31, is a nice little
gray stamp on the page routine.  Note, This is copied as he wrote it.
I do not condone this kind of coding.

100 dict /workdict exch def workdict begin %MUST be out of userdict

/printtimestuff {save /pts exch def mark /Helvetica-Bold findfont 
[80 0 0 80 0 0] makefont setfont /msg (FILE COPY) def 0 setlinewidth 1
setlinejoin 1 setlinecap 170 240 translate 45 rotate 0 0 moveto /strrx 
(X) def msgt {strrx exch 0 exch put strrx true charpath current point stroke
newpath moveto }forall cleartomark pts restore } def

/showpage {printtimestuff systemdict /showpage get cvx exec} def

% all of your normal stuff goes here

showpage

This routine prints out a gray line FILE COPY across the page.  I hope
I didn't make any typos.

Cheers
Woody
Technical Details
Message-ID: <1321@chinacat.Unicom.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!chinacat!woody
References: <57234@bbn.BBN.COM> <6656@umd5.umd.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!chinacat!woody
From: woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal)
Newsgroups: comp.lang.postscript
Subject: Re: A useful def for self-contained packages
Summary: here is a way that works
Message-ID: <1321@chinacat.Unicom.COM>
Date: 12 Jun 90 02:02:00 GMT
References: <57234@bbn.BBN.COM> <6656@umd5.umd.edu>
Organization: a guest of Unicom Systems Development, Austin
Lines: 61