close the input after reading
svn: r12775
This commit is contained in:
parent
251d15f800
commit
baffbeeeb2
|
@ -317,23 +317,25 @@
|
||||||
;; (path/string/bytes) value.
|
;; (path/string/bytes) value.
|
||||||
(define (input->code inps source n)
|
(define (input->code inps source n)
|
||||||
(if (null? inps)
|
(if (null? inps)
|
||||||
'()
|
'()
|
||||||
(let ([p (input->port (car inps))])
|
(let ([p (input->port (car inps))])
|
||||||
(cond [(and p (null? (cdr inps)))
|
(cond [(and p (null? (cdr inps)))
|
||||||
(port-count-lines! p)
|
(port-count-lines! p)
|
||||||
(parameterize ([current-input-port p])
|
(parameterize ([current-input-port p])
|
||||||
((sandbox-reader) source))]
|
((sandbox-reader) source)
|
||||||
[p (error 'input->code "ambiguous inputs: ~e" inps)]
|
;; close a port if we opened it
|
||||||
[else (let loop ([inps inps] [n n] [r '()])
|
(unless (eq? p (car inps)) (close-input-port p)))]
|
||||||
(if (null? inps)
|
[p (error 'input->code "ambiguous inputs: ~e" inps)]
|
||||||
(reverse r)
|
[else (let loop ([inps inps] [n n] [r '()])
|
||||||
(loop (cdr inps) (and n (add1 n))
|
(if (null? inps)
|
||||||
;; 1st at line#1, pos#1, 2nd at line#2, pos#2 etc
|
(reverse r)
|
||||||
;; (starting from the `n' argument)
|
(loop (cdr inps) (and n (add1 n))
|
||||||
(cons (datum->syntax
|
;; 1st at line#1, pos#1, 2nd at line#2, pos#2 etc
|
||||||
#f (car inps)
|
;; (starting from the `n' argument)
|
||||||
(list source n (and n 0) n (and n 1)))
|
(cons (datum->syntax
|
||||||
r))))]))))
|
#f (car inps)
|
||||||
|
(list source n (and n 0) n (and n 1)))
|
||||||
|
r))))]))))
|
||||||
|
|
||||||
(define ((init-for-language language))
|
(define ((init-for-language language))
|
||||||
(cond [(or (not (pair? language))
|
(cond [(or (not (pair? language))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user