From 5496960c8269c71523cfead411017a0dd86d3264 Mon Sep 17 00:00:00 2001 From: erana Date: Tue, 17 Jan 2012 22:54:48 +0900 Subject: [PATCH] schemedoc own parser load.scm - 1 --- scsh/schemedoc/load.scm | 31 +++++++++++++++++++++++++------ scsh/schemedoc/schemedoc.scm | 26 ++++++++++++++++++++------ 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/scsh/schemedoc/load.scm b/scsh/schemedoc/load.scm index 8718c6d..08df26f 100644 --- a/scsh/schemedoc/load.scm +++ b/scsh/schemedoc/load.scm @@ -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)) - (exit) ;; NOTE exit - ))) +(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) diff --git a/scsh/schemedoc/schemedoc.scm b/scsh/schemedoc/schemedoc.scm index 7039b04..fd69b8d 100644 --- a/scsh/schemedoc/schemedoc.scm +++ b/scsh/schemedoc/schemedoc.scm @@ -87,9 +87,23 @@ (line "") (lines '())) (do ((l le (cdr l))) - ((or (eof-object? l) - (and (eq? (car l) #\newline)(string<=? "=item" line))) - (set! lines (append lines (list line))) - (set! line "")) - (set! line (string-append line (string (car l)))) - (for-each display lines)))) + ((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))) + +(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)) \ No newline at end of file