Skip to main content
Participant
April 3, 2014
Question

Splitting of PaintProc

  • April 3, 2014
  • 1 reply
  • 535 views

Hello,

I work with a large PaintProc and because of the limitation of stack, I want to split it and call exec on each line of PaintProc. I created a small example on which I'm testing my solution, but there is a problem which I cannot identify. Here is the example:

%!PS-Adobe-3.0

%%CreationDate: 2014-04-01T17:22:12

%%LanguageLevel: 3

%%Pages: 1

%%BoundingBox: 0 0 596 843

%%HiResBoundingBox: 0 0 595.224 842.04

%%EndComments

/filebuff 1024 string def

/breakproc {

{

    currentfile filebuff readline  pop

    (endbreak) search

    {

        pop pop pop

        exit

    } {

        cvx exec

    }ifelse

} loop

} bind def

%%Page: 1 1

%%PageBoundingBox: 0 0 595 842

%%PageHiResBoundingBox: 0 0 595.224 842.04

<<

/PageSize [595 842]

/ImagingBBox null

>> setpagedevice

[1 0 0 -1 0 842.04] concat

/MyForm:1

<< /FormType 1

  /BBox [0 0 576 432]

  /Matrix [1 0 0 1 0 0]

  /PaintProc breakproc

newpath

9.907 115.193 moveto

0.97353 11.7477 92.498 11.71153 0.85554 1166.902 curveto

closepath

fill

endbreak

>>  def

MyForm:1 execform

showpage

Ghostscript 9.07 shows the curves but also reports the following message:

GPL Ghostscript 9.07 (2013-02-14)

Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.

This software comes with NO WARRANTY: see the file PUBLIC for details.

GS>(D:/svg2_min.ps) run

Error: /rangecheck in -->>--

Operand stack:

   MyForm:1   --nostringval--   FormType   1   BBox   --nostringval--   Matrix

--nostringval--   PaintProc

Execution stack:

   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-

-   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --n

ostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostr

ingval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval

--   1932   1   3   %oparray_pop   1931   1   3   %oparray_pop   1915   1   3

%oparray_pop   1803   1   3   %oparray_pop   --nostringval--   %errorexec_pop

.runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_p

ush   --nostringval--

Dictionary stack:

   --dict:1172/1684(ro)(G)--   --dict:0/20(G)--   --dict:79/200(L)--

Current allocation mode is local

Last OS error: No such file or directory

Current file position is 744

GS<1>

Any help is appreciated. Thank you.

This topic has been closed for replies.

1 reply

Participant
April 3, 2014

It seems I have found the solution:

/breakproc {

{

    currentfile filebuff readline  pop

    (endbreak) search

    {

        pop pop pop

        {}

        exit

    } {

        cvx exec

    }ifelse

} loop

} bind def

Maybe it will help also to someone else.