embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: forward references

From: Elizabeth D. Rather <erather_at_forth.com>
Date: Wed, 27 Mar 2002 10:53:45 -0800

:NONAME isn't relevant in a SwiftX environment, where names are
kept only on the host in any case. This solution is fine. IMO my
version with the table is a little more efficient, but either will work.

FORTH, Inc. doesn't support "forward references" in any of our
products, because it's been our experience that this is a very
bug-prone practice that should be avoided.

Cheers,
Elizabeth

At 11:23 AM 3/27/02 -0300, you wrote:

>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.

==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310-491-3356
5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

----------------------------------------------------------------------
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 - 10:52:31 PST

This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST