2019-08-13 17:44:24 -04:00
|
|
|
(define (dump-buffers-as-c-literal . bufs)
|
2019-10-13 20:19:45 -04:00
|
|
|
(display "unsigned 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:57:31 -04:00
|
|
|
(if (= 0 (mod i 16)) (display "\"\n\""))
|
|
|
|
(display "\\x")
|
|
|
|
(if (< code #x10) (display "0"))
|
|
|
|
(display (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:57:31 -04:00
|
|
|
(display "\";\n"))
|