From afccaf3bd97666ac76b77e34655b4869e88c0d9f Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 5 Dec 2015 14:52:02 +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. Conflicts: compiler-namespace.scm support.scm --- c-backend.scm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/c-backend.scm b/c-backend.scm index b1dff0c..025e74b 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -65,8 +65,7 @@ (intersperse lst #\space) ) ) ;; Hacky procedures to make certain names more suitable for use in C. -;; TODO: Slashify should probably be changed to convert \ into \\? -(define (slashify s) (string-translate (->string s) "\\" "/")) +(define (backslashify s) (string-translate (->string s) "\\" "\\\\")) (define (uncommentify s) (string-translate* (->string s) '(("*/" . "*_/")))) ;;; Generate target code: @@ -248,7 +247,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 #\{) -- 2.1.4