[comp.lang.postscript] Display Postscript paginating

clewis@ferret.ocunix.on.ca (Chris Lewis) (03/07/91)

How do you get Display Postscript to pause long enough so you can
look at what it's drawn?  I have DPS on a RS/6000, and I can run
my psroff (cat troff -2- postscript) piped into a program called
"dpsexec" (one of the DPS example programs - seems to be some sort
of frontend for the VM and comes with source), and see the output.

Unfortunately, it won't pause at the end of a page, and when it hits
the end of the file it simply erases the window...  So I have to
read real fast....

Any idears?  If it requires a change to the Postscript, does anybody
have a way for the postscript to tell by itself when run under DPS,
so that it automatically knows when to do the right thing?

thanks
-- 
Chris Lewis,
clewis@ferret.ocunix.on.ca or ...uunet!mitel!cunews!latour!ecicrl!clewis

asente@adobe.com (Paul Asente) (03/09/91)

In article <1991Mar07.143231.8470@ferret.ocunix.on.ca> clewis@ferret.ocunix.on.ca.UUCP (Chris Lewis) writes:
>How do you get Display Postscript to pause long enough so you can
>look at what it's drawn?  I have DPS on a RS/6000, and I can run
>my psroff (cat troff -2- postscript) piped into a program called
>"dpsexec" (one of the DPS example programs - seems to be some sort
>of frontend for the VM and comes with source), and see the output.
>
>Unfortunately, it won't pause at the end of a page, and when it hits
>the end of the file it simply erases the window...  So I have to
>read real fast....

The showpage operator has several parts; it prints out the current page,
erases the page, and resets some internal state.  In DPS, since it images
immediately, the "prints out the current page" part is really a no-op.

(I suspect you knew this already.)

What you have to do if you want to use dpsexec to preview a file is to
redefine showpage before reading the file.  The basic idea is to define
showpage to be a procedure that opens stdin for reading, reads a line from
it, then executes the original showpage operator.  This will make the
execution pause at the end of each page until you hit return.

If you don't know how to write PostScript code to redefine showpage, just
ask, and I'll get all the details.  I don't have the manual here at home
with me so I'd almost certainly make some mistakes if I tried to write
real code for you.

	-paul asente
		asente@adobe.com	...decwrl!adobe!asente

    Ratz put a bucket of liquid in front of me.
   "I wanted a glass of docs, Ratz.  What the hell is this?" I barked.
   "Motif don't fit in a glass anymore," he barked back.
    I looked at the liquid.  It was totally opaque to me.

rsmith@well.sf.ca.us (Ross Smith) (03/11/91)

clewis@ferret.ocunix.on.ca (Chris Lewis) writes:

>How do you get Display Postscript to pause long enough so you can
>look at what it's drawn?  I have DPS on a RS/6000, and I can run

Try sending this before the file:

/sleep {
	1000 mul usertime add
	{	dup
		usertime
		lt {exit} if
	} loop
	pop
} bind def
 
/*showpage /showpage load def
/showpage {
	5000 sleep
	*showpage
} bind def

In GoScript, I can even have the interpreter wait for a keystroke before
continuing:

/pause {
	(con) (r) file read
} bind def

/*showpage /showpage load def
/showpage {
	pause
	*showpage
} bind def

-- 
Ross Smith  rsmith@well.sf.ca.us   {apple,pacbell,hplabs,ucbvax}!well!rsmith