generate temp .c files instead of passing to compiler's stdin
All checks were successful
Sex CI / build-linux (pull_request) Successful in 4m44s
All checks were successful
Sex CI / build-linux (pull_request) Successful in 4m44s
For a clearer architecture
This commit is contained in:
27
sexc.scm
27
sexc.scm
@@ -123,20 +123,21 @@
|
|||||||
(out-file (if (eq? output 'default)
|
(out-file (if (eq? output 'default)
|
||||||
"a.out"
|
"a.out"
|
||||||
output)))
|
output)))
|
||||||
;; `process' hands back one record. Its port accessors are named
|
;; The generated C goes to a temporary .c file rather than the
|
||||||
;; from the *child's* point of view, so `process-input-port' is the
|
;; compiler's stdin
|
||||||
;; port we write to: the C compiler's stdin.
|
(let ((c-file (create-temporary-file "c")))
|
||||||
(let* ((proc (process compiler (append (list "-o" out-file "-x" "c")
|
(with-output-to-file c-file
|
||||||
(if (get-arg args 'compile-object #f)
|
|
||||||
(list "-c")
|
|
||||||
(list))
|
|
||||||
(list "-") ; read stdin
|
|
||||||
cc-args)))
|
|
||||||
(cc-stdin (process-input-port proc)))
|
|
||||||
(with-output-to-port cc-stdin
|
|
||||||
(lambda () (emit-c sex-forms)))
|
(lambda () (emit-c sex-forms)))
|
||||||
(close-output-port cc-stdin)
|
(let ((proc (process compiler (append (list "-o" out-file)
|
||||||
(process-wait proc))))
|
(if (get-arg args 'compile-object #f)
|
||||||
|
(list "-c")
|
||||||
|
(list))
|
||||||
|
(list c-file)
|
||||||
|
cc-args))))
|
||||||
|
(call-with-values (lambda () (process-wait proc))
|
||||||
|
(lambda status
|
||||||
|
(delete-file* c-file)
|
||||||
|
(apply values status)))))))
|
||||||
|
|
||||||
(define (semantic-process-forms raw-forms input-source)
|
(define (semantic-process-forms raw-forms input-source)
|
||||||
(if (eq? input-source 'stdin)
|
(if (eq? input-source 'stdin)
|
||||||
|
|||||||
Reference in New Issue
Block a user