forward references

From: Nestor D. Closa <intec_at_satlink.com>
Date: Tue, 26 Mar 2002 17:44:26 -0300

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.
Received on Tue Mar 26 2002 - 12:46:51 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.