shithub: fnt

Download patch

ref: a395ad1f4340998f1e0aa06ecf4f1c3f91ffbe81
parent: ae37b94f3dc7decd0f6f16cc9a475b5e26627c1e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue May 28 07:22:15 EDT 2024

clean up more

--- a/otf.rkt
+++ b/otf.rkt
@@ -7,13 +7,9 @@
 (define types '())
 (define cmplxs '())
 
-(define (indent x lst)
-  (define ind (make-string x #\tab))
-  (map (λ (str) (string-append ind str)) lst))
+(define (indent lst)
+  (map (λ (str) (string-append "\t" str)) lst))
 
-(define (format-lines lst)
-  (string-join (append lst '("")) "\n"))
-
 (define-generics code (gen-h code) (gen-c code) (c-type code))
 
 (define-struct type (name bits c parse)
@@ -64,11 +60,11 @@
    (define (gen-h c)
      (flatten (append (list (~a "typedef struct " (cmplx-name c) " " (cmplx-name c) ";")
                             (~a "struct " (cmplx-name c) " {"))
-                      (indent 1 (flatten (map super-gen-h (cmplx-fields c))))
+                      (indent (flatten (map super-gen-h (cmplx-fields c))))
                       (list (~a "};") (~a "int read_" (cmplx-name c) "(Ctx *ctx, " (cmplx-name c) " *v);")))))
    (define (gen-c c)
      (flatten (append (list (~a "int") (~a "read_" (cmplx-name c) "(Ctx *ctx, " (cmplx-name c) " *v)") (~a "{"))
-                      (indent 1 (flatten (map super-gen-c (cmplx-fields c))))
+                      (indent (flatten (map super-gen-c (cmplx-fields c))))
                       (list (~a "\treturn 0;")
                             (~a "err:")
                             (~a "\twerrstr(\"%s: %r\", \"" (cmplx-name c) "\");")