home_run 0.9.0-x86-mingw32 → 0.9.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +46 -0
- data/README.rdoc +45 -33
- data/Rakefile +26 -67
- data/bench/cpu_bench.rb +1 -54
- data/bench/cpu_bench_util.rb +55 -0
- data/bench/parser_bench.rb +20 -0
- data/bin/home_run +14 -17
- data/default.mspec +1 -1
- data/ext/{date_ext.c → date_ext/date_ext.c} +95 -208
- data/ext/date_ext/date_ext.h +187 -0
- data/ext/date_ext/date_parser.c +852 -0
- data/ext/date_ext/date_parser.rl +352 -0
- data/ext/{datetime.c → date_ext/datetime.c} +120 -77
- data/ext/date_ext/extconf.rb +6 -0
- data/lib/1.8/date_ext.so +0 -0
- data/lib/1.9/date_ext.so +0 -0
- data/{ext → lib}/date/format.rb +1 -1
- data/lib/date.rb +7 -0
- data/lib/home_run.rb +5 -0
- data/spec/date/allocate_spec.rb +7 -0
- data/spec/date/encoding_spec.rb +42 -0
- data/spec/date/limits_spec.rb +121 -0
- data/spec/date/parse_spec.rb +154 -0
- data/spec/date/parsing_spec.rb +11 -0
- data/spec/date/step_spec.rb +22 -0
- data/spec/date/strptime_spec.rb +35 -3
- data/spec/datetime/add_spec.rb +4 -4
- data/spec/datetime/allocate_spec.rb +7 -0
- data/spec/datetime/encoding_spec.rb +42 -0
- data/spec/datetime/limits_spec.rb +170 -0
- data/spec/datetime/parse_spec.rb +73 -0
- data/spec/datetime/parsing_spec.rb +4 -0
- data/spec/datetime/step_spec.rb +22 -0
- data/spec/datetime/strptime_spec.rb +10 -0
- metadata +24 -14
- data/ext/1.8/date_ext.so +0 -0
- data/ext/1.9/date_ext.so +0 -0
- data/ext/date.rb +0 -7
- data/ext/date_parser.c +0 -367
- data/ext/date_parser.rl +0 -134
- data/ext/extconf.rb +0 -6
@@ -0,0 +1,852 @@
|
|
1
|
+
|
2
|
+
#line 1 "date_parser.rl"
|
3
|
+
#include "date_ext.h"
|
4
|
+
|
5
|
+
#define RHRR_ISO_PARSER 0x1
|
6
|
+
#define RHRR_RFC_PARSER 0x2
|
7
|
+
#define RHRR_CLF_PARSER 0x4
|
8
|
+
|
9
|
+
#define RHRR_ISO_TIME_SET 0x1
|
10
|
+
#define RHRR_ISO_ZONE_SET 0x2
|
11
|
+
|
12
|
+
#define RHRR_RFC_TIME_SET 0x1
|
13
|
+
#define RHRR_RFC_ZONE_SET 0x2
|
14
|
+
#define RHRR_RFC_ZONE_NUM_SET 0x4
|
15
|
+
#define RHRR_RFC_ZONE_NAME_SET 0x8
|
16
|
+
|
17
|
+
#define RHRR_CLF_TIME_SET 0x1
|
18
|
+
#define RHRR_CLF_ZONE_SET 0x2
|
19
|
+
|
20
|
+
#define RHRR_BAD_OFFSET 86400
|
21
|
+
|
22
|
+
extern const char * rhrd__abbr_month_names[];
|
23
|
+
extern const char * rhrd__abbr_day_names[];
|
24
|
+
|
25
|
+
extern VALUE rhrd_sym_hour;
|
26
|
+
extern VALUE rhrd_sym_mday;
|
27
|
+
extern VALUE rhrd_sym_min;
|
28
|
+
extern VALUE rhrd_sym_mon;
|
29
|
+
extern VALUE rhrd_sym_offset;
|
30
|
+
extern VALUE rhrd_sym_sec;
|
31
|
+
extern VALUE rhrd_sym_wday;
|
32
|
+
extern VALUE rhrd_sym_year;
|
33
|
+
extern VALUE rhrd_sym_zone;
|
34
|
+
|
35
|
+
const char * rhrd__rfc_zone_names[] = {"UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT",
|
36
|
+
"A", "B", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M",
|
37
|
+
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
|
38
|
+
long rhrd__rfc_zone_offsets[] = {0, 0, -18000, -14400, -21600, -18000, -25200, -21600, -28800, -25200,
|
39
|
+
3600, 7200, 10800, 14400, 18000, 21600, 25200, 28800, 32400, 36000, 39600, 43200,
|
40
|
+
-3600, -7200, -10800, -14400, -18000, -21600, -25200, -28800, -32400, -36000, -39600, -43200, 0};
|
41
|
+
|
42
|
+
long rhrd__rfc_zone_offset(char * str) {
|
43
|
+
int i;
|
44
|
+
|
45
|
+
for(i = 0; i < 36; i++) {
|
46
|
+
if(strcasecmp(rhrd__rfc_zone_names[i], str) == 0) {
|
47
|
+
return rhrd__rfc_zone_offsets[i];
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
return RHRR_BAD_OFFSET;
|
52
|
+
}
|
53
|
+
|
54
|
+
long rhrd__month_num(char * str) {
|
55
|
+
int i;
|
56
|
+
|
57
|
+
for(i = 1; i < 13; i++) {
|
58
|
+
if(strncasecmp(str, rhrd__abbr_month_names[i], 3) == 0) {
|
59
|
+
return i;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
return atol(str);
|
64
|
+
}
|
65
|
+
|
66
|
+
long rhrd__weekday_num(char * str) {
|
67
|
+
int i;
|
68
|
+
|
69
|
+
for(i = 0; i < 7; i++) {
|
70
|
+
if(strncasecmp(str, rhrd__abbr_day_names[i], 3) == 0) {
|
71
|
+
return i;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
return 7;
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
#line 80 "date_parser.c"
|
80
|
+
static const char _date_parser_actions[] = {
|
81
|
+
0, 1, 0, 1, 1, 1, 2, 1,
|
82
|
+
3, 1, 4, 1, 5, 1, 6, 1,
|
83
|
+
7, 1, 9, 1, 10, 1, 11, 1,
|
84
|
+
12, 1, 13, 1, 14, 1, 15, 1,
|
85
|
+
16, 1, 17, 1, 18, 1, 21, 1,
|
86
|
+
23, 1, 24, 1, 25, 1, 26, 1,
|
87
|
+
27, 1, 28, 1, 29, 1, 31, 2,
|
88
|
+
0, 22, 2, 7, 9, 2, 8, 7,
|
89
|
+
2, 18, 21, 2, 19, 18, 2, 20,
|
90
|
+
18, 2, 29, 31, 2, 30, 29, 3,
|
91
|
+
8, 7, 9, 3, 19, 18, 21, 3,
|
92
|
+
20, 18, 21, 3, 30, 29, 31
|
93
|
+
};
|
94
|
+
|
95
|
+
static const short _date_parser_key_offsets[] = {
|
96
|
+
0, 0, 20, 22, 24, 26, 28, 30,
|
97
|
+
32, 34, 36, 40, 42, 44, 45, 47,
|
98
|
+
49, 50, 52, 54, 56, 58, 59, 61,
|
99
|
+
63, 65, 68, 70, 72, 74, 77, 80,
|
100
|
+
96, 100, 102, 103, 106, 108, 110, 112,
|
101
|
+
114, 117, 119, 120, 122, 124, 125, 127,
|
102
|
+
129, 131, 133, 135, 137, 139, 141, 143,
|
103
|
+
145, 147, 149, 153, 155, 159, 161, 165,
|
104
|
+
167, 169, 171, 173, 175, 177, 179, 183,
|
105
|
+
185, 187, 188, 195, 204, 206, 225, 229,
|
106
|
+
231, 237, 239, 241, 243, 245, 247, 248,
|
107
|
+
250, 252, 253, 255, 257, 259, 261, 263,
|
108
|
+
265, 267, 269, 271, 273, 275, 277, 279,
|
109
|
+
283, 285, 289, 291, 295, 297, 299, 301,
|
110
|
+
303, 305, 307, 328, 349, 351, 353, 355,
|
111
|
+
357, 361, 363, 367, 369, 371, 373, 375,
|
112
|
+
380, 383, 389, 394, 397, 401, 404, 409,
|
113
|
+
414, 417, 423, 448, 473, 476, 479, 482,
|
114
|
+
489, 494
|
115
|
+
};
|
116
|
+
|
117
|
+
static const char _date_parser_trans_keys[] = {
|
118
|
+
32, 45, 48, 51, 70, 77, 83, 84,
|
119
|
+
87, 102, 109, 115, 116, 119, 9, 13,
|
120
|
+
49, 50, 52, 57, 48, 57, 48, 57,
|
121
|
+
48, 57, 48, 57, 45, 47, 48, 49,
|
122
|
+
49, 57, 45, 47, 48, 51, 49, 50,
|
123
|
+
49, 57, 48, 57, 58, 48, 53, 48,
|
124
|
+
57, 58, 48, 53, 48, 57, 48, 57,
|
125
|
+
48, 57, 58, 48, 57, 48, 57, 48,
|
126
|
+
52, 50, 48, 49, 48, 57, 48, 49,
|
127
|
+
48, 50, 48, 49, 57, 47, 48, 57,
|
128
|
+
65, 68, 70, 74, 77, 78, 79, 83,
|
129
|
+
97, 100, 102, 106, 109, 110, 111, 115,
|
130
|
+
80, 85, 112, 117, 82, 114, 47, 45,
|
131
|
+
48, 57, 48, 57, 48, 57, 48, 57,
|
132
|
+
48, 57, 50, 48, 49, 48, 57, 58,
|
133
|
+
48, 53, 48, 57, 58, 48, 53, 48,
|
134
|
+
57, 48, 57, 48, 57, 48, 57, 48,
|
135
|
+
57, 48, 52, 71, 103, 69, 101, 67,
|
136
|
+
99, 69, 101, 66, 98, 65, 85, 97,
|
137
|
+
117, 78, 110, 76, 78, 108, 110, 65,
|
138
|
+
97, 82, 89, 114, 121, 79, 111, 86,
|
139
|
+
118, 67, 99, 84, 116, 69, 101, 80,
|
140
|
+
112, 48, 57, 48, 49, 50, 57, 82,
|
141
|
+
114, 73, 105, 44, 32, 48, 51, 9,
|
142
|
+
13, 49, 50, 32, 48, 51, 9, 13,
|
143
|
+
49, 50, 52, 57, 49, 57, 32, 65,
|
144
|
+
68, 70, 74, 77, 78, 79, 83, 97,
|
145
|
+
100, 102, 106, 109, 110, 111, 115, 9,
|
146
|
+
13, 80, 85, 112, 117, 82, 114, 32,
|
147
|
+
45, 9, 13, 48, 57, 48, 57, 48,
|
148
|
+
57, 48, 57, 48, 57, 48, 57, 58,
|
149
|
+
48, 53, 48, 57, 58, 48, 53, 48,
|
150
|
+
57, 48, 57, 48, 57, 48, 57, 48,
|
151
|
+
57, 84, 116, 48, 52, 71, 103, 69,
|
152
|
+
101, 67, 99, 69, 101, 66, 98, 65,
|
153
|
+
85, 97, 117, 78, 110, 76, 78, 108,
|
154
|
+
110, 65, 97, 82, 89, 114, 121, 79,
|
155
|
+
111, 86, 118, 67, 99, 84, 116, 69,
|
156
|
+
101, 80, 112, 32, 65, 68, 70, 74,
|
157
|
+
77, 78, 79, 83, 97, 100, 102, 106,
|
158
|
+
109, 110, 111, 115, 9, 13, 48, 57,
|
159
|
+
32, 65, 68, 70, 74, 77, 78, 79,
|
160
|
+
83, 97, 100, 102, 106, 109, 110, 111,
|
161
|
+
115, 9, 13, 48, 49, 48, 57, 48,
|
162
|
+
49, 79, 111, 78, 110, 65, 85, 97,
|
163
|
+
117, 84, 116, 72, 85, 104, 117, 85,
|
164
|
+
117, 69, 101, 69, 101, 68, 100, 32,
|
165
|
+
84, 116, 9, 13, 32, 9, 13, 32,
|
166
|
+
50, 9, 13, 48, 49, 32, 43, 45,
|
167
|
+
9, 13, 32, 9, 13, 32, 58, 9,
|
168
|
+
13, 32, 9, 13, 32, 43, 45, 9,
|
169
|
+
13, 32, 43, 45, 9, 13, 32, 9,
|
170
|
+
13, 32, 50, 9, 13, 48, 49, 32,
|
171
|
+
43, 45, 67, 69, 71, 77, 80, 85,
|
172
|
+
99, 101, 103, 109, 112, 117, 9, 13,
|
173
|
+
65, 73, 75, 90, 97, 105, 107, 122,
|
174
|
+
32, 43, 45, 67, 69, 71, 77, 80,
|
175
|
+
85, 99, 101, 103, 109, 112, 117, 9,
|
176
|
+
13, 65, 73, 75, 90, 97, 105, 107,
|
177
|
+
122, 32, 9, 13, 32, 9, 13, 32,
|
178
|
+
9, 13, 32, 68, 83, 100, 115, 9,
|
179
|
+
13, 32, 77, 109, 9, 13, 32, 84,
|
180
|
+
116, 9, 13, 0
|
181
|
+
};
|
182
|
+
|
183
|
+
static const char _date_parser_single_lengths[] = {
|
184
|
+
0, 14, 0, 0, 0, 0, 2, 2,
|
185
|
+
0, 2, 2, 0, 0, 1, 0, 0,
|
186
|
+
1, 0, 0, 0, 0, 1, 0, 0,
|
187
|
+
0, 1, 0, 0, 0, 1, 1, 16,
|
188
|
+
4, 2, 1, 1, 0, 0, 0, 0,
|
189
|
+
1, 0, 1, 0, 0, 1, 0, 0,
|
190
|
+
0, 0, 0, 0, 0, 2, 2, 2,
|
191
|
+
2, 2, 4, 2, 4, 2, 4, 2,
|
192
|
+
2, 2, 2, 2, 2, 0, 0, 2,
|
193
|
+
2, 1, 3, 3, 0, 17, 4, 2,
|
194
|
+
2, 0, 0, 0, 0, 0, 1, 0,
|
195
|
+
0, 1, 0, 0, 0, 0, 0, 0,
|
196
|
+
2, 0, 2, 2, 2, 2, 2, 4,
|
197
|
+
2, 4, 2, 4, 2, 2, 2, 2,
|
198
|
+
2, 2, 17, 17, 0, 0, 2, 2,
|
199
|
+
4, 2, 4, 2, 2, 2, 2, 3,
|
200
|
+
1, 2, 3, 1, 2, 1, 3, 3,
|
201
|
+
1, 2, 15, 15, 1, 1, 1, 5,
|
202
|
+
3, 3
|
203
|
+
};
|
204
|
+
|
205
|
+
static const char _date_parser_range_lengths[] = {
|
206
|
+
0, 3, 1, 1, 1, 1, 0, 0,
|
207
|
+
1, 0, 1, 1, 1, 0, 1, 1,
|
208
|
+
0, 1, 1, 1, 1, 0, 1, 1,
|
209
|
+
1, 1, 1, 1, 1, 1, 1, 0,
|
210
|
+
0, 0, 0, 1, 1, 1, 1, 1,
|
211
|
+
1, 1, 0, 1, 1, 0, 1, 1,
|
212
|
+
1, 1, 1, 1, 1, 0, 0, 0,
|
213
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
214
|
+
0, 0, 0, 0, 0, 1, 2, 0,
|
215
|
+
0, 0, 2, 3, 1, 1, 0, 0,
|
216
|
+
2, 1, 1, 1, 1, 1, 0, 1,
|
217
|
+
1, 0, 1, 1, 1, 1, 1, 1,
|
218
|
+
0, 1, 0, 0, 0, 0, 0, 0,
|
219
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
220
|
+
0, 0, 2, 2, 1, 1, 0, 0,
|
221
|
+
0, 0, 0, 0, 0, 0, 0, 1,
|
222
|
+
1, 2, 1, 1, 1, 1, 1, 1,
|
223
|
+
1, 2, 5, 5, 1, 1, 1, 1,
|
224
|
+
1, 1
|
225
|
+
};
|
226
|
+
|
227
|
+
static const short _date_parser_index_offsets[] = {
|
228
|
+
0, 0, 18, 20, 22, 24, 26, 29,
|
229
|
+
32, 34, 37, 41, 43, 45, 47, 49,
|
230
|
+
51, 53, 55, 57, 59, 61, 63, 65,
|
231
|
+
67, 69, 72, 74, 76, 78, 81, 84,
|
232
|
+
101, 106, 109, 111, 114, 116, 118, 120,
|
233
|
+
122, 125, 127, 129, 131, 133, 135, 137,
|
234
|
+
139, 141, 143, 145, 147, 149, 152, 155,
|
235
|
+
158, 161, 164, 169, 172, 177, 180, 185,
|
236
|
+
188, 191, 194, 197, 200, 203, 205, 208,
|
237
|
+
211, 214, 216, 222, 229, 231, 250, 255,
|
238
|
+
258, 263, 265, 267, 269, 271, 273, 275,
|
239
|
+
277, 279, 281, 283, 285, 287, 289, 291,
|
240
|
+
293, 296, 298, 301, 304, 307, 310, 313,
|
241
|
+
318, 321, 326, 329, 334, 337, 340, 343,
|
242
|
+
346, 349, 352, 372, 392, 394, 396, 399,
|
243
|
+
402, 407, 410, 415, 418, 421, 424, 427,
|
244
|
+
432, 435, 440, 445, 448, 452, 455, 460,
|
245
|
+
465, 468, 473, 494, 515, 518, 521, 524,
|
246
|
+
531, 536
|
247
|
+
};
|
248
|
+
|
249
|
+
static const unsigned char _date_parser_indicies[] = {
|
250
|
+
0, 2, 3, 5, 7, 8, 9, 10,
|
251
|
+
11, 7, 8, 9, 10, 11, 0, 4,
|
252
|
+
6, 1, 12, 1, 13, 1, 14, 1,
|
253
|
+
15, 1, 16, 16, 1, 17, 18, 1,
|
254
|
+
19, 1, 20, 20, 1, 21, 23, 22,
|
255
|
+
1, 24, 1, 25, 1, 26, 1, 27,
|
256
|
+
1, 28, 1, 29, 1, 30, 1, 31,
|
257
|
+
1, 32, 1, 33, 1, 34, 1, 35,
|
258
|
+
1, 36, 1, 25, 1, 38, 37, 1,
|
259
|
+
24, 1, 24, 1, 19, 1, 13, 39,
|
260
|
+
1, 40, 14, 1, 41, 42, 43, 44,
|
261
|
+
45, 46, 47, 48, 41, 42, 43, 44,
|
262
|
+
45, 46, 47, 48, 1, 49, 50, 49,
|
263
|
+
50, 1, 51, 51, 1, 52, 1, 53,
|
264
|
+
54, 1, 55, 1, 56, 1, 57, 1,
|
265
|
+
58, 1, 60, 59, 1, 61, 1, 62,
|
266
|
+
1, 63, 1, 64, 1, 65, 1, 66,
|
267
|
+
1, 67, 1, 68, 1, 69, 1, 70,
|
268
|
+
1, 71, 1, 61, 1, 51, 51, 1,
|
269
|
+
72, 72, 1, 51, 51, 1, 73, 73,
|
270
|
+
1, 51, 51, 1, 74, 75, 74, 75,
|
271
|
+
1, 51, 51, 1, 51, 51, 51, 51,
|
272
|
+
1, 76, 76, 1, 51, 51, 51, 51,
|
273
|
+
1, 77, 77, 1, 51, 51, 1, 78,
|
274
|
+
78, 1, 51, 51, 1, 79, 79, 1,
|
275
|
+
51, 51, 1, 39, 1, 39, 13, 1,
|
276
|
+
80, 80, 1, 81, 81, 1, 82, 1,
|
277
|
+
83, 84, 86, 82, 85, 1, 83, 84,
|
278
|
+
88, 82, 87, 89, 1, 89, 1, 89,
|
279
|
+
90, 91, 92, 93, 94, 95, 96, 97,
|
280
|
+
90, 91, 92, 93, 94, 95, 96, 97,
|
281
|
+
89, 1, 98, 99, 98, 99, 1, 100,
|
282
|
+
100, 1, 100, 101, 100, 102, 1, 103,
|
283
|
+
1, 104, 1, 105, 1, 106, 1, 107,
|
284
|
+
1, 108, 1, 109, 1, 110, 1, 111,
|
285
|
+
1, 112, 1, 113, 1, 114, 1, 115,
|
286
|
+
1, 116, 1, 117, 1, 118, 118, 1,
|
287
|
+
107, 1, 100, 100, 1, 119, 119, 1,
|
288
|
+
100, 100, 1, 120, 120, 1, 100, 100,
|
289
|
+
1, 121, 122, 121, 122, 1, 100, 100,
|
290
|
+
1, 100, 100, 100, 100, 1, 123, 123,
|
291
|
+
1, 100, 100, 100, 100, 1, 124, 124,
|
292
|
+
1, 100, 100, 1, 125, 125, 1, 100,
|
293
|
+
100, 1, 126, 126, 1, 100, 100, 1,
|
294
|
+
89, 90, 91, 92, 93, 94, 95, 96,
|
295
|
+
97, 90, 91, 92, 93, 94, 95, 96,
|
296
|
+
97, 89, 89, 1, 89, 90, 91, 92,
|
297
|
+
93, 94, 95, 96, 97, 90, 91, 92,
|
298
|
+
93, 94, 95, 96, 97, 89, 89, 1,
|
299
|
+
89, 1, 89, 1, 127, 127, 1, 81,
|
300
|
+
81, 1, 128, 127, 128, 127, 1, 81,
|
301
|
+
81, 1, 129, 130, 129, 130, 1, 81,
|
302
|
+
81, 1, 81, 81, 1, 131, 131, 1,
|
303
|
+
81, 81, 1, 133, 134, 134, 132, 1,
|
304
|
+
132, 132, 1, 132, 38, 132, 37, 1,
|
305
|
+
135, 136, 136, 135, 1, 137, 137, 1,
|
306
|
+
138, 139, 138, 1, 138, 138, 1, 140,
|
307
|
+
141, 141, 140, 1, 142, 141, 141, 142,
|
308
|
+
1, 143, 143, 1, 106, 145, 106, 144,
|
309
|
+
1, 146, 147, 147, 149, 149, 150, 149,
|
310
|
+
149, 151, 149, 149, 150, 149, 149, 151,
|
311
|
+
146, 148, 148, 148, 148, 1, 152, 147,
|
312
|
+
147, 149, 149, 150, 149, 149, 151, 149,
|
313
|
+
149, 150, 149, 149, 151, 152, 148, 148,
|
314
|
+
148, 148, 1, 153, 153, 1, 154, 154,
|
315
|
+
1, 155, 155, 1, 155, 156, 156, 156,
|
316
|
+
156, 155, 1, 155, 156, 156, 155, 1,
|
317
|
+
155, 118, 118, 155, 1, 0
|
318
|
+
};
|
319
|
+
|
320
|
+
static const unsigned char _date_parser_trans_targs[] = {
|
321
|
+
1, 0, 2, 29, 69, 70, 3, 71,
|
322
|
+
118, 120, 122, 125, 3, 4, 5, 6,
|
323
|
+
7, 8, 28, 9, 10, 11, 26, 27,
|
324
|
+
127, 13, 14, 15, 16, 17, 18, 130,
|
325
|
+
20, 21, 22, 23, 131, 12, 24, 30,
|
326
|
+
31, 32, 54, 56, 58, 61, 63, 65,
|
327
|
+
67, 33, 53, 34, 35, 36, 37, 37,
|
328
|
+
38, 39, 132, 41, 52, 42, 43, 44,
|
329
|
+
45, 46, 47, 134, 49, 50, 51, 136,
|
330
|
+
55, 57, 59, 60, 62, 64, 66, 68,
|
331
|
+
72, 73, 74, 75, 76, 116, 117, 114,
|
332
|
+
115, 77, 78, 99, 101, 103, 106, 108,
|
333
|
+
110, 112, 79, 98, 80, 81, 82, 82,
|
334
|
+
83, 84, 137, 86, 87, 88, 89, 90,
|
335
|
+
91, 138, 93, 94, 95, 140, 142, 100,
|
336
|
+
102, 104, 105, 107, 109, 111, 113, 119,
|
337
|
+
121, 123, 124, 126, 128, 129, 25, 128,
|
338
|
+
19, 128, 133, 40, 135, 48, 135, 133,
|
339
|
+
85, 97, 139, 92, 142, 143, 144, 145,
|
340
|
+
139, 141, 141, 141, 96
|
341
|
+
};
|
342
|
+
|
343
|
+
static const char _date_parser_trans_actions[] = {
|
344
|
+
0, 0, 1, 55, 55, 55, 1, 19,
|
345
|
+
19, 19, 19, 19, 0, 0, 0, 0,
|
346
|
+
0, 3, 3, 0, 0, 5, 5, 5,
|
347
|
+
0, 0, 0, 9, 0, 0, 11, 0,
|
348
|
+
0, 0, 0, 0, 0, 7, 7, 0,
|
349
|
+
0, 39, 39, 39, 39, 39, 39, 39,
|
350
|
+
39, 0, 0, 0, 0, 41, 41, 0,
|
351
|
+
0, 0, 0, 43, 43, 0, 0, 45,
|
352
|
+
0, 0, 47, 0, 0, 0, 0, 0,
|
353
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
354
|
+
0, 0, 0, 21, 21, 21, 21, 21,
|
355
|
+
21, 0, 23, 23, 23, 23, 23, 23,
|
356
|
+
23, 23, 0, 0, 0, 25, 25, 0,
|
357
|
+
0, 0, 0, 0, 0, 29, 0, 0,
|
358
|
+
31, 0, 0, 0, 0, 0, 0, 0,
|
359
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
360
|
+
0, 0, 0, 0, 0, 0, 0, 15,
|
361
|
+
13, 61, 0, 0, 51, 49, 0, 76,
|
362
|
+
27, 27, 35, 33, 33, 33, 33, 33,
|
363
|
+
0, 67, 0, 70, 0
|
364
|
+
};
|
365
|
+
|
366
|
+
static const char _date_parser_eof_actions[] = {
|
367
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
368
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
369
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
370
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
371
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
372
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
373
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
374
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
375
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
376
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
377
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
378
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
379
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
380
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
381
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
382
|
+
0, 0, 0, 0, 0, 0, 0, 17,
|
383
|
+
17, 17, 58, 79, 53, 53, 73, 53,
|
384
|
+
91, 37, 64, 37, 83, 37, 87, 87,
|
385
|
+
87, 87
|
386
|
+
};
|
387
|
+
|
388
|
+
static const int date_parser_start = 1;
|
389
|
+
static const int date_parser_first_final = 127;
|
390
|
+
static const int date_parser_error = 0;
|
391
|
+
|
392
|
+
static const int date_parser_en_main = 1;
|
393
|
+
|
394
|
+
|
395
|
+
#line 181 "date_parser.rl"
|
396
|
+
|
397
|
+
|
398
|
+
VALUE rhrd__ragel_parse(char * p, long len) {
|
399
|
+
VALUE hash;
|
400
|
+
long state = 0;
|
401
|
+
long parsers = 0;
|
402
|
+
|
403
|
+
long year = 0;
|
404
|
+
long month = 0;
|
405
|
+
long day = 0;
|
406
|
+
long wday = 0;
|
407
|
+
|
408
|
+
long hour = 0;
|
409
|
+
long minute = 0;
|
410
|
+
long second = 0;
|
411
|
+
|
412
|
+
VALUE rzone;
|
413
|
+
char * zone = NULL;
|
414
|
+
long zone_len = 0;
|
415
|
+
long offset = 0;
|
416
|
+
|
417
|
+
long iso_state = 0;
|
418
|
+
char * t_iso_year = NULL;
|
419
|
+
char * t_iso_month = NULL;
|
420
|
+
char * t_iso_day = NULL;
|
421
|
+
char * t_iso_hour= NULL;
|
422
|
+
char * t_iso_minute = NULL;
|
423
|
+
char * t_iso_second = NULL;
|
424
|
+
char * t_iso_zone = NULL;
|
425
|
+
char * t_iso_zone_end = NULL;
|
426
|
+
|
427
|
+
long rfc_state = 0;
|
428
|
+
char * t_rfc_wday = NULL;
|
429
|
+
char * t_rfc_year = NULL;
|
430
|
+
char * t_rfc_month = NULL;
|
431
|
+
char * t_rfc_day = NULL;
|
432
|
+
char * t_rfc_hour= NULL;
|
433
|
+
char * t_rfc_minute = NULL;
|
434
|
+
char * t_rfc_second = NULL;
|
435
|
+
char * t_rfc_zone = NULL;
|
436
|
+
char * t_rfc_zone_end = NULL;
|
437
|
+
|
438
|
+
long clf_state = 0;
|
439
|
+
char * t_clf_year = NULL;
|
440
|
+
char * t_clf_month = NULL;
|
441
|
+
char * t_clf_day = NULL;
|
442
|
+
char * t_clf_hour= NULL;
|
443
|
+
char * t_clf_minute = NULL;
|
444
|
+
char * t_clf_second = NULL;
|
445
|
+
char * t_clf_zone = NULL;
|
446
|
+
char * t_clf_zone_end = NULL;
|
447
|
+
|
448
|
+
int cs = 0;
|
449
|
+
char * eof;
|
450
|
+
char * pe;
|
451
|
+
pe = p + len;
|
452
|
+
eof = pe;
|
453
|
+
|
454
|
+
|
455
|
+
#line 456 "date_parser.c"
|
456
|
+
{
|
457
|
+
cs = date_parser_start;
|
458
|
+
}
|
459
|
+
|
460
|
+
#line 240 "date_parser.rl"
|
461
|
+
|
462
|
+
#line 463 "date_parser.c"
|
463
|
+
{
|
464
|
+
int _klen;
|
465
|
+
unsigned int _trans;
|
466
|
+
const char *_acts;
|
467
|
+
unsigned int _nacts;
|
468
|
+
const char *_keys;
|
469
|
+
|
470
|
+
if ( p == pe )
|
471
|
+
goto _test_eof;
|
472
|
+
if ( cs == 0 )
|
473
|
+
goto _out;
|
474
|
+
_resume:
|
475
|
+
_keys = _date_parser_trans_keys + _date_parser_key_offsets[cs];
|
476
|
+
_trans = _date_parser_index_offsets[cs];
|
477
|
+
|
478
|
+
_klen = _date_parser_single_lengths[cs];
|
479
|
+
if ( _klen > 0 ) {
|
480
|
+
const char *_lower = _keys;
|
481
|
+
const char *_mid;
|
482
|
+
const char *_upper = _keys + _klen - 1;
|
483
|
+
while (1) {
|
484
|
+
if ( _upper < _lower )
|
485
|
+
break;
|
486
|
+
|
487
|
+
_mid = _lower + ((_upper-_lower) >> 1);
|
488
|
+
if ( (*p) < *_mid )
|
489
|
+
_upper = _mid - 1;
|
490
|
+
else if ( (*p) > *_mid )
|
491
|
+
_lower = _mid + 1;
|
492
|
+
else {
|
493
|
+
_trans += (_mid - _keys);
|
494
|
+
goto _match;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
_keys += _klen;
|
498
|
+
_trans += _klen;
|
499
|
+
}
|
500
|
+
|
501
|
+
_klen = _date_parser_range_lengths[cs];
|
502
|
+
if ( _klen > 0 ) {
|
503
|
+
const char *_lower = _keys;
|
504
|
+
const char *_mid;
|
505
|
+
const char *_upper = _keys + (_klen<<1) - 2;
|
506
|
+
while (1) {
|
507
|
+
if ( _upper < _lower )
|
508
|
+
break;
|
509
|
+
|
510
|
+
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
|
511
|
+
if ( (*p) < _mid[0] )
|
512
|
+
_upper = _mid - 2;
|
513
|
+
else if ( (*p) > _mid[1] )
|
514
|
+
_lower = _mid + 2;
|
515
|
+
else {
|
516
|
+
_trans += ((_mid - _keys)>>1);
|
517
|
+
goto _match;
|
518
|
+
}
|
519
|
+
}
|
520
|
+
_trans += _klen;
|
521
|
+
}
|
522
|
+
|
523
|
+
_match:
|
524
|
+
_trans = _date_parser_indicies[_trans];
|
525
|
+
cs = _date_parser_trans_targs[_trans];
|
526
|
+
|
527
|
+
if ( _date_parser_trans_actions[_trans] == 0 )
|
528
|
+
goto _again;
|
529
|
+
|
530
|
+
_acts = _date_parser_actions + _date_parser_trans_actions[_trans];
|
531
|
+
_nacts = (unsigned int) *_acts++;
|
532
|
+
while ( _nacts-- > 0 )
|
533
|
+
{
|
534
|
+
switch ( *_acts++ )
|
535
|
+
{
|
536
|
+
case 0:
|
537
|
+
#line 85 "date_parser.rl"
|
538
|
+
{ t_iso_year = p; }
|
539
|
+
break;
|
540
|
+
case 1:
|
541
|
+
#line 86 "date_parser.rl"
|
542
|
+
{ t_iso_month = p; }
|
543
|
+
break;
|
544
|
+
case 2:
|
545
|
+
#line 87 "date_parser.rl"
|
546
|
+
{ t_iso_day = p; }
|
547
|
+
break;
|
548
|
+
case 3:
|
549
|
+
#line 88 "date_parser.rl"
|
550
|
+
{ t_iso_hour = p; }
|
551
|
+
break;
|
552
|
+
case 4:
|
553
|
+
#line 89 "date_parser.rl"
|
554
|
+
{ t_iso_minute = p; }
|
555
|
+
break;
|
556
|
+
case 5:
|
557
|
+
#line 90 "date_parser.rl"
|
558
|
+
{ t_iso_second = p; }
|
559
|
+
break;
|
560
|
+
case 6:
|
561
|
+
#line 91 "date_parser.rl"
|
562
|
+
{ t_iso_zone = p; }
|
563
|
+
break;
|
564
|
+
case 7:
|
565
|
+
#line 93 "date_parser.rl"
|
566
|
+
{ iso_state |= RHRR_ISO_TIME_SET; }
|
567
|
+
break;
|
568
|
+
case 8:
|
569
|
+
#line 94 "date_parser.rl"
|
570
|
+
{
|
571
|
+
t_iso_zone_end = p;
|
572
|
+
iso_state |= RHRR_ISO_ZONE_SET;
|
573
|
+
}
|
574
|
+
break;
|
575
|
+
case 10:
|
576
|
+
#line 114 "date_parser.rl"
|
577
|
+
{ t_rfc_wday = p; }
|
578
|
+
break;
|
579
|
+
case 11:
|
580
|
+
#line 115 "date_parser.rl"
|
581
|
+
{ t_rfc_day = p; }
|
582
|
+
break;
|
583
|
+
case 12:
|
584
|
+
#line 116 "date_parser.rl"
|
585
|
+
{ t_rfc_month = p; }
|
586
|
+
break;
|
587
|
+
case 13:
|
588
|
+
#line 117 "date_parser.rl"
|
589
|
+
{ t_rfc_year = p; }
|
590
|
+
break;
|
591
|
+
case 14:
|
592
|
+
#line 118 "date_parser.rl"
|
593
|
+
{ t_rfc_hour = p; }
|
594
|
+
break;
|
595
|
+
case 15:
|
596
|
+
#line 119 "date_parser.rl"
|
597
|
+
{ t_rfc_minute = p; }
|
598
|
+
break;
|
599
|
+
case 16:
|
600
|
+
#line 120 "date_parser.rl"
|
601
|
+
{ t_rfc_second = p; }
|
602
|
+
break;
|
603
|
+
case 17:
|
604
|
+
#line 121 "date_parser.rl"
|
605
|
+
{ t_rfc_zone = p; }
|
606
|
+
break;
|
607
|
+
case 18:
|
608
|
+
#line 123 "date_parser.rl"
|
609
|
+
{ rfc_state |= RHRR_RFC_TIME_SET; }
|
610
|
+
break;
|
611
|
+
case 19:
|
612
|
+
#line 124 "date_parser.rl"
|
613
|
+
{
|
614
|
+
t_rfc_zone_end = p;
|
615
|
+
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NUM_SET;
|
616
|
+
}
|
617
|
+
break;
|
618
|
+
case 20:
|
619
|
+
#line 128 "date_parser.rl"
|
620
|
+
{
|
621
|
+
t_rfc_zone_end = p;
|
622
|
+
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NAME_SET;
|
623
|
+
}
|
624
|
+
break;
|
625
|
+
case 22:
|
626
|
+
#line 151 "date_parser.rl"
|
627
|
+
{ t_clf_day = p; }
|
628
|
+
break;
|
629
|
+
case 23:
|
630
|
+
#line 152 "date_parser.rl"
|
631
|
+
{ t_clf_month = p; }
|
632
|
+
break;
|
633
|
+
case 24:
|
634
|
+
#line 153 "date_parser.rl"
|
635
|
+
{ t_clf_year = p; }
|
636
|
+
break;
|
637
|
+
case 25:
|
638
|
+
#line 154 "date_parser.rl"
|
639
|
+
{ t_clf_hour = p; }
|
640
|
+
break;
|
641
|
+
case 26:
|
642
|
+
#line 155 "date_parser.rl"
|
643
|
+
{ t_clf_minute = p; }
|
644
|
+
break;
|
645
|
+
case 27:
|
646
|
+
#line 156 "date_parser.rl"
|
647
|
+
{ t_clf_second = p; }
|
648
|
+
break;
|
649
|
+
case 28:
|
650
|
+
#line 157 "date_parser.rl"
|
651
|
+
{ t_clf_zone = p; }
|
652
|
+
break;
|
653
|
+
case 29:
|
654
|
+
#line 159 "date_parser.rl"
|
655
|
+
{ clf_state |= RHRR_CLF_TIME_SET; }
|
656
|
+
break;
|
657
|
+
case 30:
|
658
|
+
#line 160 "date_parser.rl"
|
659
|
+
{
|
660
|
+
t_clf_zone_end = p;
|
661
|
+
clf_state |= RHRR_CLF_ZONE_SET;
|
662
|
+
}
|
663
|
+
break;
|
664
|
+
#line 665 "date_parser.c"
|
665
|
+
}
|
666
|
+
}
|
667
|
+
|
668
|
+
_again:
|
669
|
+
if ( cs == 0 )
|
670
|
+
goto _out;
|
671
|
+
if ( ++p != pe )
|
672
|
+
goto _resume;
|
673
|
+
_test_eof: {}
|
674
|
+
if ( p == eof )
|
675
|
+
{
|
676
|
+
const char *__acts = _date_parser_actions + _date_parser_eof_actions[cs];
|
677
|
+
unsigned int __nacts = (unsigned int) *__acts++;
|
678
|
+
while ( __nacts-- > 0 ) {
|
679
|
+
switch ( *__acts++ ) {
|
680
|
+
case 7:
|
681
|
+
#line 93 "date_parser.rl"
|
682
|
+
{ iso_state |= RHRR_ISO_TIME_SET; }
|
683
|
+
break;
|
684
|
+
case 8:
|
685
|
+
#line 94 "date_parser.rl"
|
686
|
+
{
|
687
|
+
t_iso_zone_end = p;
|
688
|
+
iso_state |= RHRR_ISO_ZONE_SET;
|
689
|
+
}
|
690
|
+
break;
|
691
|
+
case 9:
|
692
|
+
#line 98 "date_parser.rl"
|
693
|
+
{ parsers |= RHRR_ISO_PARSER; }
|
694
|
+
break;
|
695
|
+
case 18:
|
696
|
+
#line 123 "date_parser.rl"
|
697
|
+
{ rfc_state |= RHRR_RFC_TIME_SET; }
|
698
|
+
break;
|
699
|
+
case 19:
|
700
|
+
#line 124 "date_parser.rl"
|
701
|
+
{
|
702
|
+
t_rfc_zone_end = p;
|
703
|
+
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NUM_SET;
|
704
|
+
}
|
705
|
+
break;
|
706
|
+
case 20:
|
707
|
+
#line 128 "date_parser.rl"
|
708
|
+
{
|
709
|
+
t_rfc_zone_end = p;
|
710
|
+
rfc_state |= RHRR_RFC_ZONE_SET | RHRR_RFC_ZONE_NAME_SET;
|
711
|
+
}
|
712
|
+
break;
|
713
|
+
case 21:
|
714
|
+
#line 132 "date_parser.rl"
|
715
|
+
{ parsers |= RHRR_RFC_PARSER; }
|
716
|
+
break;
|
717
|
+
case 29:
|
718
|
+
#line 159 "date_parser.rl"
|
719
|
+
{ clf_state |= RHRR_CLF_TIME_SET; }
|
720
|
+
break;
|
721
|
+
case 30:
|
722
|
+
#line 160 "date_parser.rl"
|
723
|
+
{
|
724
|
+
t_clf_zone_end = p;
|
725
|
+
clf_state |= RHRR_CLF_ZONE_SET;
|
726
|
+
}
|
727
|
+
break;
|
728
|
+
case 31:
|
729
|
+
#line 164 "date_parser.rl"
|
730
|
+
{ parsers |= RHRR_CLF_PARSER; }
|
731
|
+
break;
|
732
|
+
#line 733 "date_parser.c"
|
733
|
+
}
|
734
|
+
}
|
735
|
+
}
|
736
|
+
|
737
|
+
_out: {}
|
738
|
+
}
|
739
|
+
|
740
|
+
#line 241 "date_parser.rl"
|
741
|
+
|
742
|
+
switch(parsers) {
|
743
|
+
case RHRR_ISO_PARSER:
|
744
|
+
year = atol(t_iso_year);
|
745
|
+
month = atol(t_iso_month);
|
746
|
+
day = atol(t_iso_day);
|
747
|
+
state |= RHRR_YEAR_SET | RHRR_MONTH_SET | RHRR_DAY_SET;
|
748
|
+
if (iso_state & RHRR_ISO_TIME_SET) {
|
749
|
+
hour = atol(t_iso_hour);
|
750
|
+
minute = atol(t_iso_minute);
|
751
|
+
second = atol(t_iso_second);
|
752
|
+
state |= RHRR_HOUR_SET | RHRR_MINUTE_SET | RHRR_SECOND_SET;
|
753
|
+
if (iso_state & RHRR_ISO_ZONE_SET) {
|
754
|
+
zone = t_iso_zone;
|
755
|
+
zone_len = t_iso_zone_end - zone;
|
756
|
+
offset = atol(zone) * 3600 + atol(zone + 4) * 60;
|
757
|
+
state |= RHRR_ZONE_SET | RHRR_OFFSET_SET;
|
758
|
+
}
|
759
|
+
}
|
760
|
+
break;
|
761
|
+
case RHRR_RFC_PARSER:
|
762
|
+
wday = rhrd__weekday_num(t_rfc_wday);
|
763
|
+
day = atol(t_rfc_day);
|
764
|
+
month = rhrd__month_num(t_rfc_month);
|
765
|
+
year = atol(t_rfc_year);
|
766
|
+
state |= RHRR_WDAY_SET | RHRR_YEAR_SET | RHRR_MONTH_SET | RHRR_DAY_SET;
|
767
|
+
if (rfc_state & RHRR_RFC_TIME_SET) {
|
768
|
+
hour = atol(t_rfc_hour);
|
769
|
+
minute = atol(t_rfc_minute);
|
770
|
+
second = atol(t_rfc_second);
|
771
|
+
state |= RHRR_HOUR_SET | RHRR_MINUTE_SET | RHRR_SECOND_SET;
|
772
|
+
if (rfc_state & RHRR_RFC_ZONE_SET) {
|
773
|
+
zone = t_rfc_zone;
|
774
|
+
zone_len = t_rfc_zone_end - zone;
|
775
|
+
state |= RHRR_ZONE_SET;
|
776
|
+
if (rfc_state & RHRR_RFC_ZONE_NUM_SET) {
|
777
|
+
offset = atol(zone);
|
778
|
+
offset = (offset/100) * 3600 + (labs(offset) % 100) * 60 * (offset < 0 ? -1 : 1);
|
779
|
+
state |= RHRR_OFFSET_SET;
|
780
|
+
} else if (rfc_state & RHRR_RFC_ZONE_NAME_SET) {
|
781
|
+
offset = rhrd__rfc_zone_offset(zone);
|
782
|
+
if (offset == RHRR_BAD_OFFSET) {
|
783
|
+
state = 0;
|
784
|
+
} else {
|
785
|
+
state |= RHRR_OFFSET_SET;
|
786
|
+
}
|
787
|
+
}
|
788
|
+
}
|
789
|
+
}
|
790
|
+
break;
|
791
|
+
case RHRR_CLF_PARSER:
|
792
|
+
year = atol(t_clf_year);
|
793
|
+
month = rhrd__month_num(t_clf_month);
|
794
|
+
day = atol(t_clf_day);
|
795
|
+
state |= RHRR_YEAR_SET | RHRR_MONTH_SET | RHRR_DAY_SET;
|
796
|
+
if (clf_state & RHRR_ISO_TIME_SET) {
|
797
|
+
hour = atol(t_clf_hour);
|
798
|
+
minute = atol(t_clf_minute);
|
799
|
+
second = atol(t_clf_second);
|
800
|
+
state |= RHRR_HOUR_SET | RHRR_MINUTE_SET | RHRR_SECOND_SET;
|
801
|
+
if (clf_state & RHRR_ISO_ZONE_SET) {
|
802
|
+
zone = t_clf_zone;
|
803
|
+
zone_len = t_clf_zone_end - zone;
|
804
|
+
offset = atol(zone);
|
805
|
+
offset = (offset/100) * 3600 + (labs(offset) % 100) * 60 * (offset < 0 ? -1 : 1);
|
806
|
+
state |= RHRR_ZONE_SET | RHRR_OFFSET_SET;
|
807
|
+
}
|
808
|
+
}
|
809
|
+
break;
|
810
|
+
}
|
811
|
+
|
812
|
+
if (!state) {
|
813
|
+
return Qnil;
|
814
|
+
}
|
815
|
+
|
816
|
+
hash = rb_hash_new();
|
817
|
+
if(state & RHRR_WDAY_SET) {
|
818
|
+
rb_hash_aset(hash, rhrd_sym_wday, INT2NUM(wday));
|
819
|
+
}
|
820
|
+
if(state & RHRR_YEAR_SET) {
|
821
|
+
rb_hash_aset(hash, rhrd_sym_year, INT2NUM(year));
|
822
|
+
}
|
823
|
+
if(state & RHRR_MONTH_SET) {
|
824
|
+
rb_hash_aset(hash, rhrd_sym_mon, INT2NUM(month));
|
825
|
+
}
|
826
|
+
if(state & RHRR_DAY_SET) {
|
827
|
+
rb_hash_aset(hash, rhrd_sym_mday, INT2NUM(day));
|
828
|
+
}
|
829
|
+
if(state & RHRR_HOUR_SET) {
|
830
|
+
rb_hash_aset(hash, rhrd_sym_hour, INT2NUM(hour));
|
831
|
+
}
|
832
|
+
if(state & RHRR_MINUTE_SET) {
|
833
|
+
rb_hash_aset(hash, rhrd_sym_min, INT2NUM(minute));
|
834
|
+
}
|
835
|
+
if(state & RHRR_SECOND_SET) {
|
836
|
+
rb_hash_aset(hash, rhrd_sym_sec, INT2NUM(second));
|
837
|
+
}
|
838
|
+
if(state & RHRR_ZONE_SET) {
|
839
|
+
rzone = rb_str_new(zone, zone_len);
|
840
|
+
rb_hash_aset(hash, rhrd_sym_zone, rzone);
|
841
|
+
if (state & RHRR_OFFSET_SET) {
|
842
|
+
rb_hash_aset(hash, rhrd_sym_offset, INT2NUM(offset));
|
843
|
+
} else {
|
844
|
+
rzone = rhrd_s_zone_to_diff(rzone, rzone);
|
845
|
+
if(RTEST(rzone)) {
|
846
|
+
rb_hash_aset(hash, rhrd_sym_offset, rzone);
|
847
|
+
}
|
848
|
+
}
|
849
|
+
}
|
850
|
+
|
851
|
+
return hash;
|
852
|
+
}
|