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