| \ it takes the name of the doc-file to be generated. |
\ it takes the name of the doc-file to be generated. |
| |
|
| \ the forth source must have the following format: |
\ the forth source must have the following format: |
| \ .... name ( stack-effect ) \ wordset [pronounciation] |
\ .... name ( stack-effect ) \ [prefix-] wordset [pronounciation] |
| \ \G description ... |
\ \G description ... |
| |
|
| \ The output is a Forth source file that looks like this: |
\ The output is a Forth source file that looks like this: |
| \ doc-entry name stack-effect ) wordset [pronountiation] |
\ doc[-prefix]-entry name stack-effect ) wordset [pronountiation] |
| \ description |
\ description |
| \ |
\ |
| \ (i.e., the entry is terminated by an empty line or the end-of-file) |
\ (i.e., the entry is terminated by an empty line or the end-of-file) |
| if |
if |
| s" " doc-file-id write-line throw |
s" " doc-file-id write-line throw |
| s" make-doc " doc-file-id write-file throw |
s" make-doc " doc-file-id write-file throw |
| last @ name>string doc-file-id write-file throw |
>in @ >r |
| >in @ |
|
| [char] ( parse 2drop |
[char] ( parse 2drop |
| [char] ) parse doc-file-id write-file throw |
[char] ) parse |
| s" )" doc-file-id write-file throw |
|
| [char] \ parse 2drop |
[char] \ parse 2drop |
| |
>in @ |
| |
bl word dup c@ |
| |
IF |
| |
dup count 1- chars + c@ [char] - = |
| |
IF |
| |
s" --" doc-file-id write-file throw |
| |
count doc-file-id write-file throw drop |
| |
ELSE |
| |
drop >in ! |
| |
THEN |
| |
ELSE |
| |
drop >in ! |
| |
THEN |
| |
last @ name>string doc-file-id write-file throw |
| |
doc-file-id write-file throw |
| |
s" )" doc-file-id write-file throw |
| POSTPONE \g |
POSTPONE \g |
| >in ! |
r> >in ! |
| endif ; |
endif ; |
| |
|
| : (doc-header) ( -- ) |
: (doc-header) ( -- ) |