home .. forth .. colorforth mail list archive ..

RE: [colorforth] new color


On Wed, 1 Jun 2005, howerd.oakford wrote:

Hi Mark,

I think the orange token colour could be useful.

BTW could you explain the use of 'defer' in your 'accept' code, especially
the occurance of 'defer drop' as a phrase.
I'm sure I could work it out for myself, given time...

The effect of defer here is to return the address some code I have defined. I do this so I can build the table you see near the end of the code. This table has the effect of a state transition table, for each state there are five actions which are executed depending on the keyboard input. The first action is a do nothing action, the next three implement the thumb keys, the last action handles the remaining keys. The kernel implements this a bit differently, but the effect is the same. While using colorForth, you will see these state changes represented visually in the corner of the screen.

It is possible that I could define a jump table here, but I want to keep the addresses absolute, so they can be changed later on by the editor. A similer situatation, occurs in the compiler, since the meaning of each color must be easily changable by writing to a table of functions. Maybe defer is the best solution here, and it doesn't warrant a new color. The new color is somewhat apealing since, the address is something already in the dictionary, the object code and source code can be more compact, and it very simple to implement this new color.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com