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))