From 1976980d4a272fb7fc3694c734bfc6825edfc721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 23 Jun 2022 03:23:44 +0200 Subject: Centralize (almost) all exports to :export in define-module. --- module/datetime/timespec.scm | 21 ++++++++++++++------- module/datetime/zic.scm | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 19 deletions(-) (limited to 'module/datetime') diff --git a/module/datetime/timespec.scm b/module/datetime/timespec.scm index 9bfcc402..03e8dd10 100644 --- a/module/datetime/timespec.scm +++ b/module/datetime/timespec.scm @@ -4,16 +4,23 @@ ;;; Code: (define-module (datetime timespec) - :export (make-timespec - timespec? timespec-time timespec-sign timespec-type) - :use-module ((hnh util) :select (set define*-public unless)) + :use-module ((hnh util) :select (set unless)) :use-module ((hnh util exceptions) :select (warning)) :use-module (datetime) :use-module (srfi srfi-1) :use-module (srfi srfi-71) :use-module (srfi srfi-9 gnu) :use-module (calp translation) - ) + :export (make-timespec + timespec? + timespec-time + timespec-sign + timespec-type + + timespec-zero + timespec-add + parse-time-spec + )) ;; timespec as defined by the TZ-database @@ -30,10 +37,10 @@ ;; u, g, z - Universal time (type timespec-type)) ; char -(define-public (timespec-zero) +(define (timespec-zero) (make-timespec (time) '+ #\w)) -(define-public (timespec-add . specs) +(define (timespec-add . specs) (unless (apply eqv? (map timespec-type specs)) (warning (_ "Adding timespecs of differing types"))) @@ -70,7 +77,7 @@ specs)) -(define*-public (parse-time-spec +(define* (parse-time-spec string optional: (suffixes '(#\s #\w #\u #\g #\z))) (let ((type string (cond [(string-rindex string (list->char-set suffixes)) diff --git a/module/datetime/zic.scm b/module/datetime/zic.scm index 393b4ba2..66c0ba06 100644 --- a/module/datetime/zic.scm +++ b/module/datetime/zic.scm @@ -25,11 +25,32 @@ :use-module ((vcomponent recurrence internal) :select (byday make-recur-rule bymonthday)) :use-module (calp translation) - ) + :export (read-zoneinfo + + #| note that make-rule isn't exported |# + rule? + rule-name rule-from rule-to rule-in + rule-on rule-at rule-save rule-letters + + #| note that make-zone-entry isn't exported |# + zone-entry? + zone-entry-stdoff zone-entry-rule + zone-entry-format zone-entry-until + + zoneinfo? + + get-zone + get-rule + + rule->dtstart + rule->rrule + + zone-format + )) ;; returns a object -(define-public (read-zoneinfo ports-or-filenames) +(define (read-zoneinfo ports-or-filenames) (parsed-zic->zoneinfo (concatenate (map (lambda (port-or-filename) @@ -57,7 +78,6 @@ (letters rule-letters) ; string ) -(export rule? rule-name rule-from rule-to rule-in rule-on rule-at rule-save rule-letters) (define-immutable-record-type ; EXPORTED (make-zone-entry stdoff rule format until) @@ -67,8 +87,6 @@ (format zone-entry-format) ; string (until zone-entry-until)) ; | #f -(export zone-entry? zone-entry-stdoff zone-entry-rule zone-entry-format zone-entry-until) - (define-immutable-record-type ; INTERNAL (make-zone name entries) @@ -88,19 +106,17 @@ (rules zoneinfo-rules) ; (map symbol (list )) (zones zoneinfo-zones)) ; (map string (list )) -(export zoneinfo?) - ;; @example ;; (get-zone zoneinfo "Europe/Stockholm") ;; @end example -(define-public (get-zone zoneinfo name) +(define (get-zone zoneinfo name) (or (hash-ref (zoneinfo-zones zoneinfo) name) (scm-error 'misc-error "get-zone" "No zone ~a" (list name) #f))) ;; @example ;; (get-rule zoneinfo 'EU) ;; @end example -(define-public (get-rule zoneinfo name) +(define (get-rule zoneinfo name) (or (hashq-ref (zoneinfo-rules zoneinfo) name) (scm-error 'misc-error "get-rule" "No rule ~a" (list name) #f))) @@ -310,7 +326,7 @@ ;; The first time this rule was/will be applied -(define-public (rule->dtstart rule) +(define (rule->dtstart rule) ;; NOTE 'minimum and 'maximum represent the begining and end of time. ;; since I don't have a way to represent those ideas I just set a very ;; high and a very low year here. What 'maximum even entails for a start @@ -350,7 +366,7 @@ (datetime time: (timespec-time timespec))) )) -(define-public (rule->rrule rule) +(define (rule->rrule rule) (if (eq? 'only (rule-to rule)) #f (let ((base (make-recur-rule @@ -388,7 +404,7 @@ wday)))))))) ;; special case of format which works with %s and %z -(define-public (zone-format fmt-string arg) +(define (zone-format fmt-string arg) (let ((idx (string-index fmt-string #\%))) (case (string-ref fmt-string (1+ idx)) [(#\s) (string-replace fmt-string arg -- cgit v1.2.3