retroforth/example/display-word-location-information.retro
crc 660e52bdcb rename words in sys: to script: (old names still work in this release, but are deprecated)
FossilOrigin-Name: 1a43743f43076eb087ee4dd7fbfa96b8dfda2aa4ddcff41e6a5a9634ba6e239c
2020-09-14 19:55:02 +00:00

17 lines
610 B
Forth

# Display Word Information Upon Definition
This uses the `script:current-file` and `script:current-line` words from
the Unix implementation of RETRO to display some information about
a word's location as the words are defined.
Something similar could be used to generate a *tags* file or to
populate a runtime database of location information.
~~~
[ (Display_the_word_name) 'abc 'abca reorder s:put tab
(and_the_current_line_#) script:current-line n:put tab
(and_the_current_file) script:current-file s:put nl
(call_the_original_d:add-header) &d:add-header #2 + call ]
&d:add-header set-hook
~~~