mescc: Bugfix: output M1-strings if possible.

* module/mes/M1.mes (object->M1): Typo.  Also disallow \return in M1-strings.
This commit is contained in:
Jan Nieuwenhuizen 2017-07-26 23:42:18 +02:00
parent 908a4fab97
commit c52b16daf5

View file

@ -142,14 +142,14 @@
(let* ((label (if (not (and (pair? (car o)) (eq? (caar o) #:string))) (car o)
(string->label (car o))))
(data (cdr o))
(data (filter-map labelize data)))
(data (filter-map labelize data))
(len (length data))
(string-max (or (and=> (getenv "M1_STRING_MAX") string->number) 0)))
(format #t "\n:~a\n" label)
(cond ((and (char? (car data))
;; FIXME: 0 in M1 strings
(not (find (cut eq? #\nul <>) (list-head data (1- (length data)))))
;; FIXME: " in M1 strings
(not (find (cut member <> '(#\" #\' #\backspace)) data))
(eq? (last data)= #\nul))
(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))))))
(format #t "\"~a\"" (list->string (list-head data (1- (length data))))))
(else (format #t "~a" (string-join (map text->M1 data) " "))))
(newline)))