From eaae5d5245b5d2672e7d7201be533f4a14e8449d Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Wed, 27 Jun 2012 22:34:38 +0200 Subject: [PATCH] The inline expansion of PRINC might contain escape characters that were improperly caught by c-inline itself --- src/cmp/cmpffi.lsp | 11 +++++++++++ src/cmp/cmpopt-printer.lsp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cmp/cmpffi.lsp b/src/cmp/cmpffi.lsp index f2ec5e785..bac6c7c7d 100755 --- a/src/cmp/cmpffi.lsp +++ b/src/cmp/cmpffi.lsp @@ -661,3 +661,14 @@ (cmperr "C-INLINE: Variable code exceeds number of arguments"))))) (otherwise (write-char c *compiler-output1*)))))) + +(defun c-inline-safe-string (constant-string) + ;; Produce a text representation of a string that can be used + ;; in a C-INLINE form, without triggering the @ or # escape + ;; characters + (c-filtered-string + (concatenate 'string + (loop for c across constant-string + when (member c '(#\# #\@)) + collect c + collect c)))) diff --git a/src/cmp/cmpopt-printer.lsp b/src/cmp/cmpopt-printer.lsp index 216199c08..5fe86f673 100644 --- a/src/cmp/cmpopt-printer.lsp +++ b/src/cmp/cmpopt-printer.lsp @@ -50,7 +50,7 @@ (ffi:c-inline ,(list stream) (:object) :void ,(concatenate 'string "ecl_princ_str(" - (c-filtered-string value) + (c-inline-safe-string value) ",#0)") :one-liner t) ,value))