From 25f91436346ba0b910b3bf7eba4b0bb82cc81812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pant=C5=AF=C4=8Dek?= Date: Fri, 23 Jun 2023 22:42:18 +0200 Subject: [PATCH] Start work on partial progresses coalesce. --- src/bank-fio.scm | 2 +- src/progress.scm | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/bank-fio.scm b/src/bank-fio.scm index b63dbfb..8bc4f2a 100644 --- a/src/bank-fio.scm +++ b/src/bank-fio.scm @@ -63,7 +63,7 @@ (make-bank-transaction id date amount currency varsym message type account bank specsym))) - ;; Loads Fio bank accound statement. + ;; Loads Fio bank account statement. (define (bank-fio-parse fn) (let ((csv (with-progress% #t fn (csv-parse fn)))) (if csv diff --git a/src/progress.scm b/src/progress.scm index af605da..b7bfd53 100644 --- a/src/progress.scm +++ b/src/progress.scm @@ -41,6 +41,11 @@ run-with-progress% with-progress% progress%-advance + + run-with-progresses% + with-progresses% + run-with-partial-progress% + with-partial-progress% ) (import scheme @@ -178,6 +183,31 @@ echo? name (lambda () body ...))))) + ;; Runs multiple partial progresses + (define (run-with-progresses% echo? name proc) + (proc)) + + ;; Syntax wrapper + (define-syntax with-progresses% + (syntax-rules () + ((_ echo? name body ...) + (run-with-progresses% + echo? name + (lambda () body ...))))) + + ;; Adds name to list of partial progress names, uses the same + ;; parameters as run-with-progress% + (define (run-with-partial-progress% name proc) + (proc)) + + ;; Syntax wrapper + (define-syntax with-partial-progress% + (syntax-rules () + ((_ name body ...) + (run-with-partial-progress% + name + (lambda () body ...))))) + ;; If the program uses progress module, disable buffering (set-buffering-mode! (current-output-port) #:none)