diff --git a/RELEASE b/RELEASE index 25a22cb..3bbf857 100644 --- a/RELEASE +++ b/RELEASE @@ -25,6 +25,8 @@ New in this release ./configure option to set default scsh library directories Support for DESTDIR for easier packaging New SRFI + Switch to load exec scripts from library path + Removed scheme/infix/ Bug fixes API changes New in 0.6.4 @@ -190,6 +192,14 @@ We manage the project using SourceForge: ** New SRFI This release adds support for SRFI 42. +** Switch to load exec scripts from library path + The new switch -lel searches the library path for a file and loads + the file into the exec package. + +** Removed scheme/infix/ + The directory scheme/infix/ had a non-free copyright licence and + has been removed. + ** Bug fixes - SEEK currently works on unbuffered ports only. Check this in the implementation and oopsify it in the manual. diff --git a/doc/scsh-manual/running.tex b/doc/scsh-manual/running.tex index 19c8f84..7ddd0c2 100644 --- a/doc/scsh-manual/running.tex +++ b/doc/scsh-manual/running.tex @@ -214,6 +214,8 @@ where & \ex{-ll} \var{module-file-name} & As in -lm, but search the library path list.\\ + & \ex{-lel} \var{exec-file-name} + & As in -le, but search the library path list.\\ & \ex{+lp} \var{dir} & Add dir to front of library path list.\\ & \ex{lp+} \var{dir} @@ -455,6 +457,11 @@ SCSH_LIB_DIRS='"." "/usr/contrib/lib/scsh/" #f "/home/shivers/lib/scsh"' Directory search can be recursive. A directory name that ends with a slash is recursively searched. +\Item{-lel \var{exec-file-name}} + As above, but load the specified file into scsh's exec package. + This is just like the \ex{-le} switch, except that it searches the + library-directory path list for the file to load. + \Item{+lp \var{lib-dir},lp+ \var{lib-dir}} Add directory \var{lib-dir} to the beginning or end of the \textit{library-directories} path list, respectively. diff --git a/scsh/top.scm b/scsh/top.scm index 1d91323..ffdc942 100644 --- a/scsh/top.scm +++ b/scsh/top.scm @@ -60,6 +60,7 @@ ;;; -lm Load into config package. ;;; -le Load into exec package. ;;; -ll As in -lm, but search the library path list. +;;; -lel As in -le, but search the library path list. ;;; ;;; +lp Add onto start of library path list. ;;; lp+ Add onto end of library path list. @@ -147,6 +148,7 @@ (string=? arg "-lm") (string=? arg "-le") (string=? arg "-ll") + (string=? arg "-lel") (string=? arg "lp+") (string=? arg "+lp") (string=? arg "lpe+") @@ -256,7 +258,13 @@ (lp switches script-loaded?)) ((string=? (car switch) "-ll") - (load-library-file (cdr switch) (mod-dirs) script-file) + (load-library-file (cdr switch) (mod-dirs) script-file + (config-package)) + (lp switches script-loaded?)) + + ((string=? (car switch) "-lel") + (load-library-file (cdr switch) (mod-dirs) script-file + (user-command-environment)) (lp switches script-loaded?)) ((string=? (car switch) "+lp") @@ -417,17 +425,17 @@ (add-narrowed-exit-hook! flush-all-ports-no-threads) -(define (load-library-file file lib-dirs script-file) +(define (load-library-file file lib-dirs script-file package) ; (format (error-output-port) "Load-library-file: ~a ~s\n" file lib-dirs) (cond ((file-name-absolute? file) - (load-quietly file (config-package))) + (load-quietly file package)) ;; Search library dirs for FILE. ((find-library-file file lib-dirs script-file) => - (lambda (iport) - (load-quietly iport (config-package)))) ; Load it. + (lambda (file) + (load-quietly file package))) ; Load it. - (else (error "Couldn't find library module file" file lib-dirs)))) + (else (error "Couldn't find library file" file lib-dirs)))) ;;; Search library dirs for FILE. (define (find-library-file file lib-dirs script-file) @@ -482,17 +490,18 @@ ;;; Parse up the $SCSH_LIB_DIRS path list. (define (parse-lib-dirs-env-var) - (let ((s (getenv "SCSH_LIB_DIRS"))) - (if (not s) default-lib-dirs + (map resolve-file-name + (let ((s (getenv "SCSH_LIB_DIRS"))) + (if (not s) default-lib-dirs - (with-current-input-port (make-string-input-port s) - (let recur () - (let ((val (read))) - (cond ((eof-object? val) '()) - ((string? val) (cons val (recur))) - ((not val) (append default-lib-dirs (recur))) - (else (error "Illegal path element in $SCSH_LIB_DIRS" - s val))))))))) + (with-current-input-port (make-string-input-port s) + (let recur () + (let ((val (read))) + (cond ((eof-object? val) '()) + ((string? val) (cons val (recur))) + ((not val) (append default-lib-dirs (recur))) + (else (error "Illegal path element in $SCSH_LIB_DIRS" + s val)))))))))) (define (bad-arg . msg) (with-current-output-port (current-error-port) @@ -513,6 +522,7 @@ switch: -e Specify top-level entry point. -l Load file into current package. -ll As in -lm, but search the library path list. + -lel As in -le, but search the library path list. +lp Add to front of library path list. lp+ Add to end of library path list. +lpe +lp, with env var and ~user expansion.