Start replacing member record.

This commit is contained in:
Dominik Pantůček 2023-04-01 18:10:50 +02:00
parent 52a2108b4f
commit 76f45b5f7c

View file

@ -36,28 +36,32 @@
(chicken base)
(chicken format)
(chicken string)
(chicken process-context)
(chicken pathname)
member-record
utils
configuration)
;; Generate all the files in current directory, should be wrapped in
;; something like with-current-directory.
(define (gen-web-static-member mr)
;; Generate all the files in specified (default current) directory.
(define (gen-web-static-member mr . dirs)
(let ((nick (member-nick mr))
(id (member-id mr)))
(with-output-to-file (sprintf "~A.id" nick)
(id (member-id mr))
(dir (if (null? dirs)
(current-directory)
(car dirs))))
(with-output-to-file (make-pathname dir (sprintf "~A.id" nick))
(lambda ()
(print id)))
(with-output-to-file (sprintf "~A.balance" nick)
(with-output-to-file (make-pathname dir (sprintf "~A.balance" nick))
(lambda ()
(print (member-total-balance mr))))
(with-output-to-file (sprintf "~A.misc" nick)
(with-output-to-file (make-pathname dir (sprintf "~A.misc" nick))
(lambda ()
(let loop ((lines (member-source mr)))
(when (not (null? lines))
(print (car lines))
(loop (cdr lines))))))
(with-output-to-file (sprintf "~A.log" nick)
(with-output-to-file (make-pathname dir (sprintf "~A.log" nick))
(lambda ()
(let loop ((lines
(get-process-output-lines
@ -73,6 +77,9 @@
;; Generates all member files in given directory
(define (gen-web-static mb dir)
#f)
(let loop ((mb mb))
(when (not (null? mb))
(gen-web-static-member (car mb) dir)
(loop (cdr mb)))))
)