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


Groups > comp.lang.forth > #24675

Re: How to abort loops and other return stack fiddling words…

From Christian Kellermann <ckeen@pestilenz.org>
Newsgroups comp.lang.forth
Subject Re: How to abort loops and other return stack fiddling words…
Date 2013-07-22 14:31 +0200
Organization A noiseless patient Spider
Message-ID <87y58yepxn.fsf@pestilenz.org> (permalink)
References <87bo5ugbsq.fsf@pestilenz.org> <b161d7ea-6e05-4b66-bf53-b3f8542f2288@googlegroups.com>

Show all headers | View raw


Mark Wills <markrobertwills@yahoo.co.uk> writes:

> a) you can't. At least, not without carnal knowledge of your
> system. It's an infinate loop, by design, so if you find you need to
> jump out of it, it means you shouldn't be using it ;-)

Ah, ok. Makes sense.

> Example code using AGAIN: http://turboforth.net/lang_ref/view_word.asp?ID=71
>
> b) See this example for do/loop with LEAVE:
> http://turboforth.net/lang_ref/view_word.asp?ID=83

> c) n case
>   a of code-for-case-a endof
>   b of code-for-case-b endof
>   c of code-for-case-c endof
>   code-for-no-matching-case
> endcase

The reason why I ask this is: For the robot game I have a dispatch case
reacting to user input. Now if I want to add an option to restart a
game, I could just call the restart-game word again but as I understand
it, this would grow the stack. Maybe I should restructure the code in
this case to a control flow better suited for these new specifications
instead.

>
> Obviously, if case a b or c *is* detected, then the default (i.e. no
> match) code is *not* executed.  Have a look at BEGIN...UNTIL. That
> might be better for your needs. Here's an example:

BEGIN...UNTIL look like a candidate for said restructuring.

Thank you!

Christian

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How to abort loops and other return stack fiddling words… Christian Kellermann <ckeen@pestilenz.org> - 2013-07-22 11:54 +0200
  Re: How to abort loops and other return stack fiddling words… Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-22 04:18 -0700
    Re: How to abort loops and other return stack fiddling words… Christian Kellermann <ckeen@pestilenz.org> - 2013-07-22 14:31 +0200
      Re: How to abort loops and other return stack fiddling words… daveyrotten <danw8804@gmail.com> - 2013-07-22 08:31 -0700
    Re: How to abort loops and other return stack fiddling words… Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-22 13:56 +0100
      Re: How to abort loops and other return stack fiddling words… Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-22 06:46 -0700
        Re: Re: How to abort loops and other return stack fiddling words… anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 16:01 +0000
          Re: How to abort loops and other return stack fiddling words… rickman <gnuarm@gmail.com> - 2013-07-22 12:31 -0400
            Re: Re: How to abort loops and other return stack fiddling words… anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 16:36 +0000
            Re: How to abort loops and other return stack fiddling words… "Ed" <invalid@invalid.com> - 2013-07-24 12:18 +1000
            Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-24 02:48 -0500
              Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-27 22:15 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-28 03:37 -0500
                Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-29 11:01 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 11:07 -0500
                Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-29 12:32 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 11:54 -0500
                Re: How to abort loops and other return stack fiddling words? rickman <gnuarm@gmail.com> - 2013-07-29 13:19 -0400
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-29 15:27 -0500
                Re: How to abort loops and other return stack fiddling words? Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-28 03:20 -0700
                Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-28 08:17 -0500
        Re: How to abort loops and other return stack fiddling words… Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-22 18:07 +0100
      Re: Re: How to abort loops and other return stack fiddling words… albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-22 14:12 +0000
        Re: How to abort loops and other return stack fiddling words… Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-22 17:49 +0100
      Re: How to abort loops and other return stack fiddling words… hughaguilar96@yahoo.com - 2013-07-22 20:25 -0700
  Re: How to abort loops and other return stack fiddling words? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-22 07:54 -0500

csiph-web