line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Genealogy::Gedcom::Date::Actions; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
16
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
111
|
|
4
|
5
|
|
|
5
|
|
15
|
use warnings; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
100
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
14
|
use Data::Dumper::Concise; # For Dumper(). |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
8486
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $calendar; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $logger; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $verbose = 0; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '2.09'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ------------------------------------------------ |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub about_date |
19
|
|
|
|
|
|
|
{ |
20
|
77
|
|
|
77
|
0
|
1525
|
my($cache, $t1, $t2) = @_; |
21
|
|
|
|
|
|
|
|
22
|
77
|
50
|
|
|
|
123
|
print STDERR '#=== about_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
23
|
|
|
|
|
|
|
|
24
|
77
|
|
|
|
|
84
|
my($t3) = $$t2[1]; |
25
|
77
|
100
|
|
|
|
147
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
26
|
77
|
|
|
|
|
96
|
$$t3{flag} = 'ABT'; |
27
|
|
|
|
|
|
|
|
28
|
77
|
|
|
|
|
142
|
return [$$t2[0], $t3]; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} # End of about_date. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# ------------------------------------------------ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub after_date |
35
|
|
|
|
|
|
|
{ |
36
|
77
|
|
|
77
|
0
|
1530
|
my($cache, $t1, $t2) = @_; |
37
|
|
|
|
|
|
|
|
38
|
77
|
50
|
|
|
|
115
|
print STDERR '#=== after_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
39
|
|
|
|
|
|
|
|
40
|
77
|
|
|
|
|
85
|
my($t3) = $$t2[1]; |
41
|
77
|
100
|
|
|
|
163
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
42
|
77
|
|
|
|
|
93
|
$$t3{flag} = 'AFT'; |
43
|
|
|
|
|
|
|
|
44
|
77
|
|
|
|
|
148
|
return [$$t2[0], $t3]; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} # End of after_date. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# ------------------------------------------------ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub before_date |
51
|
|
|
|
|
|
|
{ |
52
|
77
|
|
|
77
|
0
|
1534
|
my($cache, $t1, $t2) = @_; |
53
|
|
|
|
|
|
|
|
54
|
77
|
50
|
|
|
|
115
|
print STDERR '#=== before_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
55
|
|
|
|
|
|
|
|
56
|
77
|
|
|
|
|
85
|
my($t3) = $$t2[1]; |
57
|
77
|
100
|
|
|
|
148
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
58
|
77
|
|
|
|
|
92
|
$$t3{flag} = 'BEF'; |
59
|
|
|
|
|
|
|
|
60
|
77
|
|
|
|
|
145
|
return [$$t2[0], $t3]; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} # End of before_date. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# ------------------------------------------------ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub between_date |
67
|
|
|
|
|
|
|
{ |
68
|
679
|
|
|
679
|
0
|
13538
|
my($cache, $t1, $t2, $t3, $t4) = @_; |
69
|
|
|
|
|
|
|
|
70
|
679
|
50
|
|
|
|
1098
|
print STDERR '#=== between_date() action: ', Dumper($t1), Dumper($t2), Dumper($t3), Dumper($t4) if ($verbose); |
71
|
|
|
|
|
|
|
|
72
|
679
|
|
|
|
|
700
|
my($t5) = $$t2[1][0]; |
73
|
679
|
|
|
|
|
805
|
$$t5{flag} = 'BET'; |
74
|
679
|
|
|
|
|
618
|
my($t6) = $$t4[1][0]; |
75
|
679
|
|
|
|
|
620
|
$$t6{flag} = 'AND'; |
76
|
|
|
|
|
|
|
|
77
|
679
|
100
|
|
|
|
1056
|
if (ref $$t2[0] eq 'HASH') |
78
|
|
|
|
|
|
|
{ |
79
|
497
|
|
|
|
|
494
|
$t1 = $$t2[0]; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else |
82
|
|
|
|
|
|
|
{ |
83
|
182
|
|
|
|
|
352
|
$t1 = {kind => 'Calendar', type => $calendar}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
679
|
100
|
|
|
|
921
|
if (ref $$t4[0] eq 'HASH') |
87
|
|
|
|
|
|
|
{ |
88
|
497
|
|
|
|
|
447
|
$t3 = $$t4[0]; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else |
91
|
|
|
|
|
|
|
{ |
92
|
182
|
|
|
|
|
313
|
$t3 = {kind => 'Calendar', type => $calendar}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
679
|
|
|
|
|
919
|
$t1 = [$t1, $t5, $t3, $t6]; |
96
|
|
|
|
|
|
|
|
97
|
679
|
|
|
|
|
1103
|
return $t1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} # End of between_date. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# ------------------------------------------------ |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub calculated_date |
104
|
|
|
|
|
|
|
{ |
105
|
77
|
|
|
77
|
0
|
1518
|
my($cache, $t1, $t2) = @_; |
106
|
|
|
|
|
|
|
|
107
|
77
|
50
|
|
|
|
121
|
print STDERR '#=== calculated_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
108
|
|
|
|
|
|
|
|
109
|
77
|
|
|
|
|
92
|
my($t3) = $$t2[1]; |
110
|
77
|
100
|
|
|
|
147
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
111
|
77
|
|
|
|
|
92
|
$$t3{flag} = 'CAL'; |
112
|
|
|
|
|
|
|
|
113
|
77
|
|
|
|
|
137
|
return [$$t2[0], $t3]; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} # End of calculated_date. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# ------------------------------------------------ |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub calendar_name |
120
|
|
|
|
|
|
|
{ |
121
|
1888
|
|
|
1888
|
0
|
2829977
|
my($cache, $t1) = @_; |
122
|
|
|
|
|
|
|
|
123
|
1888
|
50
|
|
|
|
3471
|
print STDERR '#=== calendar_name() action: ', Dumper($t1) if ($verbose); |
124
|
|
|
|
|
|
|
|
125
|
1888
|
|
|
|
|
2850
|
$t1 =~ s/\@\#d(.+)\@/$1/; # Zap gobbledegook if present. |
126
|
1888
|
|
|
|
|
2611
|
$t1 = ucfirst lc $t1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
return |
129
|
|
|
|
|
|
|
{ |
130
|
1888
|
|
|
|
|
4834
|
kind => 'Calendar', |
131
|
|
|
|
|
|
|
type => $t1, |
132
|
|
|
|
|
|
|
}; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
} # End of calendar_name. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# ------------------------------------------------ |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub date_phrase |
139
|
|
|
|
|
|
|
{ |
140
|
1
|
|
|
1
|
0
|
6948
|
my($cache, $t1) = @_; |
141
|
|
|
|
|
|
|
|
142
|
1
|
50
|
|
|
|
4
|
print STDERR '#=== date_phrase() action: ', Dumper($t1) if ($verbose); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
return |
145
|
|
|
|
|
|
|
{ |
146
|
1
|
|
|
|
|
6
|
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
|
3121
|
my($cache, $t1, $t2) = @_; |
158
|
|
|
|
|
|
|
|
159
|
154
|
50
|
|
|
|
235
|
print STDERR '#=== estimated_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
160
|
|
|
|
|
|
|
|
161
|
154
|
|
|
|
|
159
|
my($t3) = $$t2[1]; |
162
|
154
|
100
|
|
|
|
296
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
163
|
154
|
|
|
|
|
184
|
$$t3{flag} = 'EST'; |
164
|
|
|
|
|
|
|
|
165
|
154
|
|
|
|
|
292
|
return [$$t2[0], $t3]; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} # End of estimated_date. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# ------------------------------------------------ |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub french_date |
172
|
|
|
|
|
|
|
{ |
173
|
520
|
|
|
520
|
0
|
10217
|
my($cache, $t1) = @_; |
174
|
|
|
|
|
|
|
|
175
|
520
|
50
|
|
|
|
901
|
print STDERR '#=== french_date() action: ', Dumper($t1) if ($verbose); |
176
|
|
|
|
|
|
|
|
177
|
520
|
|
|
|
|
433
|
my($bce); |
178
|
|
|
|
|
|
|
my($day); |
179
|
0
|
|
|
|
|
0
|
my($month); |
180
|
0
|
|
|
|
|
0
|
my($year); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# Check for year, month, day. |
183
|
|
|
|
|
|
|
|
184
|
520
|
100
|
|
|
|
963
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
185
|
|
|
|
|
|
|
{ |
186
|
433
|
|
|
|
|
491
|
$year = $$t1[0]; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
189
|
|
|
|
|
|
|
{ |
190
|
|
|
|
|
|
|
# First check for BCE. |
191
|
|
|
|
|
|
|
|
192
|
67
|
100
|
|
|
|
288
|
if ($$t1[1] =~ /[0-9]/) |
193
|
|
|
|
|
|
|
{ |
194
|
22
|
|
|
|
|
36
|
$month = $$t1[0]; |
195
|
22
|
|
|
|
|
25
|
$year = $$t1[1]; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
else |
198
|
|
|
|
|
|
|
{ |
199
|
45
|
|
|
|
|
68
|
$bce = $$t1[1]; |
200
|
45
|
|
|
|
|
68
|
$year = $$t1[0]; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
else |
204
|
|
|
|
|
|
|
{ |
205
|
20
|
|
|
|
|
25
|
$day = $$t1[0]; |
206
|
20
|
|
|
|
|
29
|
$month = $$t1[1]; |
207
|
20
|
|
|
|
|
30
|
$year = $$t1[2]; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
520
|
|
|
|
|
1340
|
my($result) = |
211
|
|
|
|
|
|
|
{ |
212
|
|
|
|
|
|
|
kind => 'Date', |
213
|
|
|
|
|
|
|
type => 'French r', |
214
|
|
|
|
|
|
|
year => $year, |
215
|
|
|
|
|
|
|
}; |
216
|
|
|
|
|
|
|
|
217
|
520
|
100
|
|
|
|
902
|
$$result{bce} = $bce if (defined $bce); |
218
|
520
|
100
|
|
|
|
793
|
$$result{day} = $day if (defined $day); |
219
|
520
|
100
|
|
|
|
737
|
$$result{month} = $month if (defined $month); |
220
|
520
|
|
|
|
|
606
|
$result = [$result]; |
221
|
|
|
|
|
|
|
|
222
|
520
|
|
|
|
|
817
|
return $result; |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
} # End of french_date. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# ------------------------------------------------ |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub from_date |
229
|
|
|
|
|
|
|
{ |
230
|
333
|
|
|
333
|
0
|
6484
|
my($cache, $t1, $t2) = @_; |
231
|
|
|
|
|
|
|
|
232
|
333
|
50
|
|
|
|
522
|
print STDERR '#=== from_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
233
|
|
|
|
|
|
|
|
234
|
333
|
|
|
|
|
330
|
my($t3) = $$t2[0]; |
235
|
333
|
|
|
|
|
320
|
$t2 = $$t2[1]; |
236
|
333
|
100
|
|
|
|
562
|
$t2 = $$t2[0] if (ref $t2 eq 'ARRAY'); |
237
|
333
|
|
|
|
|
378
|
$$t2{flag} = 'FROM'; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
# Is there a calendar hash present? |
240
|
|
|
|
|
|
|
|
241
|
333
|
100
|
|
|
|
536
|
if (ref $t3 eq 'HASH') |
242
|
|
|
|
|
|
|
{ |
243
|
187
|
|
|
|
|
224
|
$t2 = [$t3, $t2]; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
333
|
|
|
|
|
469
|
return $t2; |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
} # End of from_date. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# ------------------------------------------------ |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub german_date |
253
|
|
|
|
|
|
|
{ |
254
|
478
|
|
|
478
|
0
|
9417
|
my($cache, $t1) = @_; |
255
|
|
|
|
|
|
|
|
256
|
478
|
50
|
|
|
|
839
|
print STDERR '#=== german_date() action: ', Dumper($t1) if ($verbose); |
257
|
|
|
|
|
|
|
|
258
|
478
|
|
|
|
|
427
|
my($bce); |
259
|
|
|
|
|
|
|
my($day); |
260
|
0
|
|
|
|
|
0
|
my($month); |
261
|
0
|
|
|
|
|
0
|
my($year); |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
# Check for year, month, day. |
264
|
|
|
|
|
|
|
|
265
|
478
|
100
|
|
|
|
919
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
266
|
|
|
|
|
|
|
{ |
267
|
440
|
|
|
|
|
477
|
$year = $$t1[0][0]; |
268
|
440
|
|
|
|
|
506
|
$bce = $$t1[0][1]; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
elsif ($#$t1 == 2) |
271
|
|
|
|
|
|
|
{ |
272
|
20
|
|
|
|
|
26
|
$month = $$t1[0]; |
273
|
20
|
|
|
|
|
24
|
$year = $$t1[2][0]; |
274
|
20
|
|
|
|
|
23
|
$bce = $$t1[2][1]; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
else |
277
|
|
|
|
|
|
|
{ |
278
|
18
|
|
|
|
|
29
|
$day = $$t1[0]; |
279
|
18
|
|
|
|
|
24
|
$month = $$t1[2]; |
280
|
18
|
|
|
|
|
23
|
$year = $$t1[4][0]; |
281
|
18
|
|
|
|
|
21
|
$bce = $$t1[4][1]; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
478
|
|
|
|
|
1103
|
my($result) = |
285
|
|
|
|
|
|
|
{ |
286
|
|
|
|
|
|
|
kind => 'Date', |
287
|
|
|
|
|
|
|
type => 'German', |
288
|
|
|
|
|
|
|
year => $year, |
289
|
|
|
|
|
|
|
}; |
290
|
|
|
|
|
|
|
|
291
|
478
|
100
|
|
|
|
825
|
$$result{bce} = $bce if (defined $bce); |
292
|
478
|
100
|
|
|
|
752
|
$$result{day} = $day if (defined $day); |
293
|
478
|
100
|
|
|
|
730
|
$$result{month} = $month if (defined $month); |
294
|
478
|
|
|
|
|
587
|
$result = [$result]; |
295
|
|
|
|
|
|
|
|
296
|
478
|
|
|
|
|
730
|
return $result; |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
} # End of german_date. |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
# ------------------------------------------------ |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub gregorian_date |
303
|
|
|
|
|
|
|
{ |
304
|
678
|
|
|
678
|
0
|
13481
|
my($cache, $t1) = @_; |
305
|
|
|
|
|
|
|
|
306
|
678
|
50
|
|
|
|
1141
|
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
|
|
|
|
1306
|
if (ref($$t1[0]) eq 'HASH') |
311
|
|
|
|
|
|
|
{ |
312
|
47
|
|
|
|
|
110
|
return $$t1[0]; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
631
|
|
|
|
|
468
|
my($day); |
316
|
|
|
|
|
|
|
my($month); |
317
|
0
|
|
|
|
|
0
|
my($year); |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
# Check for year, month, day. |
320
|
|
|
|
|
|
|
|
321
|
631
|
100
|
|
|
|
1157
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
322
|
|
|
|
|
|
|
{ |
323
|
572
|
|
|
|
|
647
|
$year = $$t1[0]; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
326
|
|
|
|
|
|
|
{ |
327
|
30
|
|
|
|
|
45
|
$month = $$t1[0]; |
328
|
30
|
|
|
|
|
35
|
$year = $$t1[1]; |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
else |
331
|
|
|
|
|
|
|
{ |
332
|
29
|
|
|
|
|
36
|
$day = $$t1[0]; |
333
|
29
|
|
|
|
|
30
|
$month = $$t1[1]; |
334
|
29
|
|
|
|
|
30
|
$year = $$t1[2]; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
|
337
|
631
|
|
|
|
|
1537
|
my($result) = |
338
|
|
|
|
|
|
|
{ |
339
|
|
|
|
|
|
|
kind => 'Date', |
340
|
|
|
|
|
|
|
type => 'Gregorian', |
341
|
|
|
|
|
|
|
year => $year, |
342
|
|
|
|
|
|
|
}; |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# Check for /00. |
345
|
|
|
|
|
|
|
|
346
|
631
|
100
|
|
|
|
1443
|
if ($year =~ m|/|) |
347
|
|
|
|
|
|
|
{ |
348
|
143
|
|
|
|
|
418
|
($$result{year}, $$result{suffix}) = split(m|/|, $year); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
631
|
100
|
|
|
|
1091
|
$$result{month} = $month if (defined $month); |
352
|
631
|
100
|
|
|
|
894
|
$$result{day} = $day if (defined $day); |
353
|
631
|
|
|
|
|
780
|
$result = [$result]; |
354
|
|
|
|
|
|
|
|
355
|
631
|
|
|
|
|
1036
|
return $result; |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
} # End of gregorian_date. |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
# ------------------------------------------------ |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub gregorian_month |
362
|
|
|
|
|
|
|
{ |
363
|
59
|
|
|
59
|
0
|
34509
|
my($cache, $t1) = @_; |
364
|
|
|
|
|
|
|
|
365
|
59
|
50
|
|
|
|
126
|
print STDERR '#=== gregorian_month() action: ', Dumper($t1) if ($verbose); |
366
|
|
|
|
|
|
|
|
367
|
59
|
50
|
|
|
|
104
|
$t1 = $$t1[0] if (ref $t1); |
368
|
|
|
|
|
|
|
|
369
|
59
|
|
|
|
|
128
|
return $t1; |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
} # End of gregorian_month. |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
# ------------------------------------------------ |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
sub gregorian_year_bce |
376
|
|
|
|
|
|
|
{ |
377
|
47
|
|
|
47
|
0
|
1076
|
my($cache, $t1, $t2) = @_; |
378
|
|
|
|
|
|
|
|
379
|
47
|
50
|
|
|
|
122
|
print STDERR '#=== gregorian_year_bce() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
return |
382
|
|
|
|
|
|
|
{ |
383
|
47
|
|
|
|
|
214
|
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
|
10252
|
my($cache, $t1) = @_; |
396
|
|
|
|
|
|
|
|
397
|
516
|
50
|
|
|
|
872
|
print STDERR '#=== hebrew_date() action: ', Dumper($t1) if ($verbose); |
398
|
|
|
|
|
|
|
|
399
|
516
|
|
|
|
|
474
|
my($bce); |
400
|
|
|
|
|
|
|
my($day); |
401
|
0
|
|
|
|
|
0
|
my($month); |
402
|
0
|
|
|
|
|
0
|
my($year); |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
# Check for year, month, day. |
405
|
|
|
|
|
|
|
|
406
|
516
|
100
|
|
|
|
961
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
407
|
|
|
|
|
|
|
{ |
408
|
433
|
|
|
|
|
492
|
$year = $$t1[0]; |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
411
|
|
|
|
|
|
|
{ |
412
|
|
|
|
|
|
|
# First check for BCE. |
413
|
|
|
|
|
|
|
|
414
|
65
|
100
|
|
|
|
227
|
if ($$t1[1] =~ /[0-9]/) |
415
|
|
|
|
|
|
|
{ |
416
|
20
|
|
|
|
|
22
|
$month = $$t1[0]; |
417
|
20
|
|
|
|
|
25
|
$year = $$t1[1]; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
else |
420
|
|
|
|
|
|
|
{ |
421
|
45
|
|
|
|
|
62
|
$bce = $$t1[1]; |
422
|
45
|
|
|
|
|
74
|
$year = $$t1[0]; |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
else |
426
|
|
|
|
|
|
|
{ |
427
|
18
|
|
|
|
|
23
|
$day = $$t1[0]; |
428
|
18
|
|
|
|
|
17
|
$month = $$t1[1]; |
429
|
18
|
|
|
|
|
25
|
$year = $$t1[2]; |
430
|
|
|
|
|
|
|
} |
431
|
|
|
|
|
|
|
|
432
|
516
|
|
|
|
|
1261
|
my($result) = |
433
|
|
|
|
|
|
|
{ |
434
|
|
|
|
|
|
|
kind => 'Date', |
435
|
|
|
|
|
|
|
type => 'Hebrew', |
436
|
|
|
|
|
|
|
year => $year, |
437
|
|
|
|
|
|
|
}; |
438
|
|
|
|
|
|
|
|
439
|
516
|
100
|
|
|
|
892
|
$$result{bce} = $bce if (defined $bce); |
440
|
516
|
100
|
|
|
|
818
|
$$result{day} = $day if (defined $day); |
441
|
516
|
100
|
|
|
|
750
|
$$result{month} = $month if (defined $month); |
442
|
516
|
|
|
|
|
614
|
$result = [$result]; |
443
|
|
|
|
|
|
|
|
444
|
516
|
|
|
|
|
788
|
return $result; |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
} # End of hebrew_date. |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
# ------------------------------------------------ |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub interpreted_date |
451
|
|
|
|
|
|
|
{ |
452
|
40
|
|
|
40
|
0
|
876
|
my($cache, $t1) = @_; |
453
|
|
|
|
|
|
|
|
454
|
40
|
50
|
|
|
|
75
|
print STDERR '#=== interpreted_date() action: ', Dumper($t1) if ($verbose); |
455
|
|
|
|
|
|
|
|
456
|
40
|
|
|
|
|
50
|
my($t2) = $$t1[1][1][0]; |
457
|
40
|
|
|
|
|
55
|
$$t2{flag} = 'INT'; |
458
|
40
|
|
|
|
|
83
|
$$t2{phrase} = "($$t1[2][0])"; |
459
|
|
|
|
|
|
|
|
460
|
40
|
|
|
|
|
75
|
return [$$t1[1][0], $t2]; |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
} # End of interpreted_date. |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# ------------------------------------------------ |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
sub julian_date |
467
|
|
|
|
|
|
|
{ |
468
|
533
|
|
|
533
|
0
|
10417
|
my($cache, $t1) = @_; |
469
|
|
|
|
|
|
|
|
470
|
533
|
50
|
|
|
|
918
|
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
|
|
|
|
1060
|
if (ref($$t1[0]) eq 'HASH') |
475
|
|
|
|
|
|
|
{ |
476
|
45
|
|
|
|
|
103
|
return $$t1[0]; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
488
|
|
|
|
|
433
|
my($day); |
480
|
|
|
|
|
|
|
my($month); |
481
|
0
|
|
|
|
|
0
|
my($year); |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
# Check for year, month, day. |
484
|
|
|
|
|
|
|
|
485
|
488
|
100
|
|
|
|
890
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
486
|
|
|
|
|
|
|
{ |
487
|
433
|
|
|
|
|
456
|
$year = $$t1[0]; |
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
490
|
|
|
|
|
|
|
{ |
491
|
28
|
|
|
|
|
36
|
$month = $$t1[0]; |
492
|
28
|
|
|
|
|
28
|
$year = $$t1[1]; |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
else |
495
|
|
|
|
|
|
|
{ |
496
|
27
|
|
|
|
|
35
|
$day = $$t1[0]; |
497
|
27
|
|
|
|
|
19
|
$month = $$t1[1]; |
498
|
27
|
|
|
|
|
32
|
$year = $$t1[2]; |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
|
501
|
488
|
|
|
|
|
1168
|
my($result) = |
502
|
|
|
|
|
|
|
{ |
503
|
|
|
|
|
|
|
kind => 'Date', |
504
|
|
|
|
|
|
|
type => 'Julian', |
505
|
|
|
|
|
|
|
year => $year, |
506
|
|
|
|
|
|
|
}; |
507
|
|
|
|
|
|
|
|
508
|
488
|
100
|
|
|
|
843
|
$$result{month} = $month if (defined $month); |
509
|
488
|
100
|
|
|
|
800
|
$$result{day} = $day if (defined $day); |
510
|
488
|
|
|
|
|
583
|
$result = [$result]; |
511
|
|
|
|
|
|
|
|
512
|
488
|
|
|
|
|
800
|
return $result; |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
} # End of julian_date. |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
# ------------------------------------------------ |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub julian_year_bce |
519
|
|
|
|
|
|
|
{ |
520
|
45
|
|
|
45
|
0
|
984
|
my($cache, $t1, $t2) = @_; |
521
|
|
|
|
|
|
|
|
522
|
45
|
50
|
|
|
|
114
|
print STDERR '#=== julian_year_bce() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
return |
525
|
|
|
|
|
|
|
{ |
526
|
45
|
|
|
|
|
180
|
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
|
6098
|
my($cache, $t1, $t2) = @_; |
539
|
|
|
|
|
|
|
|
540
|
320
|
50
|
|
|
|
485
|
print STDERR '#=== to_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
541
|
|
|
|
|
|
|
|
542
|
320
|
|
|
|
|
319
|
my($t3) = $$t2[0]; |
543
|
320
|
|
|
|
|
246
|
$t2 = $$t2[1]; |
544
|
320
|
100
|
|
|
|
543
|
$t2 = $$t2[0] if (ref $t2 eq 'ARRAY'); |
545
|
320
|
|
|
|
|
323
|
$$t2{flag} = 'TO'; |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
# Is there a calendar hash present? |
548
|
|
|
|
|
|
|
|
549
|
320
|
100
|
|
|
|
501
|
if (ref $t3 eq 'HASH') |
550
|
|
|
|
|
|
|
{ |
551
|
228
|
|
|
|
|
254
|
$t2 = [$t3, $t2]; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
320
|
|
|
|
|
451
|
return $t2; |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
} # End of to_date. |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
# ------------------------------------------------ |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
sub year |
561
|
|
|
|
|
|
|
{ |
562
|
2725
|
|
|
2725
|
0
|
1578310
|
my($cache, $t1, $t2) = @_; |
563
|
|
|
|
|
|
|
|
564
|
2725
|
50
|
|
|
|
4699
|
print STDERR '#=== year() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
565
|
|
|
|
|
|
|
|
566
|
2725
|
100
|
|
|
|
4049
|
$t1 = "$t1/$t2" if (defined $t2); |
567
|
|
|
|
|
|
|
|
568
|
2725
|
|
|
|
|
4892
|
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 |