line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Genealogy::Gedcom::Date::Actions; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
16
|
use strict; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
108
|
|
4
|
5
|
|
|
5
|
|
14
|
use warnings; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
87
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
14
|
use Data::Dumper::Concise; # For Dumper(). |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
8501
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $calendar; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $logger; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $verbose = 0; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '2.08'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ------------------------------------------------ |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub about_date |
19
|
|
|
|
|
|
|
{ |
20
|
77
|
|
|
77
|
0
|
1533
|
my($cache, $t1, $t2) = @_; |
21
|
|
|
|
|
|
|
|
22
|
77
|
50
|
|
|
|
129
|
print STDERR '#=== about_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
23
|
|
|
|
|
|
|
|
24
|
77
|
|
|
|
|
75
|
my($t3) = $$t2[1]; |
25
|
77
|
100
|
|
|
|
158
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
26
|
77
|
|
|
|
|
99
|
$$t3{flag} = 'ABT'; |
27
|
|
|
|
|
|
|
|
28
|
77
|
|
|
|
|
143
|
return [$$t2[0], $t3]; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} # End of about_date. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# ------------------------------------------------ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub after_date |
35
|
|
|
|
|
|
|
{ |
36
|
77
|
|
|
77
|
0
|
1612
|
my($cache, $t1, $t2) = @_; |
37
|
|
|
|
|
|
|
|
38
|
77
|
50
|
|
|
|
135
|
print STDERR '#=== after_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
39
|
|
|
|
|
|
|
|
40
|
77
|
|
|
|
|
89
|
my($t3) = $$t2[1]; |
41
|
77
|
100
|
|
|
|
183
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
42
|
77
|
|
|
|
|
94
|
$$t3{flag} = 'AFT'; |
43
|
|
|
|
|
|
|
|
44
|
77
|
|
|
|
|
153
|
return [$$t2[0], $t3]; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} # End of after_date. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# ------------------------------------------------ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub before_date |
51
|
|
|
|
|
|
|
{ |
52
|
77
|
|
|
77
|
0
|
1674
|
my($cache, $t1, $t2) = @_; |
53
|
|
|
|
|
|
|
|
54
|
77
|
50
|
|
|
|
145
|
print STDERR '#=== before_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
55
|
|
|
|
|
|
|
|
56
|
77
|
|
|
|
|
90
|
my($t3) = $$t2[1]; |
57
|
77
|
100
|
|
|
|
167
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
58
|
77
|
|
|
|
|
118
|
$$t3{flag} = 'BEF'; |
59
|
|
|
|
|
|
|
|
60
|
77
|
|
|
|
|
153
|
return [$$t2[0], $t3]; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} # End of before_date. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# ------------------------------------------------ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub between_date |
67
|
|
|
|
|
|
|
{ |
68
|
679
|
|
|
679
|
0
|
13165
|
my($cache, $t1, $t2, $t3, $t4) = @_; |
69
|
|
|
|
|
|
|
|
70
|
679
|
50
|
|
|
|
1103
|
print STDERR '#=== between_date() action: ', Dumper($t1), Dumper($t2), Dumper($t3), Dumper($t4) if ($verbose); |
71
|
|
|
|
|
|
|
|
72
|
679
|
|
|
|
|
712
|
my($t5) = $$t2[1][0]; |
73
|
679
|
|
|
|
|
832
|
$$t5{flag} = 'BET'; |
74
|
679
|
|
|
|
|
603
|
my($t6) = $$t4[1][0]; |
75
|
679
|
|
|
|
|
707
|
$$t6{flag} = 'AND'; |
76
|
|
|
|
|
|
|
|
77
|
679
|
100
|
|
|
|
1071
|
if (ref $$t2[0] eq 'HASH') |
78
|
|
|
|
|
|
|
{ |
79
|
497
|
|
|
|
|
548
|
$t1 = $$t2[0]; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else |
82
|
|
|
|
|
|
|
{ |
83
|
182
|
|
|
|
|
361
|
$t1 = {kind => 'Calendar', type => $calendar}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
679
|
100
|
|
|
|
990
|
if (ref $$t4[0] eq 'HASH') |
87
|
|
|
|
|
|
|
{ |
88
|
497
|
|
|
|
|
447
|
$t3 = $$t4[0]; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else |
91
|
|
|
|
|
|
|
{ |
92
|
182
|
|
|
|
|
308
|
$t3 = {kind => 'Calendar', type => $calendar}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
679
|
|
|
|
|
932
|
$t1 = [$t1, $t5, $t3, $t6]; |
96
|
|
|
|
|
|
|
|
97
|
679
|
|
|
|
|
1146
|
return $t1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} # End of between_date. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# ------------------------------------------------ |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub calculated_date |
104
|
|
|
|
|
|
|
{ |
105
|
77
|
|
|
77
|
0
|
1600
|
my($cache, $t1, $t2) = @_; |
106
|
|
|
|
|
|
|
|
107
|
77
|
50
|
|
|
|
149
|
print STDERR '#=== calculated_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
108
|
|
|
|
|
|
|
|
109
|
77
|
|
|
|
|
97
|
my($t3) = $$t2[1]; |
110
|
77
|
100
|
|
|
|
167
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
111
|
77
|
|
|
|
|
107
|
$$t3{flag} = 'CAL'; |
112
|
|
|
|
|
|
|
|
113
|
77
|
|
|
|
|
149
|
return [$$t2[0], $t3]; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} # End of calculated_date. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# ------------------------------------------------ |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub calendar_name |
120
|
|
|
|
|
|
|
{ |
121
|
1888
|
|
|
1888
|
0
|
2819181
|
my($cache, $t1) = @_; |
122
|
|
|
|
|
|
|
|
123
|
1888
|
50
|
|
|
|
3536
|
print STDERR '#=== calendar_name() action: ', Dumper($t1) if ($verbose); |
124
|
|
|
|
|
|
|
|
125
|
1888
|
|
|
|
|
2867
|
$t1 =~ s/\@\#d(.+)\@/$1/; # Zap gobbledegook if present. |
126
|
1888
|
|
|
|
|
2636
|
$t1 = ucfirst lc $t1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
return |
129
|
|
|
|
|
|
|
{ |
130
|
1888
|
|
|
|
|
5003
|
kind => 'Calendar', |
131
|
|
|
|
|
|
|
type => $t1, |
132
|
|
|
|
|
|
|
}; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
} # End of calendar_name. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# ------------------------------------------------ |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub date_phrase |
139
|
|
|
|
|
|
|
{ |
140
|
1
|
|
|
1
|
0
|
7617
|
my($cache, $t1) = @_; |
141
|
|
|
|
|
|
|
|
142
|
1
|
50
|
|
|
|
4
|
print STDERR '#=== date_phrase() action: ', Dumper($t1) if ($verbose); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
return |
145
|
|
|
|
|
|
|
{ |
146
|
1
|
|
|
|
|
7
|
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
|
3013
|
my($cache, $t1, $t2) = @_; |
158
|
|
|
|
|
|
|
|
159
|
154
|
50
|
|
|
|
251
|
print STDERR '#=== estimated_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
160
|
|
|
|
|
|
|
|
161
|
154
|
|
|
|
|
165
|
my($t3) = $$t2[1]; |
162
|
154
|
100
|
|
|
|
304
|
$t3 = $$t3[0] if (ref $t3 eq 'ARRAY'); |
163
|
154
|
|
|
|
|
186
|
$$t3{flag} = 'EST'; |
164
|
|
|
|
|
|
|
|
165
|
154
|
|
|
|
|
280
|
return [$$t2[0], $t3]; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} # End of estimated_date. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# ------------------------------------------------ |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub french_date |
172
|
|
|
|
|
|
|
{ |
173
|
520
|
|
|
520
|
0
|
10314
|
my($cache, $t1) = @_; |
174
|
|
|
|
|
|
|
|
175
|
520
|
50
|
|
|
|
959
|
print STDERR '#=== french_date() action: ', Dumper($t1) if ($verbose); |
176
|
|
|
|
|
|
|
|
177
|
520
|
|
|
|
|
488
|
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
|
|
|
|
1020
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
185
|
|
|
|
|
|
|
{ |
186
|
433
|
|
|
|
|
509
|
$year = $$t1[0]; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
189
|
|
|
|
|
|
|
{ |
190
|
|
|
|
|
|
|
# First check for BCE. |
191
|
|
|
|
|
|
|
|
192
|
67
|
100
|
|
|
|
205
|
if ($$t1[1] =~ /[0-9]/) |
193
|
|
|
|
|
|
|
{ |
194
|
22
|
|
|
|
|
26
|
$month = $$t1[0]; |
195
|
22
|
|
|
|
|
31
|
$year = $$t1[1]; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
else |
198
|
|
|
|
|
|
|
{ |
199
|
45
|
|
|
|
|
52
|
$bce = $$t1[1]; |
200
|
45
|
|
|
|
|
67
|
$year = $$t1[0]; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
else |
204
|
|
|
|
|
|
|
{ |
205
|
20
|
|
|
|
|
27
|
$day = $$t1[0]; |
206
|
20
|
|
|
|
|
22
|
$month = $$t1[1]; |
207
|
20
|
|
|
|
|
26
|
$year = $$t1[2]; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
520
|
|
|
|
|
1310
|
my($result) = |
211
|
|
|
|
|
|
|
{ |
212
|
|
|
|
|
|
|
kind => 'Date', |
213
|
|
|
|
|
|
|
type => 'French r', |
214
|
|
|
|
|
|
|
year => $year, |
215
|
|
|
|
|
|
|
}; |
216
|
|
|
|
|
|
|
|
217
|
520
|
100
|
|
|
|
934
|
$$result{bce} = $bce if (defined $bce); |
218
|
520
|
100
|
|
|
|
802
|
$$result{day} = $day if (defined $day); |
219
|
520
|
100
|
|
|
|
735
|
$$result{month} = $month if (defined $month); |
220
|
520
|
|
|
|
|
680
|
$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
|
6641
|
my($cache, $t1, $t2) = @_; |
231
|
|
|
|
|
|
|
|
232
|
333
|
50
|
|
|
|
524
|
print STDERR '#=== from_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
233
|
|
|
|
|
|
|
|
234
|
333
|
|
|
|
|
330
|
my($t3) = $$t2[0]; |
235
|
333
|
|
|
|
|
292
|
$t2 = $$t2[1]; |
236
|
333
|
100
|
|
|
|
595
|
$t2 = $$t2[0] if (ref $t2 eq 'ARRAY'); |
237
|
333
|
|
|
|
|
361
|
$$t2{flag} = 'FROM'; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
# Is there a calendar hash present? |
240
|
|
|
|
|
|
|
|
241
|
333
|
100
|
|
|
|
544
|
if (ref $t3 eq 'HASH') |
242
|
|
|
|
|
|
|
{ |
243
|
187
|
|
|
|
|
220
|
$t2 = [$t3, $t2]; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
333
|
|
|
|
|
543
|
return $t2; |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
} # End of from_date. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# ------------------------------------------------ |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub german_date |
253
|
|
|
|
|
|
|
{ |
254
|
478
|
|
|
478
|
0
|
9363
|
my($cache, $t1) = @_; |
255
|
|
|
|
|
|
|
|
256
|
478
|
50
|
|
|
|
859
|
print STDERR '#=== german_date() action: ', Dumper($t1) if ($verbose); |
257
|
|
|
|
|
|
|
|
258
|
478
|
|
|
|
|
465
|
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
|
|
|
|
943
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
266
|
|
|
|
|
|
|
{ |
267
|
440
|
|
|
|
|
517
|
$year = $$t1[0][0]; |
268
|
440
|
|
|
|
|
497
|
$bce = $$t1[0][1]; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
elsif ($#$t1 == 2) |
271
|
|
|
|
|
|
|
{ |
272
|
20
|
|
|
|
|
35
|
$month = $$t1[0]; |
273
|
20
|
|
|
|
|
28
|
$year = $$t1[2][0]; |
274
|
20
|
|
|
|
|
24
|
$bce = $$t1[2][1]; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
else |
277
|
|
|
|
|
|
|
{ |
278
|
18
|
|
|
|
|
27
|
$day = $$t1[0]; |
279
|
18
|
|
|
|
|
25
|
$month = $$t1[2]; |
280
|
18
|
|
|
|
|
23
|
$year = $$t1[4][0]; |
281
|
18
|
|
|
|
|
24
|
$bce = $$t1[4][1]; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
478
|
|
|
|
|
1256
|
my($result) = |
285
|
|
|
|
|
|
|
{ |
286
|
|
|
|
|
|
|
kind => 'Date', |
287
|
|
|
|
|
|
|
type => 'German', |
288
|
|
|
|
|
|
|
year => $year, |
289
|
|
|
|
|
|
|
}; |
290
|
|
|
|
|
|
|
|
291
|
478
|
100
|
|
|
|
805
|
$$result{bce} = $bce if (defined $bce); |
292
|
478
|
100
|
|
|
|
828
|
$$result{day} = $day if (defined $day); |
293
|
478
|
100
|
|
|
|
694
|
$$result{month} = $month if (defined $month); |
294
|
478
|
|
|
|
|
685
|
$result = [$result]; |
295
|
|
|
|
|
|
|
|
296
|
478
|
|
|
|
|
742
|
return $result; |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
} # End of german_date. |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
# ------------------------------------------------ |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub gregorian_date |
303
|
|
|
|
|
|
|
{ |
304
|
678
|
|
|
678
|
0
|
13527
|
my($cache, $t1) = @_; |
305
|
|
|
|
|
|
|
|
306
|
678
|
50
|
|
|
|
1183
|
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
|
|
|
|
1352
|
if (ref($$t1[0]) eq 'HASH') |
311
|
|
|
|
|
|
|
{ |
312
|
47
|
|
|
|
|
94
|
return $$t1[0]; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
631
|
|
|
|
|
717
|
my($day); |
316
|
|
|
|
|
|
|
my($month); |
317
|
0
|
|
|
|
|
0
|
my($year); |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
# Check for year, month, day. |
320
|
|
|
|
|
|
|
|
321
|
631
|
100
|
|
|
|
1174
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
322
|
|
|
|
|
|
|
{ |
323
|
572
|
|
|
|
|
621
|
$year = $$t1[0]; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
326
|
|
|
|
|
|
|
{ |
327
|
30
|
|
|
|
|
36
|
$month = $$t1[0]; |
328
|
30
|
|
|
|
|
41
|
$year = $$t1[1]; |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
else |
331
|
|
|
|
|
|
|
{ |
332
|
29
|
|
|
|
|
34
|
$day = $$t1[0]; |
333
|
29
|
|
|
|
|
33
|
$month = $$t1[1]; |
334
|
29
|
|
|
|
|
32
|
$year = $$t1[2]; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
|
337
|
631
|
|
|
|
|
1577
|
my($result) = |
338
|
|
|
|
|
|
|
{ |
339
|
|
|
|
|
|
|
kind => 'Date', |
340
|
|
|
|
|
|
|
type => 'Gregorian', |
341
|
|
|
|
|
|
|
year => $year, |
342
|
|
|
|
|
|
|
}; |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
# Check for /00. |
345
|
|
|
|
|
|
|
|
346
|
631
|
100
|
|
|
|
1458
|
if ($year =~ m|/|) |
347
|
|
|
|
|
|
|
{ |
348
|
143
|
|
|
|
|
440
|
($$result{year}, $$result{suffix}) = split(m|/|, $year); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
631
|
100
|
|
|
|
1071
|
$$result{month} = $month if (defined $month); |
352
|
631
|
100
|
|
|
|
955
|
$$result{day} = $day if (defined $day); |
353
|
631
|
|
|
|
|
818
|
$result = [$result]; |
354
|
|
|
|
|
|
|
|
355
|
631
|
|
|
|
|
1118
|
return $result; |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
} # End of gregorian_date. |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
# ------------------------------------------------ |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub gregorian_month |
362
|
|
|
|
|
|
|
{ |
363
|
59
|
|
|
59
|
0
|
34676
|
my($cache, $t1) = @_; |
364
|
|
|
|
|
|
|
|
365
|
59
|
50
|
|
|
|
122
|
print STDERR '#=== gregorian_month() action: ', Dumper($t1) if ($verbose); |
366
|
|
|
|
|
|
|
|
367
|
59
|
50
|
|
|
|
136
|
$t1 = $$t1[0] if (ref $t1); |
368
|
|
|
|
|
|
|
|
369
|
59
|
|
|
|
|
127
|
return $t1; |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
} # End of gregorian_month. |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
# ------------------------------------------------ |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
sub gregorian_year_bce |
376
|
|
|
|
|
|
|
{ |
377
|
47
|
|
|
47
|
0
|
1013
|
my($cache, $t1, $t2) = @_; |
378
|
|
|
|
|
|
|
|
379
|
47
|
50
|
|
|
|
105
|
print STDERR '#=== gregorian_year_bce() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
return |
382
|
|
|
|
|
|
|
{ |
383
|
47
|
|
|
|
|
215
|
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
|
10177
|
my($cache, $t1) = @_; |
396
|
|
|
|
|
|
|
|
397
|
516
|
50
|
|
|
|
896
|
print STDERR '#=== hebrew_date() action: ', Dumper($t1) if ($verbose); |
398
|
|
|
|
|
|
|
|
399
|
516
|
|
|
|
|
513
|
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
|
|
|
|
1027
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
407
|
|
|
|
|
|
|
{ |
408
|
433
|
|
|
|
|
530
|
$year = $$t1[0]; |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
411
|
|
|
|
|
|
|
{ |
412
|
|
|
|
|
|
|
# First check for BCE. |
413
|
|
|
|
|
|
|
|
414
|
65
|
100
|
|
|
|
226
|
if ($$t1[1] =~ /[0-9]/) |
415
|
|
|
|
|
|
|
{ |
416
|
20
|
|
|
|
|
23
|
$month = $$t1[0]; |
417
|
20
|
|
|
|
|
21
|
$year = $$t1[1]; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
else |
420
|
|
|
|
|
|
|
{ |
421
|
45
|
|
|
|
|
65
|
$bce = $$t1[1]; |
422
|
45
|
|
|
|
|
63
|
$year = $$t1[0]; |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
else |
426
|
|
|
|
|
|
|
{ |
427
|
18
|
|
|
|
|
21
|
$day = $$t1[0]; |
428
|
18
|
|
|
|
|
18
|
$month = $$t1[1]; |
429
|
18
|
|
|
|
|
19
|
$year = $$t1[2]; |
430
|
|
|
|
|
|
|
} |
431
|
|
|
|
|
|
|
|
432
|
516
|
|
|
|
|
1342
|
my($result) = |
433
|
|
|
|
|
|
|
{ |
434
|
|
|
|
|
|
|
kind => 'Date', |
435
|
|
|
|
|
|
|
type => 'Hebrew', |
436
|
|
|
|
|
|
|
year => $year, |
437
|
|
|
|
|
|
|
}; |
438
|
|
|
|
|
|
|
|
439
|
516
|
100
|
|
|
|
988
|
$$result{bce} = $bce if (defined $bce); |
440
|
516
|
100
|
|
|
|
780
|
$$result{day} = $day if (defined $day); |
441
|
516
|
100
|
|
|
|
730
|
$$result{month} = $month if (defined $month); |
442
|
516
|
|
|
|
|
598
|
$result = [$result]; |
443
|
|
|
|
|
|
|
|
444
|
516
|
|
|
|
|
879
|
return $result; |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
} # End of hebrew_date. |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
# ------------------------------------------------ |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub interpreted_date |
451
|
|
|
|
|
|
|
{ |
452
|
40
|
|
|
40
|
0
|
934
|
my($cache, $t1) = @_; |
453
|
|
|
|
|
|
|
|
454
|
40
|
50
|
|
|
|
75
|
print STDERR '#=== interpreted_date() action: ', Dumper($t1) if ($verbose); |
455
|
|
|
|
|
|
|
|
456
|
40
|
|
|
|
|
54
|
my($t2) = $$t1[1][1][0]; |
457
|
40
|
|
|
|
|
55
|
$$t2{flag} = 'INT'; |
458
|
40
|
|
|
|
|
84
|
$$t2{phrase} = "($$t1[2][0])"; |
459
|
|
|
|
|
|
|
|
460
|
40
|
|
|
|
|
85
|
return [$$t1[1][0], $t2]; |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
} # End of interpreted_date. |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# ------------------------------------------------ |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
sub julian_date |
467
|
|
|
|
|
|
|
{ |
468
|
533
|
|
|
533
|
0
|
10349
|
my($cache, $t1) = @_; |
469
|
|
|
|
|
|
|
|
470
|
533
|
50
|
|
|
|
1010
|
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
|
|
|
|
1137
|
if (ref($$t1[0]) eq 'HASH') |
475
|
|
|
|
|
|
|
{ |
476
|
45
|
|
|
|
|
99
|
return $$t1[0]; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
488
|
|
|
|
|
468
|
my($day); |
480
|
|
|
|
|
|
|
my($month); |
481
|
0
|
|
|
|
|
0
|
my($year); |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
# Check for year, month, day. |
484
|
|
|
|
|
|
|
|
485
|
488
|
100
|
|
|
|
916
|
if ($#$t1 == 0) |
|
|
100
|
|
|
|
|
|
486
|
|
|
|
|
|
|
{ |
487
|
433
|
|
|
|
|
513
|
$year = $$t1[0]; |
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
elsif ($#$t1 == 1) |
490
|
|
|
|
|
|
|
{ |
491
|
28
|
|
|
|
|
40
|
$month = $$t1[0]; |
492
|
28
|
|
|
|
|
34
|
$year = $$t1[1]; |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
else |
495
|
|
|
|
|
|
|
{ |
496
|
27
|
|
|
|
|
57
|
$day = $$t1[0]; |
497
|
27
|
|
|
|
|
33
|
$month = $$t1[1]; |
498
|
27
|
|
|
|
|
37
|
$year = $$t1[2]; |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
|
501
|
488
|
|
|
|
|
1257
|
my($result) = |
502
|
|
|
|
|
|
|
{ |
503
|
|
|
|
|
|
|
kind => 'Date', |
504
|
|
|
|
|
|
|
type => 'Julian', |
505
|
|
|
|
|
|
|
year => $year, |
506
|
|
|
|
|
|
|
}; |
507
|
|
|
|
|
|
|
|
508
|
488
|
100
|
|
|
|
856
|
$$result{month} = $month if (defined $month); |
509
|
488
|
100
|
|
|
|
748
|
$$result{day} = $day if (defined $day); |
510
|
488
|
|
|
|
|
564
|
$result = [$result]; |
511
|
|
|
|
|
|
|
|
512
|
488
|
|
|
|
|
755
|
return $result; |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
} # End of julian_date. |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
# ------------------------------------------------ |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub julian_year_bce |
519
|
|
|
|
|
|
|
{ |
520
|
45
|
|
|
45
|
0
|
923
|
my($cache, $t1, $t2) = @_; |
521
|
|
|
|
|
|
|
|
522
|
45
|
50
|
|
|
|
109
|
print STDERR '#=== julian_year_bce() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
return |
525
|
|
|
|
|
|
|
{ |
526
|
45
|
|
|
|
|
170
|
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
|
6200
|
my($cache, $t1, $t2) = @_; |
539
|
|
|
|
|
|
|
|
540
|
320
|
50
|
|
|
|
510
|
print STDERR '#=== to_date() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
541
|
|
|
|
|
|
|
|
542
|
320
|
|
|
|
|
311
|
my($t3) = $$t2[0]; |
543
|
320
|
|
|
|
|
302
|
$t2 = $$t2[1]; |
544
|
320
|
100
|
|
|
|
538
|
$t2 = $$t2[0] if (ref $t2 eq 'ARRAY'); |
545
|
320
|
|
|
|
|
340
|
$$t2{flag} = 'TO'; |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
# Is there a calendar hash present? |
548
|
|
|
|
|
|
|
|
549
|
320
|
100
|
|
|
|
474
|
if (ref $t3 eq 'HASH') |
550
|
|
|
|
|
|
|
{ |
551
|
228
|
|
|
|
|
304
|
$t2 = [$t3, $t2]; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
320
|
|
|
|
|
457
|
return $t2; |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
} # End of to_date. |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
# ------------------------------------------------ |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
sub year |
561
|
|
|
|
|
|
|
{ |
562
|
2725
|
|
|
2725
|
0
|
1553839
|
my($cache, $t1, $t2) = @_; |
563
|
|
|
|
|
|
|
|
564
|
2725
|
50
|
|
|
|
4560
|
print STDERR '#=== year() action: ', Dumper($t1), Dumper($t2) if ($verbose); |
565
|
|
|
|
|
|
|
|
566
|
2725
|
100
|
|
|
|
4103
|
$t1 = "$t1/$t2" if (defined $t2); |
567
|
|
|
|
|
|
|
|
568
|
2725
|
|
|
|
|
4564
|
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 |