-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchronogram.lisp
106 lines (92 loc) · 2.33 KB
/
chronogram.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
;;;; chronogram.lisp
(defpackage #:chronogram
(:use #:cl)
(:export *cldr-release*
*info*
;; Symbols for identifying a locale
language
script
territory
variant
;; Calendar types
calendars
ethiopic
generic
gregorian
indian
hebrew
islamic
japanese
persian
roc
;; Calendar entries
months
days
quarters
day-periods
eras
date-formats
time-formats
datetime-formats
;; Context
stand-alone
format
;; Format
wide
narrow
abbreviated
short
medium
full
long
;; Alternatives
default
variant
list
email
www
secondary
;; Weekdays
mon
tue
wed
thu
fri
sat
sun
;; Misc symbols
pattern
midnight
am
noon
pm
morning1
morning2
afternoon1
afternoon2
evening1
evening2
night1
night2))
(in-package #:chronogram)
(eval-when (:compile-toplevel :load-toplevel :execute)
(let* ((system (asdf:find-system 'chronogram t))
(release-path (asdf:system-relative-pathname system "CLDR_RELEASE")))
(defparameter *chronogram-dist-dir*
(asdf:system-relative-pathname system "chronogram-dist/"))
(defparameter *cldr-release*
(string-trim '(#\linefeed #\return #\space)
(uiop:read-file-string release-path)))))
(defun read-resource (path)
(with-open-file (stream path)
(let ((*read-eval* nil))
(read stream))))
(defparameter *info*
(loop :with ht := (make-hash-table :test 'equalp)
:for path :in (uiop:directory-files *chronogram-dist-dir*)
:for entry := (read-resource path)
:for id := (mapcar (lambda (sym)
(cdr (assoc sym entry)))
`(language script territory variant))
:do (setf (gethash id ht) entry)
:finally (return ht)))