[comp.lang.postscript] "-gsave" operator?

clewis@ferret.ocunix.on.ca (Chris Lewis) (05/21/91)

In article <13694@pasteur.Berkeley.EDU> ssheng%zion.Berkeley.EDU@ucbvax.berkeley.edu (Sam Sheng) writes:
>I'm using psnup, which is a utility to show multiple pages of postscript
>output on a single physical page.  It works fine, and an apple laserwriter
>will take the postscript output it creates.

>The problem arises when I'm previewing it under ghostscript 2.1.1; it
>says that an operator name "-gsave" does not exist.  I've checked the
>ps file; no reference/def/whatever of "-gsave" was ever made, nor is
>such a beast listed in the Adobe PostScript Reference Manual.  It's
>also not documented as an extended command in the LaserWriter Tech Manual.

You didn't grep the complete postscript *after* psnup saw it.  -gsave
is mentioned in the postscript that psnup prepends to the postscript
that you want n-up'd.

>Does anybody know what "-gsave" does?

Psnup's prolog renames several ordinary postscript operators to be
-operator.  Eg: gsave becomes -gsave, grestore becomes -grestore
and so on.  And then defines new versions to do the "right" thing
w.r.t. n-up.  This is so the n-up code doesn't get confused by the
postscript that it's n-up'ing.

The only thing I can think of, perhaps, is that Ghostscript isn't
allowing you to re-name/define some of the built-ins.

This is the code:

> %=========================<< Pods: - Functions >>==============================
> %
> % Save the old definitions of some important operators
> %
> 
> /pods [				% The operators that we'll redefine.
> 	/showpage /copypage /erasepage
> 	/initgraphics /initmatrix /initclip
> 	/defaultmatrix /currentmatrix /setmatrix
> 	/restore
> 	/gsave /grestore /grestoreall
> ] def
> 
> /+s 128 string dup 0 (+) putinterval def
> /-s 128 string dup 0 (-) putinterval def
> /namestr 128 string def
> 
> pods {
> 	dup namestr cvs			% /foo ==> (foo)
> 	dup length /l exch def		%
> 	-s exch 1 exch putinterval	%      ==> (-foo)
> 	systemdict exch get		% Get the definition of foo
> 	-s 0 l 1 add getinterval	% Get (-foo)
> 	exch def			% And define one to the other.
> } forall

If, perhaps, this code is doing something slightly "off", please let
me know and I'll issue a patch to psnup.  (eg: "real" postscript
allows you to do a findfont where the font "name" is actually a string
rather than a name - Ghostscript doesn't like that either, so I fixed
Psroff to be a little more concientious)

[FYI: I was the one who submitted psnup to comp.sources.misc, but
I didn't write psnup - I'm not even close to that good with postscript]

I'm posting rather than e-mailing this, because I want the Ghostscript
maintainers to see and comment on it.

[Note: my machine does not get any of the gnu newsgroups.  Either
crosspost to comp.lang.postscript, or e-mail me.  Thank you]
-- 
Chris Lewis, Phone: (613) 832-0541, Domain: clewis@ferret.ocunix.on.ca
UUCP: ...!cunews!latour!ecicrl!clewis; Ferret Mailing List:
ferret-request@eci386; Psroff (not Adobe Transcript) enquiries:
psroff-request@eci386 or Canada 416-832-0541.  Psroff 3.0 in c.s.u soon!