retroforth/example/display-word-location-information.retro

18 lines
610 B
Forth
Raw Normal View History

# 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
~~~