diff --git a/Makefile b/Makefile index d2162e6..d7b10fb 100644 --- a/Makefile +++ b/Makefile @@ -149,17 +149,6 @@ all: noweb ${MNT}/${SYS}/bin/document rm -f *.aux ) ; \ fi @ if [ "$RUNTYPE" = "parallel" ] ; then \ - ( echo p6 starting parallel make of help ; \ - ${ENV} $(MAKE) help ${NOISE} & ) ; \ - else \ - ( echo s6 starting serial make of help ; \ - mkdir -p ${MNT}/${SYS}/doc/spadhelp ; \ - mkdir -p ${INT}/input ; \ - cd ${SRC}/algebra ; \ - ${TANGLE} -t8 Makefile.pamphlet >Makefile.help ; \ - ${ENV} $(MAKE) -f Makefile.help parallelhelp ) ; \ - fi - @ if [ "$RUNTYPE" = "parallel" ] ; then \ ( echo s2 starting parallel make of books ; \ echo s3 ${SPD}/books/Makefile from \ ${SPD}/books/Makefile.pamphlet ; \ @@ -191,14 +180,6 @@ all: noweb ${MNT}/${SYS}/bin/document @ ${ENV} $(MAKE) -f Makefile.${SYS} @ echo 3 finished system build on `date` | tee >lastBuildDate -help: - @ echo p8 making of help files - @ ( mkdir -p ${MNT}/${SYS}/doc/spadhelp ; \ - mkdir -p ${INT}/input ; \ - cd ${SRC}/algebra ; \ - ${TANGLE} -t8 Makefile.pamphlet >Makefile.help ; \ - ${ENV} $(MAKE) -f Makefile.help parallelhelp ) - input: @ echo p9 making input documents @ ( mkdir -p ${MNT}/${SYS}/doc/src/input ; \ diff --git a/Makefile.pamphlet b/Makefile.pamphlet index fc46ee0..ed30b4a 100644 --- a/Makefile.pamphlet +++ b/Makefile.pamphlet @@ -70,12 +70,6 @@ all: noweb ${MNT}/${SYS}/bin/document rm -f *.toc ; \ rm -f *.aux ) ; \ fi - @ ( echo s6 starting parallel make of help ; \ - mkdir -p ${MNT}/${SYS}/doc/spadhelp ; \ - mkdir -p ${INT}/input ; \ - cd ${SRC}/algebra ; \ - ${TANGLE} -t8 Makefile.pamphlet >Makefile.help ; \ - ${ENV} $(MAKE) -f Makefile.help parallelhelp ) & @ if [ "$RUNTYPE" = "parallel" ] ; then \ ( echo s2 starting parallel make of books ; \ echo s3 ${SPD}/books/Makefile from \ @@ -108,14 +102,6 @@ all: noweb ${MNT}/${SYS}/bin/document @ ${ENV} $(MAKE) -f Makefile.${SYS} @ echo 3 finished system build on `date` | tee >lastBuildDate -help: - @ echo p8 making of help files - @ ( mkdir -p ${MNT}/${SYS}/doc/spadhelp ; \ - mkdir -p ${INT}/input ; \ - cd ${SRC}/algebra ; \ - ${TANGLE} -t8 Makefile.pamphlet >Makefile.help ; \ - ${ENV} $(MAKE) -f Makefile.help parallelhelp ) - input: @ echo p9 making input documents @ ( mkdir -p ${MNT}/${SYS}/doc/src/input ; \ diff --git a/books/tangle.lisp b/books/tangle.lisp index d2d53f6..ec108f4 100644 --- a/books/tangle.lisp +++ b/books/tangle.lisp @@ -9,7 +9,9 @@ ; 8 GCL-EXPAND ; 9 ISCHUNK-LATEX ; 10 ISCHUNK-NOWEB - +; 11 ALLCHUNKS +; 12 makeHelpFiles +; 13 makeInputFiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -348,5 +350,103 @@ (values 'end nil)) (t (values nil nil))))) - + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; 11 allchunks +;;; +;;; allchunks will make a single pass over a book extracting any chunk +;;; that fits the PATTERN from the FROMFILE to the TODIR. The chunk +;;; format is either noweb (if true) or latex (if false). +;;; +;;; allchunks takes 4 arguments, +;;; the PATTERN (a string like ".help>>" +;;; the FROMFILE (a string like "/axiom/books/bookvol5.pamphlet") +;;; the TODIR (a string like "/axiom/mnt/ubuntu/doc/spadhelp") +;;; and a boolean NOWEB? (true is noweb format chunks, false is latex style) +;;; +;;; a chunk name is expected to be of the form: +;;; <>= +;;; which means that a chunk matching the pattern (e.g. ".input>>") +;;; will be extracted to the file TODIR/FROMFILE.PATTERN +;;; +;;; This is used for <> and <> file extraction. +;;; allchunks is used to extract help files and input files in a single +;;; pass over the books. Since there are hundreds of input files and +;;; help files this is a significant speedup. + +(defun allchunks (pattern fromfile todir noweb?) + (setq *chunkhash* (make-hash-table :test #'equal)) + (when *chunknoise* (format t "PASS 1~%")) + (gcl-hashchunks (gcl-read-file fromfile) noweb?) + (when *chunknoise* (format t "PASS 2~%")) + (maphash #'(lambda (key value) + (if (search pattern key) + (let ((helpfile (concatenate 'string todir "/" + (subseq key 2 (- (length key) 2))))) + (with-open-file (out helpfile :direction :output) + (format t "extracting ~a~%" helpfile) + (gcl-expand key noweb? out))))) + *chunkhash*)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; 12 makeHelpFiles +;;; +;;; The makeHelpFiles function creates all of the help files in a single +;;; pass over the file. The usual method of extracting each individual +;;; help file requires hundreds of passes over the file. +;;; +;;; An example call is: +;;; +;;; (makeHelpFiles) +;;; +;;; This will find all of the .help chunks in books of interest +;;; and write each chunk to the target directory in its own filename. +;;; So if a chunk name is <> the above call will create +;;; the file "/tmp/help/somedomain.help" containing the chunk value. + +;;; Help documentation for algebra + +;;; The help documentation for algebra files lives within the algebra +;;; pamphlet. The help chunk contains the name of the domain, thus: + +;;; <>= +;;; ==================================================================== +;;; thisdomain examples +;;; ==================================================================== +;;; +;;; (documentation for this domain) +;;; +;;; examplefunction foo +;;; output +;;; Type: thetype +;;; +;;; See Also: +;;; o )show thisdomain +;;; o $AXIOM/bin/src/doc/algebra/thisfile.spad.dvi +;;; +;;; @ + +;;; The .help files are automatically extracted by code in books/tangle.lisp +;;; and placed in the directory \verb|${HELP}|. +;;; +;;; The documentation starts off with the domain enclosed in two lines +;;; of equal signs. The documentation is free format. Generally the +;;; functions are indented two spaces, the output is indented 3 spaces, +;;; and the Type field has been moved toward the center of the line. +;;; +;;; The ``See Also:'' section lists the domain with the ``show'' command +;;; and the path to the source file in dvi format. + +(defun makeHelpFiles () + (let ((AXIOM (si::getenv "AXIOM")) (BOOKS (si::getenv "BOOKS")) HELP PAT) + (setq HELP (concatenate 'string AXIOM "/doc/spadhelp")) + (setq PAT ".help>>") + (allchunks PAT (concatenate 'string BOOKS "/bookvol5.pamphlet") HELP t) + (allchunks PAT (concatenate 'string BOOKS "/bookvol10.2.pamphlet") HELP t) + (allchunks PAT (concatenate 'string BOOKS "/bookvol10.3.pamphlet") HELP t) + (allchunks PAT (concatenate 'string BOOKS "/bookvol10.4.pamphlet") HELP t) + (allchunks PAT (concatenate 'string BOOKS "/bookvol10.5.pamphlet") HELP t))) + + + diff --git a/changelog b/changelog index 787cb87..923d11c 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +20101024 tpd src/axiom-website/patches.html 20101024.03.tpd.patch +20101024 tpd Makefile.pamphlet automate making help files +20101024 tpd Makefile automate making help files +20101024 tpd src/algebra/Makefile automate making help files +20101024 tpd books/tangle.lisp automate making help files 20101024 tpd src/axiom-website/patches.html 20101024.02.tpd.patch 20101024 tpd src/interp/vmlisp.lisp treeshake compiler 20101024 tpd books/bookvol9 treeshake compiler diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index e1bcea8..6fa2199 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -16649,7 +16649,7 @@ DOC=${MNT}/${SYS}/doc/src/algebra OUTSRC=${MNT}/${SYS}/src/algebra INPUT=${INT}/input HELP=${MNT}/${SYS}/doc/spadhelp -BOOKS=${SPD}/books +LISP=${OBJ}/${SYS}/bin/lisp BOOKSRC=${SPD}/books/bookvol5.pamphlet @ @@ -27003,18 +27003,21 @@ ${HELP}/dcopy.help: ${BOOKS}/bookvol10.5.pamphlet <> <> -all: src ${OUT}/libdb.text ${SPADBIN}/index.html gloss +all: fasthelp src ${OUT}/libdb.text ${SPADBIN}/index.html gloss @ echo 4302 finished ${IN} -parallelhelp: syntaxhelp ${SPADHELP} - -syntaxhelp: - @echo 9 making ${HELP} files from ${BOOKSRC} - @(mkdir -p ${HELP} ; \ - cd ${HELP} ; \ - for i in ${SYNTAXHELP} ; do \ - ${TANGLE} -R"$$i" ${BOOKSRC} >$$i ; \ - done ; ) +fasthelp: + @echo 5000 making .help files with lisp + @ echo '(extracthelp "${BOOKS}/bookvol5.pamphlet" "${HELP}" t)' \ + | ${LISP} + @ echo '(extracthelp "${BOOKS}/bookvol10.2.pamphlet" "${HELP}" t)' \ + | ${LISP} + @ echo '(extracthelp "${BOOKS}/bookvol10.3.pamphlet" "${HELP}" t)' \ + | ${LISP} + @ echo '(extracthelp "${BOOKS}/bookvol10.4.pamphlet" "${HELP}" t)' \ + | ${LISP} + @ echo '(extracthelp "${BOOKS}/bookvol10.5.pamphlet" "${HELP}" t)' \ + | ${LISP} <> diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 351910f..be9418f 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3246,5 +3246,7 @@ books/bookvolbib add Michael Wester [Wes99]
src/axiom-website/documentation.html add literate thinking quote
20101024.02.tpd.patch books/bookvol9 treeshake compiler
+20101024.03.tpd.patch +books/tangle.lisp automate making help files