mescc: Align global data.

* module/mes/M1.mes (object->M1): Align globals.
This commit is contained in:
Jan Nieuwenhuizen 2018-05-21 21:54:54 +02:00
parent 948fbf9743
commit 029c000840
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -171,6 +171,11 @@
(cond ((and (pair? o) (global? (cdr o))) (string-append "&" (global->string o))) (cond ((and (pair? o) (global? (cdr o))) (string-append "&" (global->string o)))
((and (not string?) (not function?)) (stderr "warning: unresolved label: ~s\n" label)) ((and (not string?) (not function?)) (stderr "warning: unresolved label: ~s\n" label))
(else (string-append "&" label)))))) (else (string-append "&" label))))))
(define (display-align size)
(let ((alignment (- 4 (modulo size 4))))
(when (> alignment 0)
(display " ")
(display-join (map text->M1 (map (const 0) (iota alignment))) " "))))
(let* ((label (cond (let* ((label (cond
((and (pair? (car o)) (eq? (caar o) #:string)) ((and (pair? (car o)) (eq? (caar o) #:string))
(string->label (car o))) (string->label (car o)))
@ -194,8 +199,12 @@
(or (and (not (memq ch '(#\tab #\newline))) (or (and (not (memq ch '(#\tab #\newline)))
(< (char->integer ch) #x20)) (< (char->integer ch) #x20))
(>= (char->integer ch) #x80))) string-data))) (>= (char->integer ch) #x80))) string-data)))
(display (string-append "\"" (list->string string-data) "\"")) (let ((text string-data))
(display-join (map text->M1 data) " ")) (display (string-append "\"" (list->string string-data) "\""))
(display-align (1+ (length string-data))))
(let ((text (map text->M1 data)))
(display-join text " ")
(display-align (length text))))
(newline))) (newline)))
(display "M1: functions\n" (current-error-port)) (display "M1: functions\n" (current-error-port))
(for-each write-function (filter cdr functions)) (for-each write-function (filter cdr functions))