Commit | Line | Data |
---|---|---|
9d198c1b MV |
1 | (use-modules (ice-9 syncase)) |
2 | ||
3 | ;; XXX - We need to be inside (ice-9 syncase) since psyntax.ss calls | |
4 | ;; `eval' int he `interaction-environment' aka the current module and | |
5 | ;; it expects to have `andmap' there. The reason for this escapes me | |
6 | ;; at the moment. | |
7 | ;; | |
8 | (define-module (ice-9 syncase)) | |
9 | ||
10 | (define source (list-ref (command-line) 1)) | |
11 | (define target (list-ref (command-line) 2)) | |
12 | ||
13 | (let ((in (open-input-file source)) | |
14 | (out (open-output-file (string-append target ".tmp")))) | |
15 | (let loop ((x (read in))) | |
16 | (if (eof-object? x) | |
17 | (begin | |
18 | (close-port out) | |
19 | (close-port in)) | |
20 | (begin | |
21 | (write (sc-expand3 x 'c '(compile load eval)) out) | |
22 | (newline out) | |
23 | (loop (read in)))))) | |
24 | ||
25 | (system (format #f "mv -f ~s.tmp ~s" target target)) |