(defvar *chunkhash* nil "this hash table contains the chunks found") (defvar *chunknoise* nil "turn this on to debug internals") (defun tangle (filename topchunk &optional file) "Extract the source code from a pamphlet file" (let ((noweb? (char= (schar topchunk 0) #\<))) (setq *chunkhash* (make-hash-table :test #'equal)) (when *chunknoise* (format t "PASS 1~%")) (gcl-hashchunks (gcl-read-file filename) noweb?) (when *chunknoise* (format t "PASS 2~%")) (if (and file (stringp file)) (with-open-file (out file :direction :output) (gcl-expand topchunk noweb? out)) (gcl-expand topchunk noweb? t))) (values))