Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Maybe a new...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 17 Topic 3795 of 4288
Post > Topic >>

Re: Maybe a newbie question..

by Brad Eckert <nospaambrad1@[EMAIL PROTECTED] > Mar 3, 2008 at 08:34 AM

On Mar 3, 2:07=A0am, sb...@[EMAIL PROTECTED]
 wrote:
>
> CREATE MYTABLE
> ' WORD1 , ' WORD2 ,
>
> SEL_WORD VAR1 @[EMAIL PROTECTED]
 2* MYTABLE + @[EMAIL PROTECTED]
 EXECUTE ;
>
> or
>
> SEL_WORD VAR1 @[EMAIL PROTECTED]
 0=3D IF WORD1 ELSE WORD2 THEN ;
>
Have you looked at vectored execution? If VAR1 is only used by
SEL_WORD, you can store an XT in it:

: SEL_WORD  VAR1 @[EMAIL PROTECTED]
 EXECUTE ;

Most cross compilers supply DEFER to simplify this usage. You can say:

DEFER SEL_WORD  ' WORD1 IS SEL_WORD

This allocates storage for the xt and causes startup code to load it
with the xt for WORD1. DEFER isn't in the ANS standard but you can do
everything it does manually. For example:

VARIABLE 'sel_word  \ you need to initialize this yourself
: SEL_WORD  'sel_word @[EMAIL PROTECTED]
 EXECUTE ;

Of course, you may want to go beyond DEFER's functionality by defining
an array of xts that you can change as a group using CMOVEC. This is
good for changing many behaviors at once, such as when switching modes
in an application.

BTW, you should use CELLS instead of 2*

Brad
 




 17 Posts in Topic:
Maybe a newbie question..
sbi82@[EMAIL PROTECTED]   2008-03-03 01:07:27 
Re: Maybe a newbie question..
Jonah Thomas <jethomas  2008-03-03 06:08:41 
Re: Maybe a newbie question..
sbi82 <stefanobiz@[EMA  2008-03-03 13:09:18 
Re: Maybe a newbie question..
Jonah Thomas <jethomas  2008-03-03 06:20:49 
Re: Maybe a newbie question..
Jonah Thomas <jethomas  2008-03-03 07:53:00 
Re: Maybe a newbie question..
sbi82 <stefanobiz@[EMA  2008-03-03 19:29:49 
Re: Maybe a newbie question..
Brad Eckert <nospaambr  2008-03-03 08:34:37 
Re: Maybe a newbie question..
sbi82 <stefanobiz@[EMA  2008-03-03 19:27:07 
Re: Maybe a newbie question..
Elizabeth D Rather <er  2008-03-03 09:07:37 
Re: Maybe a newbie question..
sbi82 <stefanobiz@[EMA  2008-03-03 20:39:28 
Re: Maybe a newbie question..
Elizabeth D Rather <er  2008-03-03 10:20:50 
Re: Maybe a newbie question..
Jonah Thomas <jethomas  2008-03-03 14:38:38 
Re: Maybe a newbie question..
sbi82 <stefanobiz@[EMA  2008-03-03 20:43:49 
Re: Maybe a newbie question..
stephenXXX@[EMAIL PROTECT  2008-03-03 15:48:41 
Re: Maybe a newbie question..
Bruce McFarling <agila  2008-03-03 15:54:59 
Re: Maybe a newbie question..
m_l_g3@[EMAIL PROTECTED]   2008-03-05 11:25:00 
Re: Maybe a newbie question..
Elizabeth D Rather <er  2008-03-24 10:57:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 8:19:53 CDT 2008.