How can I get a words string representation on the data stack in Forth (gforth)?

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.

    Interactive usage examples

    "see wordname" ' evaluate >string-execute type
    ' see >string-execute wordname type
    "wordname" ' see ' execute-parsing >string-execute type
    ' wordname ' xt-see >string-execute type

    Helper words

    : dis-xt ( xt -- sd.disforth )
      ['] xt-see >string-execute 
    : dis-word ( -- sd.disforth )
      ['] see ['] execute-parsing >string-execute

    The datatype symbol sd means a character string represented by a cell pair ( c-addr u ).

    Helper words usage examples

    ' traverse-wordlist dis-xt type
    "traverse-wordlist" dis-word type