![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

I have a suspicion this isn't what you were asking, but...
I would typically write this without the execution vector:
: DO-CHOICE
CASE
'A' OF STATE1 ENDOF
'B' OF STATE2 ENDOF
'C' OF STATE3 ENDOF
'D' OF STATE4 ENDOF
o
o
o
'X' OF SET-EXIT ENDOF
...exception handeling ...
ENDCASE ;
: MAIN
FALSE EXIT-CODE !
BEGIN
KEY DO-CHOICE
EXIT-CODE @
UNTIL ;
> -----Original Message-----
> From: Nestor D. Closa [SMTP:intec_at_satlink.com]
> Sent: Tuesday, March 26, 2002 12:44 PM
> To: SwiftX
> Subject: [swiftx] forward references
>
>
> How can you write states in forth without forward references ?
>
> VARIABLE 'MyState
>
> : State1 ( event -- )
> somecode1
> IF
> ['] State2 'MyState !
> THEN ;
>
> : State2 ( event -- )
> somecode2
> IF
> ['] State3 'MyState !
> THEN ;
>
> : State3 ( event -- )
> somecode3
> IF
> ['] State1 'MyState !
> THEN ;
>
> : Main ( -- )
> ['] State1 'MyState !
> BEGIN
> KEY 'MyState @EXECUTE
> AGAIN ;
>
>
> Nestor Closa
>
>
>
> ----------------------------------------------------------------------
> swiftx_at_forth.com The SwiftX programming discussion email list
> To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
> For help with listar commands, send subject "help" to listar_at_forth.com
> Archives are located at http://www.forth.com/swiftx -- check them out!
> ----------------------------------------------------------------------
> THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Tue Mar 26 2002 - 13:39:21 PST
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST