fix cm to configure reader when reading .dep files

Merge to 5.1.2
(cherry picked from commit 7af5d490ad)
This commit is contained in:
Matthew Flatt 2011-07-16 19:27:11 -06:00 committed by Eli Barzilay
parent 34b3045b9b
commit 9e3ee9e2f8
3 changed files with 36 additions and 27 deletions

View File

@ -7,7 +7,8 @@
scheme/list
scheme/path
racket/promise
openssl/sha1)
openssl/sha1
syntax/private/modread)
(provide make-compilation-manager-load/use-compiled-handler
managed-compile-zo
@ -465,11 +466,13 @@
-inf.0))
(define (try-file-sha1 path dep-path)
(with-handlers ([exn:fail:filesystem? (lambda (exn) #f)])
(string-append
(call-with-input-file* path sha1)
(with-handlers ([exn:fail:filesystem? (lambda (exn) "")])
(call-with-input-file* dep-path (lambda (p) (cdadr (read p))))))))
(with-module-reading-parameterization
(lambda ()
(with-handlers ([exn:fail:filesystem? (lambda (exn) #f)])
(string-append
(call-with-input-file* path sha1)
(with-handlers ([exn:fail:filesystem? (lambda (exn) "")])
(call-with-input-file* dep-path (lambda (p) (cdadr (read p))))))))))
(define (get-compiled-sha1 mode path)
(define-values (dir name) (get-compilation-dir+name mode path))
@ -492,9 +495,11 @@
(define orig-path (simple-form-path path0))
(define (read-deps path)
(with-handlers ([exn:fail:filesystem? (lambda (ex) (list (version) '#f))])
(call-with-input-file
(path-add-suffix (get-compilation-path mode path) #".dep")
read)))
(with-module-reading-parameterization
(lambda ()
(call-with-input-file
(path-add-suffix (get-compilation-path mode path) #".dep")
read)))))
(define (do-check)
(let* ([main-path orig-path]
[alt-path (rkt->ss orig-path)]

View File

@ -1,27 +1,11 @@
(module modread mzscheme
(require racket/contract)
(require racket/contract
"private/modread.rkt")
(provide with-module-reading-parameterization)
(provide/contract
[check-module-form ((or/c syntax? eof-object?) symbol? (or/c string? path? false/c) . -> . any)])
(define (with-module-reading-parameterization thunk)
(parameterize ([read-case-sensitive #t]
[read-square-bracket-as-paren #t]
[read-curly-brace-as-paren #t]
[read-accept-box #t]
[read-accept-compiled #t]
[read-accept-bar-quote #t]
[read-accept-graph #t]
[read-decimal-as-inexact #t]
[read-accept-dot #t]
[read-accept-infix-dot #t]
[read-accept-quasiquote #t]
[read-accept-reader #t]
[read-accept-lang #t]
[current-readtable #f])
(thunk)))
(define (raise-wrong-module-name filename expected-name name)
(error 'load-handler
"expected a `module' declaration for `~a' in ~s, found: ~a"

View File

@ -0,0 +1,20 @@
#lang racket/base
(provide with-module-reading-parameterization)
(define (with-module-reading-parameterization thunk)
(parameterize ([read-case-sensitive #t]
[read-square-bracket-as-paren #t]
[read-curly-brace-as-paren #t]
[read-accept-box #t]
[read-accept-compiled #t]
[read-accept-bar-quote #t]
[read-accept-graph #t]
[read-decimal-as-inexact #t]
[read-accept-dot #t]
[read-accept-infix-dot #t]
[read-accept-quasiquote #t]
[read-accept-reader #t]
[read-accept-lang #t]
[current-readtable #f])
(thunk)))