version 1.52, 2000/08/14 21:54:18
|
version 1.53, 2000/08/16 09:26:53
|
Line 395 const Create ??? 0 , 3 c, char ? c, cha
|
Line 395 const Create ??? 0 , 3 c, char ? c, cha
|
dup wordlist-map @ find-method perform ; |
dup wordlist-map @ find-method perform ; |
|
|
: search-wordlist ( c-addr count wid -- 0 | xt +-1 ) \ search |
: search-wordlist ( c-addr count wid -- 0 | xt +-1 ) \ search |
\G Search the word list identified by @i{wid} |
\G Search the word list identified by @i{wid} for the definition |
\G for the definition named by the string at @i{c-addr count}. |
\G named by the string at @i{c-addr count}. If the definition is |
\G If the definition is not found, return 0. If the definition |
\G not found, return 0. If the definition is found return 1 (if |
\G is found return 1 (if the definition is immediate) or -1 |
\G the definition is immediate) or -1 (if the definition is not |
\G (if the definition is not immediate) together with the @i{xt}. |
\G immediate) together with the @i{xt}. In Gforth, the @i{xt} |
\G The @i{xt} returned represents the interpretation semantics. |
\G returned represents the interpretation semantics. ANS Forth |
|
\G does not specify clearly what @i{xt} represents. |
(search-wordlist) dup if |
(search-wordlist) dup if |
(name>intn) |
(name>intn) |
then ; |
then ; |
Line 422 const Create ??? 0 , 3 c, char ? c, cha
|
Line 423 const Create ??? 0 , 3 c, char ? c, cha
|
then ; |
then ; |
|
|
: find ( c-addr -- xt +-1 | c-addr 0 ) \ core,search |
: find ( c-addr -- xt +-1 | c-addr 0 ) \ core,search |
\G Search all word lists in the current search order |
\G Search all word lists in the current search order for the |
\G for the definition named by the counted string at @i{c-addr}. |
\G definition named by the counted string at @i{c-addr}. If the |
\G If the definition is not found, return 0. If the definition |
\G definition is not found, return 0. If the definition is found |
\G is found return 1 (if the definition is immediate) or -1 |
\G return 1 (if the definition has non-default compilation |
\G (if the definition is not immediate) together with the @i{xt}. |
\G semantics) or -1 (if the definition has default compilation |
|
\G semantics). The @i{xt} returned in interpret state represents |
|
\G the interpretation semantics. The @i{xt} returned in compile |
|
\G state represented either the compilation semantics (for |
|
\G non-default compilation semantics) or the run-time semantics |
|
\G that the compilation semantics would @code{compile,} (for |
|
\G default compilation semantics). The ANS Forth standard does |
|
\G not specify clearly what the returned @i{xt} represents (and |
|
\G also talks about immediacy instead of non-default compilation |
|
\G semantics), so this word is questionable in portable programs. |
|
\G If non-portability is ok, @code{find-name} and friends are |
|
\G better (@pxref{Name token}). |
dup count sfind dup |
dup count sfind dup |
if |
if |
rot drop |
rot drop |