2019-08-13 17:44:24 -04:00
|
|
|
(define (dump-buffers-as-c-literal . bufs)
|
2019-08-25 15:07:38 -04:00
|
|
|
(xdisplay "char boot_image[] = \"")
|
2019-08-13 17:44:24 -04:00
|
|
|
(let loop-bufs ((bufs bufs))
|
|
|
|
(if (not (null? bufs))
|
|
|
|
(begin (let ((buf (car bufs)))
|
|
|
|
(let loop-buf-bytes ((i 0))
|
|
|
|
(let ((char (read-u8 buf)))
|
|
|
|
(if (not (io.eof? buf))
|
|
|
|
(let ((code (+ char 0)))
|
2019-08-25 15:07:38 -04:00
|
|
|
(if (= 0 (mod i 16)) (xdisplay "\"\n\""))
|
|
|
|
(xdisplay "\\x")
|
|
|
|
(if (< code #x10) (xdisplay "0"))
|
|
|
|
(xdisplay (number->string code 16))
|
2019-08-13 17:44:24 -04:00
|
|
|
(loop-buf-bytes (+ i 1)))))))
|
|
|
|
(loop-bufs (cdr bufs)))))
|
2019-08-25 15:07:38 -04:00
|
|
|
(xdisplay "\";\n"))
|