mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
friendlier report for error on module files with the wrong name (issue #624)
This commit is contained in:
parent
aa2a87fbba
commit
4734fc1e40
1 changed files with 42 additions and 10 deletions
|
@ -323,6 +323,38 @@
|
||||||
0
|
0
|
||||||
(- (string-length mod-file) 4))
|
(- (string-length mod-file) 4))
|
||||||
".scm")))
|
".scm")))
|
||||||
|
(cond
|
||||||
|
((find-module-file mod-file)
|
||||||
|
=> (lambda (path)
|
||||||
|
(let ((defined-mod-name
|
||||||
|
(protect (exn (else #f))
|
||||||
|
(let ((x (call-with-input-file path read)))
|
||||||
|
(and (pair? x)
|
||||||
|
(pair? (cdr x))
|
||||||
|
(eq? 'define-library (car x))
|
||||||
|
(cadr x))))))
|
||||||
|
(cond
|
||||||
|
((not defined-mod-name)
|
||||||
|
(display "File '" out)
|
||||||
|
(display path out)
|
||||||
|
(display "' does not appear to define module " out)
|
||||||
|
(display mod-name out)
|
||||||
|
(display ".\n" out))
|
||||||
|
((equal? defined-mod-name mod-name)
|
||||||
|
(display "File '" out)
|
||||||
|
(display path out)
|
||||||
|
(display "' failed to define module " out)
|
||||||
|
(display mod-name out)
|
||||||
|
(display ".\n" out))
|
||||||
|
(else
|
||||||
|
(display "Expected file '" out)
|
||||||
|
(display path out)
|
||||||
|
(display "' to define module " out)
|
||||||
|
(display mod-name out)
|
||||||
|
(display " but found " out)
|
||||||
|
(display defined-mod-name out)
|
||||||
|
(display ".\n" out))))))
|
||||||
|
(else
|
||||||
(display "Searched module path " out)
|
(display "Searched module path " out)
|
||||||
(display (current-module-path) out)
|
(display (current-module-path) out)
|
||||||
(display " for " out)
|
(display " for " out)
|
||||||
|
@ -333,7 +365,7 @@
|
||||||
=> (lambda (file)
|
=> (lambda (file)
|
||||||
(display "But found non-module-definition file " out)
|
(display "But found non-module-definition file " out)
|
||||||
(write file out)
|
(write file out)
|
||||||
(display ".\nNote module files must end in \".sld\".\n" out)))))
|
(display ".\nNote module files must end in \".sld\".\n" out)))))))
|
||||||
)))
|
)))
|
||||||
|
|
||||||
(define undefined-value (if #f #f))
|
(define undefined-value (if #f #f))
|
||||||
|
|
Loading…
Add table
Reference in a new issue