version 1.1, 1997/05/21 20:40:04
|
version 1.5, 2000/09/23 15:47:06
|
Line 1
|
Line 1
|
\ create a documentation file |
\ create a documentation file |
|
|
\ Copyright (C) 1995 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1999 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
Line 16
|
Line 16
|
|
|
\ You should have received a copy of the GNU General Public License |
\ You should have received a copy of the GNU General Public License |
\ along with this program; if not, write to the Free Software |
\ along with this program; if not, write to the Free Software |
\ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
|
|
|
|
\ the stack effect of loading this file is: ( addr u -- ) |
\ the stack effect of loading this file is: ( addr u -- ) |
\ 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 file of entries that look like this: |
\ doc-entry name stack-effect ) wordset [pronountiation] |
\ make-doc [--prefix]-entry name stack-effect ) wordset [pronounciation] |
\ 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) |
Line 57 r/w create-file throw value doc-file-id
|
Line 57 r/w create-file throw value doc-file-id
|
|
|
s" \ automatically generated by makedoc.fs" doc-file-id write-line throw |
s" \ automatically generated by makedoc.fs" doc-file-id write-line throw |
|
|
|
: >fileCR ( c-addr u -- ) |
|
doc-file-id write-line throw ; |
|
: >file ( c-addr u -- ) |
|
doc-file-id write-file throw ; |
|
|
: \G ( -- ) |
: \G ( -- ) |
source >in @ /string doc-file-id write-line throw |
source >in @ /string >fileCR |
source >in ! drop ; immediate |
source >in ! drop ; immediate |
|
|
: put-doc-entry ( -- ) |
: put-doc-entry ( -- ) |
locals-list @ 0= \ not in a colon def, i.e., not a local name |
locals-list @ 0= \ not in a colon def, i.e., not a local name |
last @ 0<> and \ not an anonymous (i.e. noname) header |
last @ 0<> and \ not an anonymous (i.e. noname) header |
if |
if |
s" " doc-file-id write-line throw |
s" " >fileCR |
s" make-doc " doc-file-id write-file throw |
s" make-doc " >file |
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" --" >file |
|
count >file drop |
|
ELSE |
|
drop >in ! |
|
THEN |
|
ELSE |
|
drop >in ! |
|
THEN |
|
last @ name>string >file |
|
>file |
|
s" )" >file |
POSTPONE \g |
POSTPONE \g |
>in ! |
r> >in ! |
endif ; |
endif ; |
|
|
: (doc-header) ( -- ) |
: (doc-header) ( -- ) |