Prepare for universal day/month handling in queries.

This commit is contained in:
Dominik Pantůček 2023-05-11 16:27:39 +02:00
parent ac1ae9b698
commit cbd17399e3
2 changed files with 12 additions and 3 deletions

View file

@ -364,8 +364,8 @@ CAL-MONTH-SOURCES=cal-month.scm util-tag.import.scm \
cal-month.o: cal-month.import.scm
cal-month.import.scm: $(CAL-MONTH-SOURCES)
CAL-PERIOD-SOURCES=cal-period.scm cal-month.import.scm \
testing.import.scm util-tag.import.scm
CAL-PERIOD-SOURCES=cal-period.scm cal-month.import.scm \
testing.import.scm util-tag.import.scm cal-day.import.scm
cal-period.o: cal-period.import.scm
cal-period.import.scm: $(CAL-PERIOD-SOURCES)

View file

@ -49,6 +49,8 @@
make-cal-period-lookup-table
lookup-by-cal-period
cal-ensure-month
cal-period-tests!
)
@ -62,7 +64,8 @@
(chicken string)
cal-month
testing
util-tag)
util-tag
cal-day)
;; Type tag
(define TAG-CAL-PERIOD (make-tag CAL-PERIOD))
@ -219,6 +222,12 @@
(cdar lst)
(loop (cdr lst))))))
;; Wrapper that accepts either day or month and returns testable month
(define (cal-ensure-month v . stop?s)
(if (cal-month? v)
v
(apply cal-day->month v stop?s)))
;; Performs self-tests of the period module.
(define (cal-period-tests!)
(run-tests