summaryrefslogtreecommitdiffstats
path: root/requires.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:25 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:25 -0800
commit3278b75942bdbe706f7a0fba87729bb1e935b68b (patch)
treedcad4048dfc0b38367047426b2b14501bf5ff257 /requires.scm
parentdb04688faa20f3576257c0fe41752ec435beab9a (diff)
downloadscm-3278b75942bdbe706f7a0fba87729bb1e935b68b.tar.gz
scm-3278b75942bdbe706f7a0fba87729bb1e935b68b.zip
Import Upstream version 5d2upstream/5d2
Diffstat (limited to 'requires.scm')
-rw-r--r--requires.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/requires.scm b/requires.scm
new file mode 100644
index 0000000..bd4b8bf
--- /dev/null
+++ b/requires.scm
@@ -0,0 +1,22 @@
+;;; "require.scm" Trampoline to slib/require.scm
+
+(set! library-vicinity
+ (let* ((vl (case (software-type)
+ ((AMIGA) '(#\: #\/))
+ ((MS-DOS WINDOWS ATARIST OS/2) '(#\\ #\/))
+ ((MACOS THINKC) '(#\:))
+ ((NOSVE) '(#\: #\.))
+ ((UNIX COHERENT) '(#\/))
+ ((VMS) '(#\: #\]))))
+ (iv (implementation-vicinity))
+ (vc (and (positive? (string-length iv))
+ (string-ref iv (+ -1 (string-length iv)))))
+ (vs (if (memv vc vl) (string vc) "/"))
+ (lv (let loop ((pos (+ -2 (string-length iv))))
+ (cond ((or (< pos 0) (not vs))
+ (string-append iv ".." vs "slib" vs))
+ ((memv (string-ref iv pos) vl)
+ (string-append (substring iv 0 (+ 1 pos)) "slib" vs))
+ (else (loop (- pos 1)))))))
+ (lambda () lv)))
+(load (in-vicinity (library-vicinity) "require"))