summaryrefslogtreecommitdiff
path: root/doc/snarf.scm
diff options
context:
space:
mode:
Diffstat (limited to 'doc/snarf.scm')
-rw-r--r--doc/snarf.scm38
1 files changed, 23 insertions, 15 deletions
diff --git a/doc/snarf.scm b/doc/snarf.scm
index 5dd2f7d..15088c0 100644
--- a/doc/snarf.scm
+++ b/doc/snarf.scm
@@ -78,27 +78,35 @@
(string-upcase (symbol->string sym)))
(resolve-interface module)))
(let ((unsorted
- (module-map
- (lambda (sym var)
- (let ((proc (variable-ref var)))
- (cons sym (format #false
- "\
+ (filter identity
+ (module-map
+ (lambda (sym var)
+ (false-if-exception
+ (let ((proc (variable-ref var)))
+ (cons sym (format #false
+ "\
@cindex ~a
@deffn {Scheme Procedure} ~a ~a
~a
@end deffn
" sym sym
- (arguments->string proc)
- (fancy-docstring proc known-procedures)))))
- (resolve-interface module))))
+(arguments->string proc)
+(fancy-docstring proc known-procedures))))))
+ (resolve-interface module)))))
(sort unsorted (lambda (a b)
(string< (symbol->string (car a))
(symbol->string (car b)))))))
-(with-output-to-file "doc/low.texi"
- (lambda ()
- (for-each (match-lambda
- ((sym . doc)
- (display doc)
- (newline)))
- (docs '(drmaa v1 low)))))
+(define (main . args)
+ (match (command-line)
+ ((_ module file)
+ (let ((directory (dirname file)))
+ (unless (file-exists? directory)
+ (mkdir directory)))
+ (with-output-to-file file
+ (lambda ()
+ (for-each (match-lambda
+ ((sym . doc)
+ (display doc)
+ (newline)))
+ (docs (call-with-input-string module read))))))))