Issue #465 - Avoid trigraphs in compiled strings

This commit is contained in:
Justin Ethier 2021-07-15 16:45:42 -04:00
parent 867b60bb14
commit 92aeec6a2e
2 changed files with 3 additions and 0 deletions

View file

@ -6,6 +6,7 @@ Bug Fixes
- Fix `read-line` to prevent data loss when used in conjunction with other I/O functions (such as `read-char`) to read from the same port. Previous versions of `read-line` would use a different internal buffer than our other I/O functions. - Fix `read-line` to prevent data loss when used in conjunction with other I/O functions (such as `read-char`) to read from the same port. Previous versions of `read-line` would use a different internal buffer than our other I/O functions.
- Properly handle literal vectors at the top level of compiled code. - Properly handle literal vectors at the top level of compiled code.
- Properly escape C strings in compiled code to avoid trigraphs.
## 0.30.0 - July 2, 2021 ## 0.30.0 - July 2, 2021

View file

@ -69,6 +69,8 @@
(letrec ((next (lambda (head tail) (letrec ((next (lambda (head tail)
(cond (cond
((null? head) (list->string (reverse tail))) ((null? head) (list->string (reverse tail)))
((equal? (car head) #\?) ;; Escape ? to avoid trigraphs
(next (cdr head) (cons #\? (cons #\\ tail))))
((equal? (car head) #\") ((equal? (car head) #\")
(next (cdr head) (cons #\" (cons #\\ tail)))) (next (cdr head) (cons #\" (cons #\\ tail))))
((equal? (car head) #\\) ((equal? (car head) #\\)