strip #! from start of programs
svn: r1376
This commit is contained in:
parent
3e53a3fd05
commit
c0476d4add
|
@ -63,6 +63,7 @@
|
|||
(require (lib "unitsig.ss")
|
||||
(lib "list.ss")
|
||||
(lib "file.ss")
|
||||
(lib "port.ss")
|
||||
(lib "etc.ss")
|
||||
(lib "pretty.ss")
|
||||
(prefix src2src: "../src2src.ss"))
|
||||
|
@ -440,11 +441,7 @@
|
|||
path))
|
||||
p)))])
|
||||
;; Skip leading "#!:
|
||||
(let loop ([s (regexp-match-peek #rx"^#![^\r\n]*" p)])
|
||||
(when s
|
||||
(read-line p)
|
||||
(when (regexp-match #rx"\\\\$" (car s))
|
||||
(loop (regexp-match-peek #rx"^[^\r\n]*" p)))))
|
||||
(strip-shell-command-start p)
|
||||
p))
|
||||
|
||||
;;-------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
(module compile mzscheme
|
||||
(require "file.ss")
|
||||
(require "file.ss"
|
||||
"port.ss")
|
||||
(provide compile-file)
|
||||
|
||||
;; (require (lib "src2src.ss" "compiler"))
|
||||
|
@ -23,7 +24,8 @@
|
|||
(dynamic-wind
|
||||
void
|
||||
(lambda ()
|
||||
(port-count-lines! (current-input-port))
|
||||
(port-count-lines! in)
|
||||
(strip-shell-command-start in)
|
||||
(with-handlers ([void
|
||||
(lambda (exn)
|
||||
(with-handlers ([void void])
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
convert-stream
|
||||
make-limited-input-port
|
||||
reencode-input-port
|
||||
reencode-output-port)
|
||||
reencode-output-port
|
||||
strip-shell-command-start)
|
||||
|
||||
(define (exact-non-negative-integer? i)
|
||||
(and (number? i) (exact? i) (integer? i) (i . >= . 0)))
|
||||
|
@ -77,6 +78,14 @@
|
|||
|
||||
;; ----------------------------------------
|
||||
|
||||
(define (strip-shell-command-start in)
|
||||
(when (regexp-match-peek #rx#"^#![^\r\n]*" in)
|
||||
(let loop ([s (read-line in)])
|
||||
(when (regexp-match #rx#"\\\\$" s)
|
||||
(loop (read-line in))))))
|
||||
|
||||
;; ----------------------------------------
|
||||
|
||||
(define (copy-port src dest . dests)
|
||||
(unless (input-port? src)
|
||||
(raise-type-error 'copy-port "input-port" src))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
(module moddep mzscheme
|
||||
(require (lib "etc.ss")
|
||||
(lib "port.ss")
|
||||
(lib "resolver.ss" "planet"))
|
||||
|
||||
|
||||
|
@ -95,7 +96,9 @@
|
|||
|
||||
(define (read-one path src?)
|
||||
(let ([p ((moddep-current-open-input-file) path)])
|
||||
(when src? (port-count-lines! p))
|
||||
(when src?
|
||||
(port-count-lines! p)
|
||||
(strip-shell-command-start p))
|
||||
(dynamic-wind
|
||||
void
|
||||
(lambda ()
|
||||
|
|
Loading…
Reference in New Issue
Block a user