🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.postscript.programming
4 messages
4 total messages Started by Geoff Nunes Thu, 31 Oct 2002 17:37
execution stack overflow
#1390
Author: Geoff Nunes
Date: Thu, 31 Oct 2002 17:37
29 lines
1804 bytes
I am writing Postscript programs that contain nothing but boxes. A sample program which draws only a single box is attached below. A real program would simply contain a very large number of "x1 y1 x2 y2 Box" statements. 

My problem is that if the program contains too many boxes (somewhere over 10,000), Illustrator and Ghostview cannot display the file. Ghostview gives an error message that looks like an execution stack overflow to me. How can I fix this? 

The problem is not in the sheer number of boxes being drawn. If I use a for loop, I can draw the same number of boxes or more with no problem. The problem is that somehow my Box command is not being immediately executed. Using the exec command did not help. 

I'd love to hear from an expert on this. 

Thanks, 
Geoff Nunes 

%%%%%%%%Sample.ps%%%%%%%%%%%%%% 
%! 
/Box { 
   newpath 
   /ht 2 1 roll def 
   /wd 2 1 roll def 
   moveto 
   wd 0 rlineto 
   0 ht rlineto 
   wd neg 0 rlineto 
   0 ht neg rlineto 
   closepath 
   fill 
} bind def 

72 144 144 72 Box 
showpage 
%EOF
Re: execution stack overflow
#1391
Author: Marc Antoni Malagarriga i Picas
Date: Thu, 31 Oct 2002 22:13
10 lines
915 bytes
Hi Geoff, 

Try this call execution... 

72 144 144 72 //Box exec 

...perhaps will help you! 

MaRC anToni (][ ww.femfum.com 
PostScript&PDF Tools Developers
Re: execution stack overflow
#1392
Author: SaGS
Date: Fri, 01 Nov 2002 08:15
15 lines
1774 bytes
I don't see any reason for the behaviour you describe, especially connected
to the exec stack.

Are you sure that among those 10000 calls of Box, there aren't some (many
enough) that have more than 4 parameters? That could produce an operand
stack overflow. Also a missing parameter may lead to an operand stack
undeflow. Try inserting in the PS code lines like "count == flush" to
display the operand stack depth, so you'll see if it increases or not; you
may also use "countexecstack" instead of "count" to check the exec stack.
This also help locate the exact spot where the error occurs.

Other notes, not connected to the problem:
(1) Why "2 1 roll" and not "exch"?
(2) Level 2 has the "rectfill" operator that does the same thing as your
"Box" (with subtle differences that usually don't matter).
Re: execution stack overflow
#1393
Author: Aandi Inston
Date: Sun, 03 Nov 2002 18:14
8 lines
1001 bytes
You will get execstackoverflow if you make a recursive call. Is the
error specifically execstackoverflow?

This can also be caused by mistakes like:

/findfont { ... do some stuff then ... findfont } bind def

Aandi Inston
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads