Encode boot image as integers instead of string

Hex escapes caused another mysterious character encoding problem with Minix
clang.
This commit is contained in:
Lassi Kortela 2019-10-14 14:30:24 +03:00
parent ad4ef08080
commit 43515226f4
2 changed files with 6251 additions and 3128 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
(define (dump-buffers-as-c-literal . bufs) (define (dump-buffers-as-c-literal . bufs)
(display "unsigned char boot_image[] = \"") (display "unsigned char boot_image[] = {")
(let loop-bufs ((bufs bufs)) (let loop-bufs ((bufs bufs))
(if (not (null? bufs)) (if (not (null? bufs))
(begin (let ((buf (car bufs))) (begin (let ((buf (car bufs)))
@ -7,10 +7,11 @@
(let ((char (read-u8 buf))) (let ((char (read-u8 buf)))
(if (not (io.eof? buf)) (if (not (io.eof? buf))
(let ((code (+ char 0))) (let ((code (+ char 0)))
(if (= 0 (mod i 16)) (display "\"\n\"")) (if (= 0 (mod i 8)) (display "\n"))
(display "\\x") (display "0x")
(if (< code #x10) (display "0")) (if (< code #x10) (display "0"))
(display (number->string code 16)) (display (number->string code 16))
(display ",")
(loop-buf-bytes (+ i 1))))))) (loop-buf-bytes (+ i 1)))))))
(loop-bufs (cdr bufs))))) (loop-bufs (cdr bufs)))))
(display "\";\n")) (display "};\n"))