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

Hi Bill thank you, this is a good method, but I have SwiftX Pro MSP430 v3.1.2
and :NONAME is not recognized.
: (State1) ( event -- )
somecode1 IF ['] State2 'MyState ! THEN ; ' (State1) IS State1
: (State2) ( event -- )
somecode2 IF ['] State3 'MyState ! THEN ; ' (State2) IS State2
: (State3) ( event -- )
somecode3 IF ['] State1 'MyState ! THEN ; ' (State3) IS State3
Nestor.
Bill Hall ha escrito:
> hi
>
> I should respond to the list but I don't know how.
> And I see that Elizabeth has given you an alternative.
>
> First, I made definitions for the somecode's so that I could run this on my system.
>
> : somecode1 CR 'MyState ? 1 ;
> : somecode2 CR 'MyState ? 1 ;
> : somecode3 CR 'MyState ? 1 ;
>
> Then I made new definitions for your existing words using a defining word which may be new to you ( DEFER ) .
>
> DEFER State1
> DEFER State2
> DEFER State3
>
> Notice that there is no definition. Also notice that if you are putting this code on a target processor that you will have to determine if these words will be defined in RAM or ROM.
>
> Next, your existing definition bodies are defined without names, and applied to the names given above using IS . This, again, may use a definer which is new to you ( :NONAME ). And the RAM vs ROM situation needs to be carefully done.
>
> :NONAME ( event -- )
> somecode1 IF ['] State2 'MyState ! THEN ; IS State1
>
> :NONAME ( event -- )
> somecode2 IF ['] State3 'MyState ! THEN ; IS State2
>
> :NONAME ( event -- )
> somecode3 IF ['] State1 'MyState ! THEN ; IS State3
>
> Now your existing Main will operate as you expect, I think.
> You have a better way to be sure than I do.
>
> At 05:44 PM 3/26/02 -0300, you wrote:
> >
> >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.
> >
> MrBill
> ~|:)>>>>
----------------------------------------------------------------------
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 Wed Mar 27 2002 - 06:25:35 PST
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST