Hash :
1a08f436
Author :
Date :
2010-08-25T09:23:17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
\ words.fth 2.9 02/11/26
\ Copyright 1985-1990 Bradley Forthware
\ Copyright 1990-2002 Sun Microsystems, Inc. All Rights Reserved
\ Copyright Use is subject to license terms.
\ Display the WORDS in the Context Vocabulary
decimal
only forth also definitions
: over-vocabulary (s acf-of-word-to-execute voc-acf -- )
follow begin another? while ( acf anf )
n>link over execute ( acf )
repeat ( acf ) drop
;
: +words (s -- )
0 lmargin ! d# 64 rmargin ! d# 14 tabstops !
??cr
begin another? while ( anf )
dup name>string nip .tab ( anf )
.id ( )
exit? if exit then ( )
repeat ( )
;
: follow-to (s adr voc-acf -- error? )
follow begin another? while ( adr anf )
over u< if drop false exit then ( adr )
repeat ( adr )
drop true
;
: prior-words (s adr -- )
context token@ follow-to if
." There are no words prior to this address." cr
else
+words
then
;
\ [ifdef] Daktari
\ [message] XXX (words) and voc-words for Daktari
: (words) ( lmarg rmarg tabs -- )
tabstops ! \ Set tab/column width
rmargin ! \ Set right-hand margin
lmargin ! \ Set left-hand margin
??cr
0 context token@ ( 0 voc-acf )
begin another-word? while ( alf voc-acf anf )
dup name>string nip .tab ( alf voc-acf anf )
.id ( alf voc-acf )
exit? if 2drop exit then ( alf voc-acf )
repeat ( )
;
\ [then]
: words (s -- )
0 lmargin ! d# 64 rmargin ! d# 14 tabstops ! ??cr
0 context token@ ( 0 voc-acf )
begin another-word? while ( alf voc-acf anf )
dup name>string nip .tab ( alf voc-acf anf )
.id ( alf voc-acf )
exit? if 2drop exit then ( alf voc-acf )
repeat ( )
;
\ [ifdef] Daktari
\ voc-words -- List all words in a specified vocabulary
: voc-words (s lmarg rmarg tabs vocabulary-xt -- )
also execute \ Select specified vocabulary
(words) \ List out the vocabulary
previous \ Discard specified vocabulary
;
\ [then]
only definitions forth also
: words words ; \ Version for 'root' vocabulary
only forth also definitions