>From 46c86a4ab16e9654d05f1a5957f917015c72cbde Mon Sep 17 00:00:00 2001 From: Evan Hanson Date: Sat, 9 Jun 2018 08:58:20 +1200 Subject: [PATCH 5/6] Drop `##sys#canonicalize-extension-path' This procedure is only ever called with extension names, not actual pathnames, so the file path normalisation can be removed and replaced with a simple "foo->string" procedure whereever necessary. --- chicken-install.scm | 7 +++---- eval.scm | 37 +++---------------------------------- modules.scm | 4 +--- 3 files changed, 7 insertions(+), 41 deletions(-) diff --git a/chicken-install.scm b/chicken-install.scm index 9fa22aec..82f1939a 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -701,10 +701,9 @@ (define (ext-version x) (cond ((or (eq? x 'chicken) (equal? x "chicken")) (chicken-version)) - ((let* ((ep (##sys#canonicalize-extension-path x 'ext-version)) - (sf (chicken.load#find-file - (make-pathname #f ep +egg-info-extension+) - (repo-path)))) + ((let ((sf (chicken.load#find-file + (make-pathname #f (->string x) +egg-info-extension+) + (repo-path)))) (and sf (file-exists? sf) (load-egg-info sf))) => diff --git a/eval.scm b/eval.scm index b33cfd8c..8453940c 100644 --- a/eval.scm +++ b/eval.scm @@ -1166,36 +1166,6 @@ ;;; Extensions: -(define ##sys#canonicalize-extension-path - (let ([string-append string-append]) - (lambda (id loc) - (define (err) (##sys#error loc "invalid extension path" id)) - (define (sep? c) (or (char=? #\\ c) (char=? #\/ c))) - (let ([p (cond [(string? id) id] - [(symbol? id) (##sys#symbol->string id)] - [(list? id) - (let loop ([id id]) - (if (null? id) - "" - (string-append - (let ([id0 (##sys#slot id 0)]) - (cond [(symbol? id0) (##sys#symbol->string id0)] - [(string? id0) id0] - [else (err)] ) ) - (if (null? (##sys#slot id 1)) - "" - "/") - (loop (##sys#slot id 1)) ) ) ) ] ) ] ) - (let check ([p p]) - (let ([n (##sys#size p)]) - (cond [(fx= 0 n) (err)] - [(sep? (string-ref p 0)) - (check (##sys#substring p 1 n)) ] - [(sep? (string-ref p (fx- n 1))) - (check (##sys#substring p 0 (fx- n 1))) ] - [else p] ) ) ) ) ) ) ) - - (define ##sys#setup-mode #f) (define path-list-separator @@ -1235,11 +1205,10 @@ (define find-dynamic-extension (let ((string-append string-append)) - (lambda (path inc?) - (let ((p (##sys#canonicalize-extension-path path #f)) - (rp (repository-path))) + (lambda (id inc?) + (let ((rp (repository-path))) (define (check path) - (let ((p0 (string-append path "/" p))) + (let ((p0 (string-append path "/" (symbol->string id)))) (or (and rp (not ##sys#dload-disabled) (feature? #:dload) diff --git a/modules.scm b/modules.scm index 06c6e1dd..fe3cc352 100644 --- a/modules.scm +++ b/modules.scm @@ -565,9 +565,7 @@ ;;; Import-expansion (define (##sys#import-library-hook mname) - (and-let* ((il (chicken.load#find-dynamic-extension - (string-append (symbol->string mname) ".import") - #t))) + (and-let* ((il (chicken.load#find-dynamic-extension (symbol-append mname '.import) #t))) (parameterize ((##sys#current-module #f) (##sys#current-environment '()) (##sys#current-meta-environment -- 2.11.0