file/gzip: remove use of `unit200'

The unit was just there to create an instantiable local definition
context. In modern Racket, a function body does the same job.
This commit is contained in:
Matthew Flatt 2013-07-10 08:45:26 -06:00
parent 85899c7236
commit a6e25f0bae

View File

@ -16,7 +16,7 @@
(provide deflate gzip-through-ports gzip) (provide deflate gzip-through-ports gzip)
(require mzlib/unit200 (for-syntax racket/base)) (require (for-syntax racket/base))
(define (vector-ref* v i) (define (vector-ref* v i)
(let ([r (vector-ref v i)]) (let ([r (vector-ref v i)])
@ -197,11 +197,7 @@
;; multiply invoked), so we pack it up into a unit to ;; multiply invoked), so we pack it up into a unit to
;; invoke each time we need it. ;; invoke each time we need it.
(define code (define (code)
(unit
(import)
(export)
;; /* =========================================================================== ;; /* ===========================================================================
;; * Local data used by the "longest match" routines. ;; * Local data used by the "longest match" routines.
@ -2227,17 +2223,17 @@
(lambda () (close-output-port o))))) (lambda () (close-output-port o)))))
(lambda () (close-input-port i))))) (lambda () (close-input-port i)))))
(list gzip gzip-through-ports deflate))) (list gzip gzip-through-ports deflate))
(define gzip (define gzip
(case-lambda (case-lambda
[(infile) (gzip infile (string-append infile ".gz"))] [(infile) (gzip infile (string-append infile ".gz"))]
[(infile outfile) ((car (invoke-unit code)) infile outfile)])) [(infile outfile) ((car (code)) infile outfile)]))
(define (gzip-through-ports in out origname time_stamp) (define (gzip-through-ports in out origname time_stamp)
((cadr (invoke-unit code)) in out origname time_stamp)) ((cadr (code)) in out origname time_stamp))
(define (deflate in out) (define (deflate in out)
((caddr (invoke-unit code)) in out)) ((caddr (code)) in out))
) )