Thread View: net.lang.forth
1 messages
1 total messages
Started by Harold Carr
Wed, 19 Sep 1984 15:49
re: DYNAMIC CONSTANTS
Author: Harold Carr
Date: Wed, 19 Sep 1984 15:49
Date: Wed, 19 Sep 1984 15:49
39 lines
1957 bytes
1957 bytes
Thank you. Before I received your answer I had looked up the code
defining ARRAY in forth.blk and used it as a model for this definition
of LEN:
: LEN ( n --- )
HERE 1 AND ALLOT ( even up the address)
CREATE ( get segment name from input stream)
HERE ( beginning of storage for segment)
SWAP DUP ALLOT ( allocate N byte of storage)
0 FILL ; ( initialize storage to zero)
Being new to forth, while I was rummaging through the documention for
useful words to define defining words, it was not clear to me at all that:
--------------------------------------------------
CREATE
A defining word used in the form:
CREATE <name>
to create a dictionary entry for <name>, without allocating any
parameter field memory. When name is subsequently executed, the address
of the first byte of <name>'s parameter field is left on the stack.
--------------------------------------------------
got <name> from the input stream. Even the page on notation says nothing,
so I really appreciate how you pointed out your convention for notating
this. Also, thanks for pointing out the use of DOES> in this context.
Even though my header said DYNAMIC CONSTANTS you cleary saw through
this to see what I was really trying to do was to make a defining
word for byte arrays.
Thank you very much for your help,
Harold Carr
-------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads