From 22f28015981295660ff98b43789f8c4c99134f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 16 Oct 2023 19:39:12 +0200 Subject: Move timespec and recur-rule to new object system. --- doc/ref/general/util.texi | 12 --- module/datetime/timespec.scm | 27 +++-- module/datetime/zic.scm | 18 ++-- module/hnh/util.scm | 22 ---- module/vcomponent/formats/xcal/parse.scm | 2 +- module/vcomponent/recurrence.scm | 2 +- module/vcomponent/recurrence/internal.scm | 147 ++++++++++++++------------ module/vcomponent/recurrence/parse.scm | 130 ++++++++++------------- tests/unit/coverage-supplement.scm | 8 +- tests/unit/datetime/zic.scm | 16 +-- tests/unit/vcomponent/recurrence-advanced.scm | 100 +++++++++--------- tests/unit/vcomponent/recurrence-simple.scm | 23 ++-- tests/unit/vcomponent/rrule-serialization.scm | 9 +- 13 files changed, 241 insertions(+), 275 deletions(-) diff --git a/doc/ref/general/util.texi b/doc/ref/general/util.texi index ced5c27a..caf67c47 100644 --- a/doc/ref/general/util.texi +++ b/doc/ref/general/util.texi @@ -265,18 +265,6 @@ list, in which case @var{->} inserts item as the second argument @end defmac -@defmac set (accessor object) value -@defmacx set (accessor object) = (operation args ...) -See @xref{SRFI-9 Records,,,guile} -@end defmac - -@defmac set-> object (accessor value) rest ... -@defmacx set-> object (accessor = (operator args)) rest ... -Wrapper around @var{set}, but applies transformations from left to -right, similar to @var{->}. -@end defmac - - @defmac and=>> value procedures ... Chained application of @code{and=>}, so applies each procedure from left to right, stopping when one return @code{#f}. diff --git a/module/datetime/timespec.scm b/module/datetime/timespec.scm index 53eba014..7ea448a0 100644 --- a/module/datetime/timespec.scm +++ b/module/datetime/timespec.scm @@ -4,12 +4,14 @@ ;;; Code: (define-module (datetime timespec) - :use-module ((hnh util) :select (set unless)) + :use-module ((hnh util) :select (unless)) :use-module ((hnh util exceptions) :select (warning)) + :use-module (hnh util object) + :use-module (hnh util lens) :use-module (datetime) :use-module (srfi srfi-1) :use-module (srfi srfi-71) - :use-module (srfi srfi-9 gnu) + :use-module (srfi srfi-88) :use-module (calp translation) :export (make-timespec timespec? @@ -26,16 +28,22 @@ ;; timespec as defined by the TZ-database ;; also used UTC-OFFSET defined by RFC5545. Then type should equal #\z ;; and be ignored. -(define-immutable-record-type ; EXPORTED - (make-timespec timespec-time sign type) - timespec? - (timespec-time timespec-time) ;