ref: e12d463972ec7d574d7a49bd2edf5263e397ae4f
parent: 2246154471d949bb19992a52bcd334b8f81dc5bf
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Dec 30 11:50:33 EST 2024
gen.lsp: reformat a bit
--- a/gen.lsp
+++ b/gen.lsp
@@ -100,8 +100,9 @@
))
(define (for-each-n f lst n)
- (when (and (> n 0) (cons? lst)) (begin (apply f (list-head lst n))
- (for-each-n f (list-tail lst n) n))))
+ (when (and (> n 0) (cons? lst))
+ (apply f (list-head lst n))
+ (for-each-n f (list-tail lst n) n)))
(let ((c-header (file "opcodes.h" :write :create :truncate))
(c-code (file "opcodes.c" :write :create :truncate))
@@ -115,7 +116,6 @@
(i 0))
(begin
(io-write c-header "typedef enum {\n")
-
(for-each-n
(λ (cop lop argc f docs)
(begin
@@ -132,7 +132,8 @@
(put! e lop i)
(when argc
(put! cl cop (list lop argc))
- (when (and (number? argc) (>= argc 0)) (put! ac lop argc)))
+ (when (and (number? argc) (>= argc 0))
+ (put! ac lop argc)))
(set! lms (cons f lms))
(set! i (1+ i))))
opcodes 5)
@@ -157,7 +158,9 @@
(write `(define Instructions ,e) instructions)
(io-write instructions "\n\n")
(write `(define arg-counts ,ac) instructions)
+ (io-write instructions "\n")
(io-close instructions)
(set! lms (cons vector (reverse! lms)))
- (write `(define *builtins* "VM instructions as closures.",lms) builtins)
+ (write `(define *builtins* "VM instructions as closures." ,lms) builtins)
+ (io-write builtins "\n")
(io-close builtins)))