Re: Announcement: Axiom, a Forth Based Universal Game Programming System



dreamwafer@xxxxxxxxx wrote:
On Aug 28, 11:29 am, Andrew Haley <andre...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:

[On supporting CREATE .. DOES>]
Other people have done it. It's far from being impossible. I don't
know enough about exactly how your threading scheme works to comment
on how exactly to do it in your system.

For details on ForthScript's threading, see section 5 "Internals
within "ForthScript.pdf" that is part of the Axiom development kit at:
http://www.zillionsofgames.com/cgi-bin/zilligames/submissions.cgi/16178?do=show;id=1452

OK, that all looks pretty conventional. To implement CREATE .. DOES>,
your DOES> should modify the CFA of the most recently created word.
As as example, consider something like

: const create , does> @ ;

DOES> makes the CFA of the most recently created word point into the
middle of the list of CFAs inside CONST, and then DOES> exits from
CONST.

The list of CFAs in CONST looks like this, with "&" meaning the CFA of
the following word:

& CREATE & , & DOES> & (DODOES) & @ & , & EXIT

So, when you do

CONST FOO

you create a new word whose CFA points to the address of (DODOES)
within the body of CONST. The action of (DODOES) is somewhat system
dependent, but it needs to get the address of the parameter field of
the current definition.

Andrew.
.