mescc.mes: Use write for preprocessing output.

* scripts/mescc.mes (source->ast): Use core:write instead of pretty-print.
This commit is contained in:
Jan Nieuwenhuizen 2018-01-01 21:13:46 +01:00
parent 81404179c1
commit c096a81cb5
2 changed files with 7 additions and 6 deletions

View File

@ -1,7 +1,7 @@
;;; -*-scheme-*-
;;; 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.
;;;
@ -150,14 +150,14 @@
(data (filter-map labelize data))
(len (length data))
(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)
(char? (car data))
(eq? (last data) #\nul)
(not (find (cut memq <> '(#\nul #\backspace #\return #\" #\')) (list-head data (1- (length data)))))
(not (any (lambda (ch) (>= (char->integer ch) #x80)) data)))
(format #t "\"~a\"" (list->string (list-head data (1- (length data))))))
(else (format #t "~a" (string-join (map text->M1 data) " "))))
(display (string-append "\"" (list->string (list-head data (1- (length data)))) "\"")))
(else (display (string-join (map text->M1 data) " "))))
(newline)))
(for-each write-function (filter cdr functions))
(when (assoc-ref functions "main")

View File

@ -19,7 +19,7 @@ exit $?
!#
;;; 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.
;;;
@ -51,6 +51,7 @@ exit $?
(mes-use-module (mes pretty-print))
(mes-use-module (language c99 info))
(mes-use-module (language c99 compiler))
(mes-use-module (mes display))
(mes-use-module (mes elf))
(mes-use-module (mes M1))
(mes-use-module (srfi srfi-1))
@ -108,7 +109,7 @@ Usage: mescc.mes [OPTION]... FILE...
(lambda (file)
(with-input-from-file file
(lambda ()
(pretty-print (c99-input->ast #:defines defines #:includes includes))))))
(write (c99-input->ast #:defines defines #:includes includes))))))
(define (source->info defines includes)
(lambda (file)