From ab93ce688136fa63dedee12b2eb7fa45c4c84b26 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 5 Dec 2015 14:43:01 +0100 Subject: [PATCH] Fix "slashify" C string escaping mechanism. If you have backslashes in procedure names, they would incorrectly be converted to slashes in the call trace. The "slashify" procedure is only used in one place, and only for injecting strings to C, which means it's easy to fix. --- c-backend.scm | 2 +- compiler-namespace.scm | 2 +- support.scm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/c-backend.scm b/c-backend.scm index 7374783..fffae6c 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -236,7 +236,7 @@ (fn (car subs)) ) (when name (if emit-trace-info - (gen #t "C_trace(\"" (slashify name-str) "\");") + (gen #t "C_trace(\"" (backslashify name-str) "\");") (gen #t "/* " (uncommentify name-str) " */") ) ) (cond ((eq? '##core#proc (node-class fn)) (gen #\{) diff --git a/compiler-namespace.scm b/compiler-namespace.scm index dea9e4b..1bbbcdf 100644 --- a/compiler-namespace.scm +++ b/compiler-namespace.scm @@ -265,7 +265,7 @@ simplified-ops simplify-named-call simplify-type - slashify + backslashify sort-symbols source-filename source-info->string diff --git a/support.scm b/support.scm index df30681..1c48782 100644 --- a/support.scm +++ b/support.scm @@ -168,7 +168,7 @@ ((string? x) (string->symbol x)) (else (string->symbol (sprintf "~a" x))) ) ) -(define (slashify s) (string-translate (->string s) "\\" "/")) +(define (backslashify s) (string-translate (->string s) "\\" "\\\\")) (define (uncommentify s) (string-translate* (->string s) '(("*/" . "*_/")))) -- 2.1.4