From c52b16daf5d26f246500c4903b85ba7b22bf5f60 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 26 Jul 2017 23:42:18 +0200 Subject: [PATCH] mescc: Bugfix: output M1-strings if possible. * module/mes/M1.mes (object->M1): Typo. Also disallow \return in M1-strings. --- module/mes/M1.mes | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/module/mes/M1.mes b/module/mes/M1.mes index 470a1838..0740e2aa 100644 --- a/module/mes/M1.mes +++ b/module/mes/M1.mes @@ -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))) -- 2.31.1