Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1051

How to crack a loop?

From "luser.droog" <luser.droog@gmail.com>
Newsgroups comp.lang.postscript
Subject How to crack a loop?
Date 2012-11-17 07:11 -0600
Organization unorganized
Message-ID <k883gv$tud$1@dont-email.me> (permalink)

Show all headers | View raw


I was looking over my debugger code recently and I think the next vital
feature it needs is the ability to enter a loop and step through the
procedure body. For 'for' loops this seems relatively straightforward.
Sthg like

<<
/for{4 dict begin
{/body/final/incr/init}{exch def}forall
incr 0 gt final init gt eq {
  ({//init //body exec //init //incr add //incr //final //body for})
  token pop exch pop pushtodebugstack
}{
  ('for' loop finished)=
}ifelse
end}
>>

And 'forall' seems doable, too. With strings and arrays, just

//data 0 get //body exec //data 1 1 index length 1 sub getinterval forall

And for dicts, run a "pre-processing" step

[exch{[3 1 roll]cvx}forall]/data exch def
//data 0 get exec //body exec //data 1 1 index length 1 sub getinterval
forall

But I'm confused about how to apply this to regular 'loop's. And with all of
these, how best to make 'exit' "exit"?
Little help?

Back to comp.lang.postscript | Previous | Next | Find similar | Unroll thread


Thread

How to crack a loop? "luser.droog" <luser.droog@gmail.com> - 2012-11-17 07:11 -0600

csiph-web