diff options
Diffstat (limited to 'lib/kernel/layer.mli')
| -rw-r--r-- | lib/kernel/layer.mli | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/kernel/layer.mli b/lib/kernel/layer.mli index 3092353..ab6e56b 100644 --- a/lib/kernel/layer.mli +++ b/lib/kernel/layer.mli @@ -15,10 +15,29 @@ val remove : 'r t -> Slug.t -> 'r t (** Date index. Built once per layer, not per year: [Date_spec] dates are year-independent. *) -type 'r by_date +type 'r index -val index_by_date : 'r t -> 'r by_date -val on_date : 'r by_date -> month:int -> day:int -> 'r entry list +(** [index t ~easter ~years] builds the per-date lookup for [t]. + + Fixed entries are keyed (month, day), year-independently, as they always + were. Movable entries ({!Date_spec.Easter_offset}, {!Date_spec.Nth_weekday}) + have no year-independent key, so they are resolved once for each civil year + in [years] and keyed by rata die. [easter] supplies that year's Easter as + the RITE reckons it -- see {!Rite.t}'s own [easter] field. + + [years] must list every civil year the caller's span touches. A liturgical + year is Advent-anchored and straddles two, so {!Calendar.year} and + {!Validate.run} both pass [[y; y + 1]]. A movable entry whose year is + omitted is simply absent from the index -- silently, so getting [years] + wrong loses celebrations rather than erroring. + + NOTE the index is therefore no longer built once per layer independent of + year: for fixed entries it still is, for movable ones it is per-span. *) +val index : 'r t -> easter:(int -> Date.t) -> years:int list -> 'r index + +(** Entries falling on [date], fixed and movable together, in the layer's + canonical slug order. *) +val on_date : 'r index -> Date.t -> 'r entry list (** Loads a layer from a sexp file. Parse and validation failures come back as [Error], never as an exception. *) |
