Article View: net.lang.forth
Article #134re: DYNAMIC CONSTANTS
From: 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
-------
Technical Details
Message-ID:
<3036@utah-cs.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!hou3c!hocda!houxm!ihnp4!zehntel!hplabs!utah-cs!carrShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utah-cs.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!hou3c!hocda!houxm!ihnp4!zehntel!hplabs!utah-cs!carr From: carr@utah-cs.UUCP (Harold Carr) Newsgroups: net.lang.forth Subject: re: DYNAMIC CONSTANTS Message-ID: <3036@utah-cs.UUCP> Date: Wed, 19-Sep-84 11:49:54 EDT Article-I.D.: utah-cs.3036 Posted: Wed Sep 19 11:49:54 1984 Date-Received: Tue, 25-Sep-84 19:49:05 EDT Organization: Univ of Utah CS Dept Lines: 39