mescc.mes: Use write for preprocessing output.
* scripts/mescc.mes (source->ast): Use core:write instead of pretty-print.
This commit is contained in:
parent
81404179c1
commit
c096a81cb5
|
@ -1,7 +1,7 @@
|
||||||
;;; -*-scheme-*-
|
;;; -*-scheme-*-
|
||||||
|
|
||||||
;;; Mes --- Maxwell Equations of Software
|
;;; Mes --- Maxwell Equations of Software
|
||||||
;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2017,2018 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of Mes.
|
;;; This file is part of Mes.
|
||||||
;;;
|
;;;
|
||||||
|
@ -150,14 +150,14 @@
|
||||||
(data (filter-map labelize data))
|
(data (filter-map labelize data))
|
||||||
(len (length data))
|
(len (length data))
|
||||||
(string-max (or (and=> (getenv "M1_STRING_MAX") string->number) 80)))
|
(string-max (or (and=> (getenv "M1_STRING_MAX") string->number) 80)))
|
||||||
(format #t "\n:~a\n" label)
|
(display (string-append "\n:" label "\n"))
|
||||||
(cond ((and (< len string-max)
|
(cond ((and (< len string-max)
|
||||||
(char? (car data))
|
(char? (car data))
|
||||||
(eq? (last data) #\nul)
|
(eq? (last data) #\nul)
|
||||||
(not (find (cut memq <> '(#\nul #\backspace #\return #\" #\')) (list-head data (1- (length data)))))
|
(not (find (cut memq <> '(#\nul #\backspace #\return #\" #\')) (list-head data (1- (length data)))))
|
||||||
(not (any (lambda (ch) (>= (char->integer ch) #x80)) data)))
|
(not (any (lambda (ch) (>= (char->integer ch) #x80)) data)))
|
||||||
(format #t "\"~a\"" (list->string (list-head data (1- (length data))))))
|
(display (string-append "\"" (list->string (list-head data (1- (length data)))) "\"")))
|
||||||
(else (format #t "~a" (string-join (map text->M1 data) " "))))
|
(else (display (string-join (map text->M1 data) " "))))
|
||||||
(newline)))
|
(newline)))
|
||||||
(for-each write-function (filter cdr functions))
|
(for-each write-function (filter cdr functions))
|
||||||
(when (assoc-ref functions "main")
|
(when (assoc-ref functions "main")
|
||||||
|
|
|
@ -19,7 +19,7 @@ exit $?
|
||||||
!#
|
!#
|
||||||
|
|
||||||
;;; Mes --- Maxwell Equations of Software
|
;;; Mes --- Maxwell Equations of Software
|
||||||
;;; Copyright © 2016,2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2016,2017,2018 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of Mes.
|
;;; This file is part of Mes.
|
||||||
;;;
|
;;;
|
||||||
|
@ -51,6 +51,7 @@ exit $?
|
||||||
(mes-use-module (mes pretty-print))
|
(mes-use-module (mes pretty-print))
|
||||||
(mes-use-module (language c99 info))
|
(mes-use-module (language c99 info))
|
||||||
(mes-use-module (language c99 compiler))
|
(mes-use-module (language c99 compiler))
|
||||||
|
(mes-use-module (mes display))
|
||||||
(mes-use-module (mes elf))
|
(mes-use-module (mes elf))
|
||||||
(mes-use-module (mes M1))
|
(mes-use-module (mes M1))
|
||||||
(mes-use-module (srfi srfi-1))
|
(mes-use-module (srfi srfi-1))
|
||||||
|
@ -108,7 +109,7 @@ Usage: mescc.mes [OPTION]... FILE...
|
||||||
(lambda (file)
|
(lambda (file)
|
||||||
(with-input-from-file file
|
(with-input-from-file file
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(pretty-print (c99-input->ast #:defines defines #:includes includes))))))
|
(write (c99-input->ast #:defines defines #:includes includes))))))
|
||||||
|
|
||||||
(define (source->info defines includes)
|
(define (source->info defines includes)
|
||||||
(lambda (file)
|
(lambda (file)
|
||||||
|
|
Loading…
Reference in a new issue