Node:Name token, Previous:Compilation token, Up:Tokens for Words
Gforth represents named words by the name token, (nt). Name token is an abstract data type that occurs as argument or result of the words below.
The closest thing to the nt in older Forth systems is the name field
address (NFA), but there are significant differences: in older Forth
systems each word had a unique NFA, LFA, CFA and PFA (in this order, or
LFA, NFA, CFA, PFA) and there were words for getting from one to the
next. In contrast, in Gforth 0...n nts correspond to one xt; there
is a link field in the structure identified by the name token, but
searching usually uses a hash table external to these structures; the
name in Gforth has a cell-wide count-and-flags field, and the nt is not
implemented as the address of that count field.
Find the name c-addr u in the current search order. Return its nt, if found, otherwise 0.
find-namec-addr u -- nt | 0 gforth ``find-name''
nt is the name token of the last word defined; it is 0 if the last word has no name.
latest-- nt gforth ``latest''
tries to find the name token nt of the word represented by xt; returns 0 if it fails. This word is not absolutely reliable, it may give false positives and produce wrong nts.
>namext -- nt|0 gforth ``to-name''
xt represents the interpretation semantics of the word nt. If nt has no interpretation semantics (i.e. is
name>intnt -- xt gforth ``name>int''
compile-only), xt is the execution token for
ticking-compile-only-error, which performs
name?intnt -- xt gforth ``name?int''
name>int, but perform
-2048 throwif nt has no interpretation semantics.
w xt is the compilation token for the word nt.
name>compnt -- w xt gforth ``name>comp''
addr count is the name of the word represented by nt.
name>stringnt -- addr count gforth ``head-to-string''
Print the name of the word represented by nt.
id.nt -- gforth ``id.''
Gforth <=0.5.0 name for
.nament -- unknown ``.name''
F83 name for
.idnt -- unknown ``.id''