In gforth I can see a word's definition with see wordname
and even get its execution token with ' wordname
and also some information with the see subwords such as ' wordname seecol
I have not been able to find a way to get the output of see wordname
into a string. I have tried fiddling with stdout and stdin words but cant find the right words.
Can anyone help me please?
Gforth provides a word >string-execute ( i*x xt – j*x c-addr u )
that redirects the output of type
and emit
to a string.
"see wordname" ' evaluate >string-execute type
' see >string-execute wordname type
"wordname" ' see ' execute-parsing >string-execute type
' wordname ' xt-see >string-execute type
: dis-xt ( xt -- sd.disforth )
['] xt-see >string-execute
;
: dis-word ( sd.name -- sd.disforth )
['] see ['] execute-parsing >string-execute
;
The datatype symbol sd
means a character string represented by a cell pair ( c-addr u )
.
' traverse-wordlist dis-xt type
"traverse-wordlist" dis-word type