schemedoc own parser load.scm - 1

This commit is contained in:
erana 2012-01-17 22:54:48 +09:00
parent 587fc32e72
commit 5496960c82
2 changed files with 45 additions and 12 deletions

View File

@ -32,9 +32,28 @@
;; main program
;;
(define $SCHEMEDOCDIR (getenv "SCHEMEDOCDIR"))
(case $SCHEMEDOCDIR
((#f) (for-each display
'("set your SCHEMEDOCDIR env var to the paths where pods and sods reside." (eoln) "exiting" (eoln))
(define ask (getenv "SCHEMEDOCDIR"))
(case ask
((#f) (begin (for-each
display
'("set your SCHEMEDOCDIR env var to the paths where pods and sods reside." (eoln) "exiting" (eoln)))
(exit) ;; NOTE exit
)))
;;(for-each schemedoc-parser-grep SCHEMEDOCDIR)
(define directoriesl (schemedoc-get-env-list SCHEMEDOCDIR))
(for-each display directoriesl)
(display directoriesl)
(do ((l directoriesl (cdr l)))
((null? l)
0)
(display (directory-files (car l)) )
(do ((l2 (directory-files (car l)) (cdr l2)))
((null? l2)0)
(schemedoc-parser-grep (car l2)))
)
;;(for-each directory-files directoriesl)

View File

@ -87,9 +87,23 @@
(line "")
(lines '()))
(do ((l le (cdr l)))
((or (eof-object? l)
(and (eq? (car l) #\newline)(string<=? "=item" line)))
((eof-object? l)0)
(if (and (eq? (car l) #\newline)(string<=? "=item" line))
(begin
(set! lines (append lines (list line)))
(set! line ""))
(set! line (string-append line (string (car l))))
(for-each display lines))))
(set! line "")))
(set! line (string-append line (string (car l)))))
(for-each display lines)))
(define (schemedoc-get-env-list SCHEMEDOCDIR)
(let ((directory "")
(directories '()))
(do ((i 0 (+ i 1)))
((>= i (string-length SCHEMEDOCDIR))
(set! directories (append directories (list directory))))
(if (eq? (string-ref SCHEMEDOCDIR i) #\:)
(begin
(set! directories (append directories (list directory)))
(set! directory "")))
(set! directory (string-append directory (string (string-ref SCHEMEDOCDIR i)))))
directories))