--- gforth/doc/makedoc.fs 1997/08/03 20:21:55 1.2 +++ gforth/doc/makedoc.fs 2004/12/31 13:24:02 1.10 @@ -1,6 +1,6 @@ \ create a documentation file -\ Copyright (C) 1995 Free Software Foundation, Inc. +\ Copyright (C) 1995,1999,2000,2003,2004 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -16,7 +16,7 @@ \ You should have received a copy of the GNU General Public License \ 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 -- ) @@ -26,8 +26,8 @@ \ .... name ( stack-effect ) \ [prefix-] wordset [pronounciation] \ \G description ... -\ The output is a Forth source file that looks like this: -\ doc[-prefix]-entry name stack-effect ) wordset [pronountiation] +\ The output is a file of entries that look like this: +\ make-doc [--prefix]-entry name stack-effect ) wordset [pronounciation] \ description \ \ (i.e., the entry is terminated by an empty line or the end-of-file) @@ -57,16 +57,21 @@ r/w create-file throw value doc-file-id 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 ( -- ) - source >in @ /string doc-file-id write-line throw + source >in @ /string >fileCR source >in ! drop ; immediate : put-doc-entry ( -- ) - locals-list @ 0= \ not in a colon def, i.e., not a local name - last @ 0<> and \ not an anonymous (i.e. noname) header + dpp @ normal-dp = \ not defining locals + latest 0<> and \ not an anonymous (i.e. noname) header if - s" " doc-file-id write-line throw - s" make-doc " doc-file-id write-file throw + s" " >fileCR + s" make-doc " >file >in @ >r [char] ( parse 2drop [char] ) parse @@ -76,17 +81,17 @@ s" \ automatically generated by makedoc. IF dup count 1- chars + c@ [char] - = IF - s" --" doc-file-id write-file throw - count doc-file-id write-file throw drop + s" --" >file + count >file 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 + latest name>string >file + >file + s" )" >file POSTPONE \g r> >in ! endif ;