summaryrefslogtreecommitdiffstats
path: root/require.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitfa3f23105ddcf07c5900de47f19af43d1db1b597 (patch)
treeb2c6cce6b97698098f50cbc78c23fdc0f8d401ab /require.scm
parentf24b9140d6f74804d5599ec225717d38ca443813 (diff)
downloadslib-fa3f23105ddcf07c5900de47f19af43d1db1b597.tar.gz
slib-fa3f23105ddcf07c5900de47f19af43d1db1b597.zip
Import Upstream version 2c3upstream/2c3
Diffstat (limited to 'require.scm')
-rw-r--r--require.scm17
1 files changed, 10 insertions, 7 deletions
diff --git a/require.scm b/require.scm
index 5b02ff6..ebaf49f 100644
--- a/require.scm
+++ b/require.scm
@@ -17,7 +17,7 @@
;promotional, or sales literature without prior written consent in
;each case.
-(define *SLIB-VERSION* "2c0")
+(define *SLIB-VERSION* "2c3")
;;; Standardize msdos -> ms-dos.
(define software-type
@@ -41,11 +41,13 @@
((UNIX COHERENT) '(#\/))
((VMS) '(#\: #\])))))
(lambda ()
- (let loop ((i (- (string-length *load-pathname*) 1)))
- (cond ((negative? i) "")
- ((memv (string-ref *load-pathname* i) *vicinity-suffix*)
- (substring *load-pathname* 0 (+ i 1)))
- (else (loop (- i 1))))))))
+ (if *load-pathname*
+ (let loop ((i (- (string-length *load-pathname*) 1)))
+ (cond ((negative? i) "")
+ ((memv (string-ref *load-pathname* i) *vicinity-suffix*)
+ (substring *load-pathname* 0 (+ i 1)))
+ (else (loop (- i 1)))))
+ (slib:error "Not loading but called" 'program-vicinity)))))
(define sub-vicinity
(case (software-type)
@@ -156,12 +158,13 @@
(define (require:require feature)
(or (require:provided? feature)
- (let ((path (require:feature->path feature)))
+ (let ((path (catalog:get feature)))
(cond ((and (not path) (string? feature) (file-exists? feature))
(set! path feature)))
(cond ((not feature) (set! *catalog* #f))
((not path)
(slib:error ";required feature not supported: " feature))
+ ((symbol? path) (require:require path) (require:provide feature))
((not (pair? path)) ;simple name
(slib:load path)
(and (not (eq? 'new-catalog feature)) (require:provide feature)))