From 1e5b4fdd6d2d5585db0deda9f143585686e222dc Mon Sep 17 00:00:00 2001 From: erana Date: Tue, 17 Jan 2012 23:58:09 +0900 Subject: [PATCH] schemedoc search functionality - 1 --- scsh/schemedoc/README | 4 ++-- scsh/schemedoc/load.scm | 23 +++++++++++++++++++++-- scsh/schemedoc/schemedoc.scm | 10 +++++++++- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/scsh/schemedoc/README b/scsh/schemedoc/README index eff10f0..9509a56 100644 --- a/scsh/schemedoc/README +++ b/scsh/schemedoc/README @@ -1,2 +1,2 @@ -A pretty printing system --- Johan +A search utility which reads perl pod directories. +Eventually scheme sod directories. diff --git a/scsh/schemedoc/load.scm b/scsh/schemedoc/load.scm index 89a1060..82217ad 100644 --- a/scsh/schemedoc/load.scm +++ b/scsh/schemedoc/load.scm @@ -51,6 +51,25 @@ (set! SCHEMEDOCITEMS (append SCHEMEDOCITEMS (list (schemedoc-parser-grep (car l2))))) ))) -(display "Your search is in the variable SCHEMEDOCITEMS list.")(newline) -(display "You can regexp it if you want.")(newline) +(display "Your search is in the variable SCHEMEDOCITEMS list variable.") +(newline) +(display "You can regexp it if you want.") +(newline) +(define (schemedoc-search) + (display "Do you want to search for something ? (type y/n)") + (let ((s (read))) + (newline) + (cond ((and (symbol? s)(eq? s 'y)) + (display "What do you want to search for ?") + (let ((s (read))) + (newline) + (let ((itemtexts (schemedoc-parser-get-items s SCHEMEDOCITEMS))) + (display "Do you want me to print the items of your search ?") + (let ((s (read))) + (newline) + (cond ((and (symbol? s)(eq? s 'y)) + (display itemtexts)) + (else (schemedoc-search))))))) + (else (schemedoc-search))))) +(schemedoc-search) diff --git a/scsh/schemedoc/schemedoc.scm b/scsh/schemedoc/schemedoc.scm index 7c3fa83..b237000 100644 --- a/scsh/schemedoc/schemedoc.scm +++ b/scsh/schemedoc/schemedoc.scm @@ -120,4 +120,12 @@ (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 + directories)) + +(define (schemedoc-parser-get-items keyword itemtexts) + (let ((returntext "")) + (do ((l itemtexts (cdr l))) + ((null? l)0) + (cond ((string<=? keyword (car l)) + (set! returntext (string-append returntext (car l)))))) + returntext)) \ No newline at end of file