Avoid trailing comma in boot image array

Minix clang doesn't like that either.
This commit is contained in:
Lassi Kortela 2019-10-14 14:39:39 +03:00
parent 43515226f4
commit c33ba84796
2 changed files with 3378 additions and 3375 deletions

File diff suppressed because it is too large Load Diff

View File

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