version 1.1, 1996/11/11 16:59:15
|
version 1.13, 2005/12/31 15:46:07
|
Line 1
|
Line 1
|
\ report words used from the various wordsets |
\ report words used from the various wordsets |
|
|
\ Copyright (C) 1996 Free Software Foundation, Inc. |
\ Copyright (C) 1996,1998,1999,2003,2005 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
Line 16
|
Line 16
|
|
|
\ You should have received a copy of the GNU General Public License |
\ You should have received a copy of the GNU General Public License |
\ along with this program; if not, write to the Free Software |
\ along with this program; if not, write to the Free Software |
\ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
|
|
|
|
\ Use this program like this: |
\ Use this program like this: |
Line 37
|
Line 37
|
\ This program uses Gforth internals and won't be easy to port |
\ This program uses Gforth internals and won't be easy to port |
\ to other systems. |
\ to other systems. |
|
|
|
\ !! ignore struct-voc stuff (dummy, [then] etc.). |
|
|
vocabulary ans-report-words ans-report-words definitions |
vocabulary ans-report-words ans-report-words definitions |
|
|
: wordset ( "name" -- ) |
: wordset ( "name" -- ) |
lastxt >body |
latestxt >body |
create |
create |
0 , \ link to next wordset |
0 , \ link to next wordset |
0 0 2, \ array of nfas |
0 0 2, \ array of nfas |
( lastlinkp ) last @ swap ! \ set link ptr of last wordset |
( lastlinkp ) latest swap ! \ set link ptr of last wordset |
; |
; |
|
|
wordlist constant wordsets wordsets set-current |
wordlist constant wordsets wordsets set-current |
Line 86 ans-report-words definitions
|
Line 88 ans-report-words definitions
|
|
|
table constant answords answords set-current |
table constant answords answords set-current |
warnings @ warnings off |
warnings @ warnings off |
include answords.fs |
include ./answords.fs |
warnings ! |
warnings ! |
ans-report-words definitions |
ans-report-words definitions |
|
|
Line 131 ans-report-words definitions
|
Line 133 ans-report-words definitions
|
: replace-word ( xt cfa -- ) |
: replace-word ( xt cfa -- ) |
\ replace word at cfa with xt. !! This is quite general-purpose |
\ replace word at cfa with xt. !! This is quite general-purpose |
\ and should migrate elsewhere. |
\ and should migrate elsewhere. |
dodefer: over code-address! |
\ the following no longer works with primitive-centric hybrid threading: |
>body ! ; |
\ dodefer: over code-address! |
|
\ >body ! ; |
|
dup @ docol: <> -12 and throw \ for colon defs only |
|
>body ['] branch xt>threaded over ! |
|
cell+ >r >body r> ! ; |
|
|
|
: print-names ( endaddr startaddr -- ) |
|
space 1 -rot |
|
u+do ( pos ) |
|
i @ name>string nip 1+ { len } |
|
len + ( newpos ) |
|
dup cols 4 - >= if |
|
cr space drop len 1+ |
|
endif |
|
i @ .name |
|
cell +loop |
|
drop ; |
|
|
forth definitions |
forth definitions |
ans-report-words |
ans-report-words |
Line 147 ans-report-words
|
Line 165 ans-report-words
|
dup >r name>int >body dup @ swap cell+ 2@ dup |
dup >r name>int >body dup @ swap cell+ 2@ dup |
if |
if |
." from " r@ .name ." :" cr |
." from " r@ .name ." :" cr |
bounds |
bounds print-names cr |
u+do |
|
i @ .name |
|
cell |
|
+loop |
|
cr |
|
else |
else |
2drop |
2drop |
endif |
endif |