mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
using relative paths for include files
This commit is contained in:
parent
574b1daa32
commit
532a717ed9
6 changed files with 23 additions and 19 deletions
12
config.scm
12
config.scm
|
@ -31,6 +31,9 @@
|
||||||
(string-concatenate
|
(string-concatenate
|
||||||
(reverse (cons ".module" (cdr (module-name->strings name '()))))))
|
(reverse (cons ".module" (cdr (module-name->strings name '()))))))
|
||||||
|
|
||||||
|
(define (module-name-prefix name)
|
||||||
|
(string-concatenate (reverse (cdr (cdr (module-name->strings name '()))))))
|
||||||
|
|
||||||
(define (load-module-definition name)
|
(define (load-module-definition name)
|
||||||
(let* ((file (module-name->file name))
|
(let* ((file (module-name->file name))
|
||||||
(path (find-module-file name file)))
|
(path (find-module-file name file)))
|
||||||
|
@ -45,7 +48,8 @@
|
||||||
(else #f)))))
|
(else #f)))))
|
||||||
|
|
||||||
(define (eval-module name mod)
|
(define (eval-module name mod)
|
||||||
(let ((env (make-environment)))
|
(let ((env (make-environment))
|
||||||
|
(prefix (module-name-prefix name)))
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(case (and (pair? x) (car x))
|
(case (and (pair? x) (car x))
|
||||||
|
@ -55,9 +59,9 @@
|
||||||
((include include-shared)
|
((include include-shared)
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (f)
|
(lambda (f)
|
||||||
(let ((f (if (eq? (car x) 'include)
|
(let ((f (string-append
|
||||||
f
|
prefix f
|
||||||
(string-append f *shared-object-extension*))))
|
(if (eq? (car x) 'include) "" *shared-object-extension*))))
|
||||||
(cond
|
(cond
|
||||||
((find-module-file name f) => (lambda (x) (load x env)))
|
((find-module-file name f) => (lambda (x) (load x env)))
|
||||||
(else (error "couldn't find include" f)))))
|
(else (error "couldn't find include" f)))))
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
(define-module (chibi match)
|
(define-module (chibi match)
|
||||||
(export match match-lambda match-lambda* match-let match-letrec match-let*)
|
(export match match-lambda match-lambda* match-let match-letrec match-let*)
|
||||||
(import (scheme))
|
(import (scheme))
|
||||||
(include "chibi/match/match.scm"))
|
(include "match/match.scm"))
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
lset-intersection! lset-difference lset-difference! lset-xor lset-xor!
|
lset-intersection! lset-difference lset-difference! lset-xor lset-xor!
|
||||||
lset-diff+intersection lset-diff+intersection!)
|
lset-diff+intersection lset-diff+intersection!)
|
||||||
(import (scheme))
|
(import (scheme))
|
||||||
(include "srfi/1/predicates.scm"
|
(include "1/predicates.scm"
|
||||||
"srfi/1/selectors.scm"
|
"1/selectors.scm"
|
||||||
"srfi/1/search.scm"
|
"1/search.scm"
|
||||||
"srfi/1/misc.scm"
|
"1/misc.scm"
|
||||||
"srfi/1/constructors.scm"
|
"1/constructors.scm"
|
||||||
"srfi/1/fold.scm"
|
"1/fold.scm"
|
||||||
"srfi/1/deletion.scm"
|
"1/deletion.scm"
|
||||||
"srfi/1/alists.scm"
|
"1/alists.scm"
|
||||||
"srfi/1/lset.scm"))
|
"1/lset.scm"))
|
||||||
|
|
||||||
|
|
|
@ -91,14 +91,14 @@
|
||||||
init
|
init
|
||||||
(take-up-to-reverse (cdr from) to (cons (car from) init))))
|
(take-up-to-reverse (cdr from) to (cons (car from) init))))
|
||||||
|
|
||||||
(define (filter pred ls)
|
(define (remove pred ls)
|
||||||
(let lp ((ls ls) (rev '()))
|
(let lp ((ls ls) (rev '()))
|
||||||
(let ((tail (find-tail pred ls)))
|
(let ((tail (find-tail pred ls)))
|
||||||
(if tail
|
(if tail
|
||||||
(lp (cdr tail) (take-up-to-reverse ls tail rev))
|
(lp (cdr tail) (take-up-to-reverse ls tail rev))
|
||||||
(if (pair? rev) (append-reverse! rev ls) ls)))))
|
(if (pair? rev) (append-reverse! rev ls) ls)))))
|
||||||
|
|
||||||
(define (remove pred ls) (filter (lambda (x) (not (pred x))) ls))
|
(define (filter pred ls) (remove (lambda (x) (not (pred x))) ls))
|
||||||
|
|
||||||
(define (partition pred ls)
|
(define (partition pred ls)
|
||||||
(let lp ((ls ls) (good '()) (bad '()))
|
(let lp ((ls ls) (good '()) (bad '()))
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
hash string-hash string-ci-hash hash-by-identity)
|
hash string-hash string-ci-hash hash-by-identity)
|
||||||
(import (scheme))
|
(import (scheme))
|
||||||
(import (srfi 9))
|
(import (srfi 9))
|
||||||
(include-shared "srfi/69/hash")
|
(include-shared "69/hash")
|
||||||
(include "srfi/69/type.scm" "srfi/69/interface.scm"))
|
(include "69/type.scm" "69/interface.scm"))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(define-module (srfi 98)
|
(define-module (srfi 98)
|
||||||
(export get-environment-variable get-environment-variables)
|
(export get-environment-variable get-environment-variables)
|
||||||
(include-shared "srfi/98/env"))
|
(include-shared "98/env"))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue