line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Genealogy::Gedcom::Date::Actions; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
45
|
use strict; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
197
|
|
4
|
6
|
|
|
6
|
|
39
|
use warnings; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
195
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
36
|
use Data::Dumper::Concise; # For Dumper(). |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
17178
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $calendar; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $logger; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $verbose = 0; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '2.10'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ------------------------------------------------ |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub about_date |
19
|
|
|
|
|
|
|
{ |
20
|
77
|
|
|
77
|
0
|
3839
|
my($cache, $t1, $t2) = @_; |
21
|
|
|
|
|
|
|
|
22
|
77
|
50
|
|
|
|
240
|
print STDERR '#=== about_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
23
|
|
|
|
|
|
|
|
24
|
77
|
|
|
|
|
179
|
my($t3) = $$t2[1]; |
25
|
77
|
100
|
|
|
|
275
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
26
|
77
|
|
|
|
|
222
|
$$t3{flag} = 'ABT'; |
27
|
|
|
|
|
|
|
|
28
|
77
|
|
|
|
|
280
|
return [$$t2[0], $t3]; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} # End of about_date. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# ------------------------------------------------ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub after_date |
35
|
|
|
|
|
|
|
{ |
36
|
77
|
|
|
77
|
0
|
4143
|
my($cache, $t1, $t2) = @_; |
37
|
|
|
|
|
|
|
|
38
|
77
|
50
|
|
|
|
256
|
print STDERR '#=== after_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
39
|
|
|
|
|
|
|
|
40
|
77
|
|
|
|
|
202
|
my($t3) = $$t2[1]; |
41
|
77
|
100
|
|
|
|
305
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
42
|
77
|
|
|
|
|
270
|
$$t3{flag} = 'AFT'; |
43
|
|
|
|
|
|
|
|
44
|
77
|
|
|
|
|
283
|
return [$$t2[0], $t3]; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} # End of after_date. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# ------------------------------------------------ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub before_date |
51
|
|
|
|
|
|
|
{ |
52
|
77
|
|
|
77
|
0
|
4362
|
my($cache, $t1, $t2) = @_; |
53
|
|
|
|
|
|
|
|
54
|
77
|
50
|
|
|
|
246
|
print STDERR '#=== before_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
55
|
|
|
|
|
|
|
|
56
|
77
|
|
|
|
|
189
|
my($t3) = $$t2[1]; |
57
|
77
|
100
|
|
|
|
313
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
58
|
77
|
|
|
|
|
268
|
$$t3{flag} = 'BEF'; |
59
|
|
|
|
|
|
|
|
60
|
77
|
|
|
|
|
299
|
return [$$t2[0], $t3]; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} # End of before_date. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# ------------------------------------------------ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub between_date |
67
|
|
|
|
|
|
|
{ |
68
|
679
|
|
|
679
|
0
|
35811
|
my($cache, $t1, $t2, $t3, $t4) = @_; |
69
|
|
|
|
|
|
|
|
70
|
679
|
50
|
|
|
|
1983
|
print STDERR '#=== between_date() action: ', Dumper($t1), Dumper($t2), Dumper($t3), Dumper($t4) if ($verbose); |
71
|
|
|
|
|
|
|
|
72
|
679
|
|
|
|
|
1601
|
my($t5) = $$t2[1][0]; |
73
|
679
|
|
|
|
|
1845
|
$$t5{flag} = 'BET'; |
74
|
679
|
|
|
|
|
1497
|
my($t6) = $$t4[1][0]; |
75
|
679
|
|
|
|
|
1536
|
$$t6{flag} = 'AND'; |
76
|
|
|
|
|
|
|
|
77
|
679
|
100
|
|
|
|
2134
|
if (ref $$t2[0] eq 'HASH') |
78
|
|
|
|
|
|
|
{ |
79
|
497
|
|
|
|
|
1246
|
$t1 = $$t2[0]; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else |
82
|
|
|
|
|
|
|
{ |
83
|
182
|
|
|
|
|
616
|
$t1 = {kind => 'Calendar', type => $calendar}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
679
|
100
|
|
|
|
1887
|
if (ref $$t4[0] eq 'HASH') |
87
|
|
|
|
|
|
|
{ |
88
|
497
|
|
|
|
|
1087
|
$t3 = $$t4[0]; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else |
91
|
|
|
|
|
|
|
{ |
92
|
182
|
|
|
|
|
574
|
$t3 = {kind => 'Calendar', type => $calendar}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
679
|
|
|
|
|
2046
|
$t1 = [$t1, $t5, $t3, $t6]; |
96
|
|
|
|
|
|
|
|
97
|
679
|
|
|
|
|
2208
|
return $t1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} # End of between_date. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# ------------------------------------------------ |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub calculated_date |
104
|
|
|
|
|
|
|
{ |
105
|
77
|
|
|
77
|
0
|
3618
|
my($cache, $t1, $t2) = @_; |
106
|
|
|
|
|
|
|
|
107
|
77
|
50
|
|
|
|
230
|
print STDERR '#=== calculated_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
108
|
|
|
|
|
|
|
|
109
|
77
|
|
|
|
|
190
|
my($t3) = $$t2[1]; |
110
|
77
|
100
|
|
|
|
275
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
111
|
77
|
|
|
|
|
216
|
$$t3{flag} = 'CAL'; |
112
|
|
|
|
|
|
|
|
113
|
77
|
|
|
|
|
270
|
return [$$t2[0], $t3]; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} # End of calculated_date. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# ------------------------------------------------ |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub calendar_name |
120
|
|
|
|
|
|
|
{ |
121
|
1888
|
|
|
1888
|
0
|
8144835
|
my($cache, $t1) = @_; |
122
|
|
|
|
|
|
|
|
123
|
1888
|
50
|
|
|
|
6769
|
print STDERR '#=== calendar_name() action: ', Dumper($t1) if ($verbose); |
124
|
|
|
|
|
|
|
|
125
|
1888
|
|
|
|
|
6517
|
$t1 =~ s/\@\#d(.+)\@/$1/; # Zap gobbledegook if present. |
126
|
1888
|
|
|
|
|
6454
|
$t1 = ucfirst lc $t1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
return |
129
|
|
|
|
|
|
|
{ |
130
|
1888
|
|
|
|
|
10067
|
kind => 'Calendar', |
131
|
|
|
|
|
|
|
type => $t1, |
132
|
|
|
|
|
|
|
}; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
} # End of calendar_name. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# ------------------------------------------------ |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub date_phrase |
139
|
|
|
|
|
|
|
{ |
140
|
1
|
|
|
1
|
0
|
25433
|
my($cache, $t1) = @_; |
141
|
|
|
|
|
|
|
|
142
|
1
|
50
|
|
|
|
7
|
print STDERR '#=== date_phrase() action: ', Dumper($t1) if ($verbose); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
return |
145
|
|
|
|
|
|
|
{ |
146
|
1
|
|
|
|
|
12
|
kind => 'Phrase', |
147
|
|
|
|
|
|
|
phrase => "($$t1[0])", |
148
|
|
|
|
|
|
|
type => 'Phrase', |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
} # End of date_phrase. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
# ------------------------------------------------ |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub estimated_date |
156
|
|
|
|
|
|
|
{ |
157
|
154
|
|
|
154
|
0
|
8242
|
my($cache, $t1, $t2) = @_; |
158
|
|
|
|
|
|
|
|
159
|
154
|
50
|
|
|
|
519
|
print STDERR '#=== estimated_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
160
|
|
|
|
|
|
|
|
161
|
154
|
|
|
|
|
413
|
my($t3) = $$t2[1]; |
162
|
154
|
100
|
|
|
|
602
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
163
|
154
|
|
|
|
|
475
|
$$t3{flag} = 'EST'; |
164
|
|
|
|
|
|
|
|
165
|
154
|
|
|
|
|
571
|
return [$$t2[0], $t3]; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} # End of estimated_date. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# ------------------------------------------------ |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub french_date |
172
|
|
|
|
|
|
|
{ |
173
|
520
|
|
|
520
|
0
|
29388
|
my($cache, $t1) = @_; |
174
|
|
|
|
|
|
|
|
175
|
520
|
50
|
|
|
|
1861
|
print STDERR '#=== french_date() action: ', Dumper($t1) if ($verbose); |
176
|
|
|
|
|
|
|
|
177
|
520
|
|
|
|
|
2511
|
my($bce); |
178
|
|
|
|
|
|
|
my($day); |
179
|
520
|
|
|
|
|
0
|
my($month); |
180
|
520
|
|
|
|
|
0
|
my($year); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# Check for year, month, day. |
183
|
|
|
|
|
|
|
|
184
|
520
|
100
|
|
|
|
2150
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
185
|
|
|
|
|
|
|
{ |
186
|
433
|
|
|
|
|
1236
|
$year = $$t1[0]; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
189
|
|
|
|
|
|
|
{ |
190
|
|
|
|
|
|
|
# First check for BCE. |
191
|
|
|
|
|
|
|
|
192
|
67
|
100
|
|
|
|
397
|
if ($$t1[1] =~ /[0-9]/) |
193
|
|
|
|
|
|
|
{ |
194
|
22
|
|
|
|
|
83
|
$month = $$t1[0]; |
195
|
22
|
|
|
|
|
67
|
$year = $$t1[1]; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
else |
198
|
|
|
|
|
|
|
{ |
199
|
45
|
|
|
|
|
179
|
$bce = $$t1[1]; |
200
|
45
|
|
|
|
|
137
|
$year = $$t1[0]; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
else |
204
|
|
|
|
|
|
|
{ |
205
|
20
|
|
|
|
|
65
|
$day = $$t1[0]; |
206
|
20
|
|
|
|
|
52
|
$month = $$t1[1]; |
207
|
20
|
|
|
|
|
51
|
$year = $$t1[2]; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
520
|
|
|
|
|
3087
|
my($result) = |
211
|
|
|
|
|
|
|
{ |
212
|
|
|
|
|
|
|
kind => 'Date', |
213
|
|
|
|
|
|
|
type => 'French r', |
214
|
|
|
|
|
|
|
year => $year, |
215
|
|
|
|
|
|
|
}; |
216
|
|
|
|
|
|
|
|
217
|
520
|
100
|
|
|
|
2044
|
$$result{bce} = $bce if (defined $bce); |
218
|
520
|
100
|
|
|
|
1790
|
$$result{day} = $day if (defined $day); |
219
|
520
|
100
|
|
|
|
1685
|
$$result{month} = $month if (defined $month); |
220
|
520
|
|
|
|
|
1440
|
$result = [$result]; |
221
|
|
|
|
|
|
|
|
222
|
520
|
|
|
|
|
1872
|
return $result; |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
} # End of french_date. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# ------------------------------------------------ |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub from_date |
229
|
|
|
|
|
|
|
{ |
230
|
333
|
|
|
333
|
0
|
20790
|
my($cache, $t1, $t2) = @_; |
231
|
|
|
|
|
|
|
|
232
|
333
|
50
|
|
|
|
1303
|
print STDERR '#=== from_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
233
|
|
|
|
|
|
|
|
234
|
333
|
|
|
|
|
1006
|
my($t3) = $$t2[0]; |
235
|
333
|
|
|
|
|
929
|
$t2 = $$t2[1]; |
236
|
333
|
100
|
|
|
|
1431
|
$t2 = $$t2[0] if (ref $t2 eq 'ARRAY'); |
237
|
333
|
|
|
|
|
1139
|
$$t2{flag} = 'FROM'; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
# Is there a calendar hash present? |
240
|
|
|
|
|
|
|
|
241
|
333
|
100
|
|
|
|
1272
|
if (ref $t3 eq 'HASH') |
242
|
|
|
|
|
|
|
{ |
243
|
187
|
|
|
|
|
617
|
$t2 = [$t3, $t2]; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
333
|
|
|
|
|
1177
|
return $t2; |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
} # End of from_date. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# ------------------------------------------------ |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub german_date |
253
|
|
|
|
|
|
|
{ |
254
|
478
|
|
|
478
|
0
|
26886
|
my($cache, $t1) = @_; |
255
|
|
|
|
|
|
|
|
256
|
478
|
50
|
|
|
|
1799
|
print STDERR '#=== german_date() action: ', Dumper($t1) if ($verbose); |
257
|
|
|
|
|
|
|
|
258
|
478
|
|
|
|
|
2351
|
my($bce); |
259
|
|
|
|
|
|
|
my($day); |
260
|
478
|
|
|
|
|
0
|
my($month); |
261
|
478
|
|
|
|
|
0
|
my($year); |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
# Check for year, month, day. |
264
|
|
|
|
|
|
|
|
265
|
478
|
100
|
|
|
|
1841
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
266
|
|
|
|
|
|
|
{ |
267
|
440
|
|
|
|
|
1235
|
$year = $$t1[0][0]; |
268
|
440
|
|
|
|
|
1199
|
$bce = $$t1[0][1]; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
elsif ($#$t1 == 2) |
271
|
|
|
|
|
|
|
{ |
272
|
20
|
|
|
|
|
77
|
$month = $$t1[0]; |
273
|
20
|
|
|
|
|
58
|
$year = $$t1[2][0]; |
274
|
20
|
|
|
|
|
58
|
$bce = $$t1[2][1]; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
else |
277
|
|
|
|
|
|
|
{ |
278
|
18
|
|
|
|
|
62
|
$day = $$t1[0]; |
279
|
18
|
|
|
|
|
55
|
$month = $$t1[2]; |
280
|
18
|
|
|
|
|
62
|
$year = $$t1[4][0]; |
281
|
18
|
|
|
|
|
56
|
$bce = $$t1[4][1]; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
478
|
|
|
|
|
2726
|
my($result) = |
285
|
|
|
|
|
|
|
{ |
286
|
|
|
|
|
|
|
kind => 'Date', |
287
|
|
|
|
|
|
|
type => 'German', |
288
|
|
|
|
|
|
|
year => $year, |
289
|
|
|
|
|
|
|
}; |
290
|
|
|
|
|
|
|
|
291
|
478
|
100
|
|
|
|
1820
|
$$result{bce} = $bce if (defined $bce); |
292
|
478
|
100
|
|
|
|
1649
|
$$result{day} = $day if (defined $day); |
293
|
478
|
100
|
|
|
|
1660
|
$$result{month} = $month if (defined $month); |
294
|
478
|
|
|
|
|
1414
|
$result = [$result]; |
295
|
|
|
|
|
|
|
|
296
|
478
|
|
|
|
|
1833
|
return $result; |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
} # End of german_date. |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
# ------------------------------------------------ |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub gregorian_date |
303
|
|
|
|
|
|
|
{ |
304
|
678
|
|
|
678
|
0
|
36880
|
my($cache, $t1) = @_; |
305
|
|
|
|
|
|
|
|
306
|
678
|
50
|
|
|
|
2464
|
print STDERR '#=== gregorian_date() action: ', Dumper($t1) if ($verbose); |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
# Is it a BCE date? If so, it's already a hashref. |
309
|
|
|
|
|
|
|
|
310
|
678
|
100
|
|
|
|
2547
|
if (ref($$t1[0]) eq 'HASH') |
311
|
|
|
|
|
|
|
{ |
312
|
47
|
|
|
|
|
165
|
return $$t1[0]; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
631
|
|
|
|
|
2285
|
my($day); |
316
|
|
|
|
|
|
|
my($month); |
317
|
631
|
|
|
|
|
0
|
my($year); |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
# Check for year, month, day. |
320
|
|
|
|
|
|
|
|
321
|
631
|
100
|
|
|
|
2309
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
322
|
|
|
|
|
|
|
{ |
323
|
572
|
|
|
|
|
1548
|
$year = $$t1[0]; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
326
|
|
|
|
|
|
|
{ |
327
|
30
|
|
|
|
|
78
|
$month = $$t1[0]; |
328
|
30
|
|
|
|
|
74
|
$year = $$t1[1]; |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
else |
331
|
|
|
|
|
|
|
{ |
332
|
29
|
|
|
|
|
83
|
$day = $$t1[0]; |
333
|
29
|
|
|
|
|
84
|
$month = $$t1[1]; |
334
|
29
|
|
|
|
|
86
|
$year = $$t1[2]; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
|
337
|
631
|
|
|
|
|
3388
|
my($result) = |
338
|
|
|
|
|
|
|
{ |
339
|
|
|
|
|
|
|
kind => 'Date', |
340
|
|
|
|
|
|
|
type => 'Gregorian', |
341
|
|
|
|
|
|
|
year => $year, |
342
|
|
|
|
|
|
|
}; |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# Check for /00. |
345
|
|
|
|
|
|
|
|
346
|
631
|
100
|
|
|
|
2912
|
if ($year =~ m|/|) |
347
|
|
|
|
|
|
|
{ |
348
|
143
|
|
|
|
|
739
|
($$result{year}, $$result{suffix}) = split(m|/|, $year); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
631
|
100
|
|
|
|
2364
|
$$result{month} = $month if (defined $month); |
352
|
631
|
100
|
|
|
|
1984
|
$$result{day} = $day if (defined $day); |
353
|
631
|
|
|
|
|
1745
|
$result = [$result]; |
354
|
|
|
|
|
|
|
|
355
|
631
|
|
|
|
|
2588
|
return $result; |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
} # End of gregorian_date. |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
# ------------------------------------------------ |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub gregorian_month |
362
|
|
|
|
|
|
|
{ |
363
|
59
|
|
|
59
|
0
|
88150
|
my($cache, $t1) = @_; |
364
|
|
|
|
|
|
|
|
365
|
59
|
50
|
|
|
|
255
|
print STDERR '#=== gregorian_month() action: ', Dumper($t1) if ($verbose); |
366
|
|
|
|
|
|
|
|
367
|
59
|
50
|
|
|
|
191
|
$t1 = $$t1[0] if (ref $t1); |
368
|
|
|
|
|
|
|
|
369
|
59
|
|
|
|
|
230
|
return $t1; |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
} # End of gregorian_month. |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
# ------------------------------------------------ |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
sub gregorian_year_bce |
376
|
|
|
|
|
|
|
{ |
377
|
47
|
|
|
47
|
0
|
2383
|
my($cache, $t1, $t2) = @_; |
378
|
|
|
|
|
|
|
|
379
|
47
|
50
|
|
|
|
178
|
print STDERR '#=== gregorian_year_bce() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
return |
382
|
|
|
|
|
|
|
{ |
383
|
47
|
|
|
|
|
373
|
bce => $t2, |
384
|
|
|
|
|
|
|
kind => 'Date', |
385
|
|
|
|
|
|
|
type => 'Gregorian', |
386
|
|
|
|
|
|
|
year => $t1, |
387
|
|
|
|
|
|
|
}; |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
} # End of gregorian_year_bce. |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
# ------------------------------------------------ |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
sub hebrew_date |
394
|
|
|
|
|
|
|
{ |
395
|
516
|
|
|
516
|
0
|
27991
|
my($cache, $t1) = @_; |
396
|
|
|
|
|
|
|
|
397
|
516
|
50
|
|
|
|
1835
|
print STDERR '#=== hebrew_date() action: ', Dumper($t1) if ($verbose); |
398
|
|
|
|
|
|
|
|
399
|
516
|
|
|
|
|
2346
|
my($bce); |
400
|
|
|
|
|
|
|
my($day); |
401
|
516
|
|
|
|
|
0
|
my($month); |
402
|
516
|
|
|
|
|
0
|
my($year); |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
# Check for year, month, day. |
405
|
|
|
|
|
|
|
|
406
|
516
|
100
|
|
|
|
1981
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
407
|
|
|
|
|
|
|
{ |
408
|
433
|
|
|
|
|
1311
|
$year = $$t1[0]; |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
411
|
|
|
|
|
|
|
{ |
412
|
|
|
|
|
|
|
# First check for BCE. |
413
|
|
|
|
|
|
|
|
414
|
65
|
100
|
|
|
|
363
|
if ($$t1[1] =~ /[0-9]/) |
415
|
|
|
|
|
|
|
{ |
416
|
20
|
|
|
|
|
59
|
$month = $$t1[0]; |
417
|
20
|
|
|
|
|
59
|
$year = $$t1[1]; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
else |
420
|
|
|
|
|
|
|
{ |
421
|
45
|
|
|
|
|
127
|
$bce = $$t1[1]; |
422
|
45
|
|
|
|
|
130
|
$year = $$t1[0]; |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
else |
426
|
|
|
|
|
|
|
{ |
427
|
18
|
|
|
|
|
52
|
$day = $$t1[0]; |
428
|
18
|
|
|
|
|
47
|
$month = $$t1[1]; |
429
|
18
|
|
|
|
|
283
|
$year = $$t1[2]; |
430
|
|
|
|
|
|
|
} |
431
|
|
|
|
|
|
|
|
432
|
516
|
|
|
|
|
3006
|
my($result) = |
433
|
|
|
|
|
|
|
{ |
434
|
|
|
|
|
|
|
kind => 'Date', |
435
|
|
|
|
|
|
|
type => 'Hebrew', |
436
|
|
|
|
|
|
|
year => $year, |
437
|
|
|
|
|
|
|
}; |
438
|
|
|
|
|
|
|
|
439
|
516
|
100
|
|
|
|
1900
|
$$result{bce} = $bce if (defined $bce); |
440
|
516
|
100
|
|
|
|
1714
|
$$result{day} = $day if (defined $day); |
441
|
516
|
100
|
|
|
|
1879
|
$$result{month} = $month if (defined $month); |
442
|
516
|
|
|
|
|
1380
|
$result = [$result]; |
443
|
|
|
|
|
|
|
|
444
|
516
|
|
|
|
|
2295
|
return $result; |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
} # End of hebrew_date. |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
# ------------------------------------------------ |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub interpreted_date |
451
|
|
|
|
|
|
|
{ |
452
|
40
|
|
|
40
|
0
|
2611
|
my($cache, $t1) = @_; |
453
|
|
|
|
|
|
|
|
454
|
40
|
50
|
|
|
|
150
|
print STDERR '#=== interpreted_date() action: ', Dumper($t1) if ($verbose); |
455
|
|
|
|
|
|
|
|
456
|
40
|
|
|
|
|
129
|
my($t2) = $$t1[1][1][0]; |
457
|
40
|
|
|
|
|
142
|
$$t2{flag} = 'INT'; |
458
|
40
|
|
|
|
|
179
|
$$t2{phrase} = "($$t1[2][0])"; |
459
|
|
|
|
|
|
|
|
460
|
40
|
|
|
|
|
181
|
return [$$t1[1][0], $t2]; |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
} # End of interpreted_date. |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# ------------------------------------------------ |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
sub julian_date |
467
|
|
|
|
|
|
|
{ |
468
|
533
|
|
|
533
|
0
|
28386
|
my($cache, $t1) = @_; |
469
|
|
|
|
|
|
|
|
470
|
533
|
50
|
|
|
|
1910
|
print STDERR '#=== julian_date() action: ', Dumper($t1) if ($verbose); |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
# Is it a BCE date? If so, it's already a hashref. |
473
|
|
|
|
|
|
|
|
474
|
533
|
100
|
|
|
|
2213
|
if (ref($$t1[0]) eq 'HASH') |
475
|
|
|
|
|
|
|
{ |
476
|
45
|
|
|
|
|
163
|
return $$t1[0]; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
488
|
|
|
|
|
2237
|
my($day); |
480
|
|
|
|
|
|
|
my($month); |
481
|
488
|
|
|
|
|
0
|
my($year); |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
# Check for year, month, day. |
484
|
|
|
|
|
|
|
|
485
|
488
|
100
|
|
|
|
1870
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
486
|
|
|
|
|
|
|
{ |
487
|
433
|
|
|
|
|
1186
|
$year = $$t1[0]; |
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
490
|
|
|
|
|
|
|
{ |
491
|
28
|
|
|
|
|
75
|
$month = $$t1[0]; |
492
|
28
|
|
|
|
|
74
|
$year = $$t1[1]; |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
else |
495
|
|
|
|
|
|
|
{ |
496
|
27
|
|
|
|
|
75
|
$day = $$t1[0]; |
497
|
27
|
|
|
|
|
67
|
$month = $$t1[1]; |
498
|
27
|
|
|
|
|
72
|
$year = $$t1[2]; |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
|
501
|
488
|
|
|
|
|
3103
|
my($result) = |
502
|
|
|
|
|
|
|
{ |
503
|
|
|
|
|
|
|
kind => 'Date', |
504
|
|
|
|
|
|
|
type => 'Julian', |
505
|
|
|
|
|
|
|
year => $year, |
506
|
|
|
|
|
|
|
}; |
507
|
|
|
|
|
|
|
|
508
|
488
|
100
|
|
|
|
1833
|
$$result{month} = $month if (defined $month); |
509
|
488
|
100
|
|
|
|
1516
|
$$result{day} = $day if (defined $day); |
510
|
488
|
|
|
|
|
1396
|
$result = [$result]; |
511
|
|
|
|
|
|
|
|
512
|
488
|
|
|
|
|
1710
|
return $result; |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
} # End of julian_date. |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
# ------------------------------------------------ |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub julian_year_bce |
519
|
|
|
|
|
|
|
{ |
520
|
45
|
|
|
45
|
0
|
2258
|
my($cache, $t1, $t2) = @_; |
521
|
|
|
|
|
|
|
|
522
|
45
|
50
|
|
|
|
176
|
print STDERR '#=== julian_year_bce() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
return |
525
|
|
|
|
|
|
|
{ |
526
|
45
|
|
|
|
|
322
|
bce => $t2, |
527
|
|
|
|
|
|
|
kind => 'Date', |
528
|
|
|
|
|
|
|
type => 'Julian', |
529
|
|
|
|
|
|
|
year => $t1, |
530
|
|
|
|
|
|
|
}; |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
} # End of julian_year_bce. |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
# ------------------------------------------------ |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
sub to_date |
537
|
|
|
|
|
|
|
{ |
538
|
320
|
|
|
320
|
0
|
20276
|
my($cache, $t1, $t2) = @_; |
539
|
|
|
|
|
|
|
|
540
|
320
|
50
|
|
|
|
1214
|
print STDERR '#=== to_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
541
|
|
|
|
|
|
|
|
542
|
320
|
|
|
|
|
964
|
my($t3) = $$t2[0]; |
543
|
320
|
|
|
|
|
905
|
$t2 = $$t2[1]; |
544
|
320
|
100
|
|
|
|
1439
|
$t2 = $$t2[0] if (ref $t2 eq 'ARRAY'); |
545
|
320
|
|
|
|
|
1087
|
$$t2{flag} = 'TO'; |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
# Is there a calendar hash present? |
548
|
|
|
|
|
|
|
|
549
|
320
|
100
|
|
|
|
1167
|
if (ref $t3 eq 'HASH') |
550
|
|
|
|
|
|
|
{ |
551
|
228
|
|
|
|
|
766
|
$t2 = [$t3, $t2]; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
320
|
|
|
|
|
1157
|
return $t2; |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
} # End of to_date. |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
# ------------------------------------------------ |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
sub year |
561
|
|
|
|
|
|
|
{ |
562
|
2725
|
|
|
2725
|
0
|
4342308
|
my($cache, $t1, $t2) = @_; |
563
|
|
|
|
|
|
|
|
564
|
2725
|
50
|
|
|
|
9199
|
print STDERR '#=== year() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
565
|
|
|
|
|
|
|
|
566
|
2725
|
100
|
|
|
|
7924
|
$t1 = "$t1/$t2" if (defined $t2); |
567
|
|
|
|
|
|
|
|
568
|
2725
|
|
|
|
|
9886
|
return $t1; |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
} # End of year. |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
# ------------------------------------------------ |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
1; |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=pod |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
=head1 NAME |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
C - A nested SVG parser, using XML::SAX and Marpa::R2 |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=head1 Synopsis |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
See L. |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=head1 Description |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
Basically just utility routines for L. Only used indirectly by |
589
|
|
|
|
|
|
|
L. |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
Specifially, calls to functions are triggered by items in the input stream matching elements of |
592
|
|
|
|
|
|
|
the current grammar (and Marpa does the calling). |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
Each action function returns a arrayref or hashref, which Marpa gathers. The calling code in |
595
|
|
|
|
|
|
|
L decodes the result so that its C method can return an arrayref. |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
=head1 Installation |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
See L. |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=head1 Constructor and Initialization |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
This class has no constructor. L fabricates an instance, but won't let us get access to |
604
|
|
|
|
|
|
|
it. |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
So, we use a global variable, C<$logger>, initialized in L, |
607
|
|
|
|
|
|
|
in case we need logging. Details: |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=over 4 |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
=item o logger => aLog::HandlerObject |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
By default, an object of type L is created which prints to STDOUT, |
614
|
|
|
|
|
|
|
but given the default, nothing is actually printed unless the C attribute of this object |
615
|
|
|
|
|
|
|
is changed in L. |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
Default: anObjectOfTypeLogHandler. |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
Usage (in this module): $logger -> log(info => $string). |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
=back |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=head1 Methods |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
None. |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
=head1 Functions |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
Many. |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=head1 Globals |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
Yes, some C variables are used to communicate the C. |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=head1 FAQ |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
See L. |
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
=head1 Author |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
L was written by Ron Savage Iron@savage.net.auE> in 2011. |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
Home page: L. |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
=head1 Copyright |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
Australian copyright (c) 2011, Ron Savage. |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
All Programs of mine are 'OSI Certified Open Source Software'; |
650
|
|
|
|
|
|
|
you can redistribute them and/or modify them under the terms of |
651
|
|
|
|
|
|
|
The Perl License, a copy of which is available at: |
652
|
|
|
|
|
|
|
http://dev.perl.org/licenses/ |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=cut |