psych 2.0.12 → 5.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CONTRIBUTING.md +24 -0
- data/{ext/psych/yaml/LICENSE → LICENSE} +9 -7
- data/README.md +80 -0
- data/ext/psych/depend +14 -0
- data/ext/psych/extconf.rb +43 -28
- data/ext/psych/psych.c +6 -4
- data/ext/psych/psych.h +0 -3
- data/ext/psych/psych_emitter.c +165 -132
- data/ext/psych/psych_parser.c +298 -331
- data/ext/psych/psych_to_ruby.c +0 -5
- data/ext/psych/psych_yaml_tree.c +0 -13
- data/lib/psych/class_loader.rb +11 -8
- data/lib/psych/coder.rb +1 -0
- data/lib/psych/core_ext.rb +3 -19
- data/lib/psych/exception.rb +17 -2
- data/lib/psych/handler.rb +8 -2
- data/lib/psych/handlers/document_stream.rb +2 -1
- data/lib/psych/handlers/recorder.rb +2 -1
- data/lib/psych/json/ruby_events.rb +1 -0
- data/lib/psych/json/stream.rb +3 -2
- data/lib/psych/json/tree_builder.rb +2 -1
- data/lib/psych/json/yaml_events.rb +1 -0
- data/lib/psych/nodes/alias.rb +3 -0
- data/lib/psych/nodes/document.rb +3 -0
- data/lib/psych/nodes/mapping.rb +3 -0
- data/lib/psych/nodes/node.rb +25 -5
- data/lib/psych/nodes/scalar.rb +4 -1
- data/lib/psych/nodes/sequence.rb +3 -0
- data/lib/psych/nodes/stream.rb +3 -0
- data/lib/psych/nodes.rb +8 -7
- data/lib/psych/omap.rb +1 -0
- data/lib/psych/parser.rb +14 -0
- data/lib/psych/scalar_scanner.rb +41 -49
- data/lib/psych/set.rb +1 -0
- data/lib/psych/stream.rb +1 -0
- data/lib/psych/streaming.rb +1 -0
- data/lib/psych/syntax_error.rb +2 -1
- data/lib/psych/tree_builder.rb +48 -7
- data/lib/psych/versions.rb +10 -0
- data/lib/psych/visitors/depth_first.rb +1 -0
- data/lib/psych/visitors/emitter.rb +1 -0
- data/lib/psych/visitors/json_tree.rb +2 -1
- data/lib/psych/visitors/to_ruby.rb +64 -33
- data/lib/psych/visitors/visitor.rb +18 -3
- data/lib/psych/visitors/yaml_tree.rb +128 -149
- data/lib/psych/visitors.rb +7 -6
- data/lib/psych/y.rb +1 -0
- data/lib/psych.rb +360 -95
- metadata +36 -169
- data/.autotest +0 -18
- data/.gemtest +0 -0
- data/.travis.yml +0 -11
- data/CHANGELOG.rdoc +0 -562
- data/Manifest.txt +0 -112
- data/README.rdoc +0 -71
- data/Rakefile +0 -74
- data/ext/psych/yaml/api.c +0 -1415
- data/ext/psych/yaml/config.h +0 -10
- data/ext/psych/yaml/dumper.c +0 -394
- data/ext/psych/yaml/emitter.c +0 -2329
- data/ext/psych/yaml/loader.c +0 -459
- data/ext/psych/yaml/parser.c +0 -1370
- data/ext/psych/yaml/reader.c +0 -469
- data/ext/psych/yaml/scanner.c +0 -3583
- data/ext/psych/yaml/writer.c +0 -141
- data/ext/psych/yaml/yaml.h +0 -1971
- data/ext/psych/yaml/yaml_private.h +0 -664
- data/lib/psych/deprecated.rb +0 -85
- data/test/psych/handlers/test_recorder.rb +0 -25
- data/test/psych/helper.rb +0 -114
- data/test/psych/json/test_stream.rb +0 -109
- data/test/psych/nodes/test_enumerable.rb +0 -43
- data/test/psych/test_alias_and_anchor.rb +0 -96
- data/test/psych/test_array.rb +0 -57
- data/test/psych/test_boolean.rb +0 -36
- data/test/psych/test_class.rb +0 -36
- data/test/psych/test_coder.rb +0 -184
- data/test/psych/test_date_time.rb +0 -38
- data/test/psych/test_deprecated.rb +0 -214
- data/test/psych/test_document.rb +0 -46
- data/test/psych/test_emitter.rb +0 -93
- data/test/psych/test_encoding.rb +0 -259
- data/test/psych/test_exception.rb +0 -157
- data/test/psych/test_hash.rb +0 -94
- data/test/psych/test_json_tree.rb +0 -65
- data/test/psych/test_marshalable.rb +0 -54
- data/test/psych/test_merge_keys.rb +0 -180
- data/test/psych/test_nil.rb +0 -18
- data/test/psych/test_null.rb +0 -19
- data/test/psych/test_numeric.rb +0 -45
- data/test/psych/test_object.rb +0 -44
- data/test/psych/test_object_references.rb +0 -71
- data/test/psych/test_omap.rb +0 -75
- data/test/psych/test_parser.rb +0 -339
- data/test/psych/test_psych.rb +0 -168
- data/test/psych/test_safe_load.rb +0 -97
- data/test/psych/test_scalar.rb +0 -11
- data/test/psych/test_scalar_scanner.rb +0 -106
- data/test/psych/test_serialize_subclasses.rb +0 -38
- data/test/psych/test_set.rb +0 -49
- data/test/psych/test_stream.rb +0 -93
- data/test/psych/test_string.rb +0 -226
- data/test/psych/test_struct.rb +0 -49
- data/test/psych/test_symbol.rb +0 -25
- data/test/psych/test_tainted.rb +0 -130
- data/test/psych/test_to_yaml_properties.rb +0 -63
- data/test/psych/test_tree_builder.rb +0 -79
- data/test/psych/test_yaml.rb +0 -1288
- data/test/psych/test_yamldbm.rb +0 -193
- data/test/psych/test_yamlstore.rb +0 -85
- data/test/psych/visitors/test_depth_first.rb +0 -49
- data/test/psych/visitors/test_emitter.rb +0 -144
- data/test/psych/visitors/test_to_ruby.rb +0 -326
- data/test/psych/visitors/test_yaml_tree.rb +0 -173
data/ext/psych/psych_emitter.c
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
#include <psych.h>
|
2
2
|
|
3
|
+
#if !defined(RARRAY_CONST_PTR)
|
4
|
+
#define RARRAY_CONST_PTR(s) (const VALUE *)RARRAY_PTR(s)
|
5
|
+
#endif
|
6
|
+
#if !defined(RARRAY_AREF)
|
7
|
+
#define RARRAY_AREF(a, i) RARRAY_CONST_PTR(a)[i]
|
8
|
+
#endif
|
9
|
+
|
3
10
|
VALUE cPsychEmitter;
|
11
|
+
static ID id_io;
|
4
12
|
static ID id_write;
|
5
13
|
static ID id_line_width;
|
6
14
|
static ID id_indentation;
|
@@ -9,13 +17,13 @@ static ID id_canonical;
|
|
9
17
|
static void emit(yaml_emitter_t * emitter, yaml_event_t * event)
|
10
18
|
{
|
11
19
|
if(!yaml_emitter_emit(emitter, event))
|
12
|
-
|
20
|
+
rb_raise(rb_eRuntimeError, "%s", emitter->problem);
|
13
21
|
}
|
14
22
|
|
15
23
|
static int writer(void *ctx, unsigned char *buffer, size_t size)
|
16
24
|
{
|
17
|
-
VALUE
|
18
|
-
VALUE str =
|
25
|
+
VALUE self = (VALUE)ctx, io = rb_attr_get(self, id_io);
|
26
|
+
VALUE str = rb_enc_str_new((const char *)buffer, (long)size, rb_utf8_encoding());
|
19
27
|
VALUE wrote = rb_funcall(io, id_write, 1, str);
|
20
28
|
return (int)NUM2INT(wrote);
|
21
29
|
}
|
@@ -50,14 +58,13 @@ static const rb_data_type_t psych_emitter_type = {
|
|
50
58
|
static VALUE allocate(VALUE klass)
|
51
59
|
{
|
52
60
|
yaml_emitter_t * emitter;
|
53
|
-
|
54
|
-
emitter = xmalloc(sizeof(yaml_emitter_t));
|
61
|
+
VALUE obj = TypedData_Make_Struct(klass, yaml_emitter_t, &psych_emitter_type, emitter);
|
55
62
|
|
56
63
|
yaml_emitter_initialize(emitter);
|
57
64
|
yaml_emitter_set_unicode(emitter, 1);
|
58
65
|
yaml_emitter_set_indent(emitter, 2);
|
59
66
|
|
60
|
-
return
|
67
|
+
return obj;
|
61
68
|
}
|
62
69
|
|
63
70
|
/* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
|
@@ -75,16 +82,17 @@ static VALUE initialize(int argc, VALUE *argv, VALUE self)
|
|
75
82
|
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
|
76
83
|
|
77
84
|
if (rb_scan_args(argc, argv, "11", &io, &options) == 2) {
|
78
|
-
|
79
|
-
|
80
|
-
|
85
|
+
line_width = rb_funcall(options, id_line_width, 0);
|
86
|
+
indent = rb_funcall(options, id_indentation, 0);
|
87
|
+
canonical = rb_funcall(options, id_canonical, 0);
|
81
88
|
|
82
|
-
|
83
|
-
|
84
|
-
|
89
|
+
yaml_emitter_set_width(emitter, NUM2INT(line_width));
|
90
|
+
yaml_emitter_set_indent(emitter, NUM2INT(indent));
|
91
|
+
yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0);
|
85
92
|
}
|
86
93
|
|
87
|
-
|
94
|
+
rb_ivar_set(self, id_io, io);
|
95
|
+
yaml_emitter_set_output(emitter, writer, (void *)self);
|
88
96
|
|
89
97
|
return self;
|
90
98
|
}
|
@@ -128,84 +136,118 @@ static VALUE end_stream(VALUE self)
|
|
128
136
|
return self;
|
129
137
|
}
|
130
138
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
+
struct start_document_data {
|
140
|
+
VALUE self;
|
141
|
+
VALUE version;
|
142
|
+
VALUE tags;
|
143
|
+
VALUE imp;
|
144
|
+
|
145
|
+
yaml_tag_directive_t * head;
|
146
|
+
};
|
147
|
+
|
148
|
+
static VALUE start_document_try(VALUE d)
|
139
149
|
{
|
150
|
+
struct start_document_data * data = (struct start_document_data *)d;
|
151
|
+
VALUE self = data->self;
|
152
|
+
VALUE version = data->version;
|
153
|
+
VALUE tags = data->tags;
|
154
|
+
VALUE imp = data->imp;
|
155
|
+
|
140
156
|
yaml_emitter_t * emitter;
|
141
|
-
yaml_tag_directive_t * head = NULL;
|
142
157
|
yaml_tag_directive_t * tail = NULL;
|
143
158
|
yaml_event_t event;
|
144
159
|
yaml_version_directive_t version_directive;
|
145
160
|
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
|
146
161
|
|
147
|
-
|
148
162
|
Check_Type(version, T_ARRAY);
|
149
163
|
|
150
164
|
if(RARRAY_LEN(version) > 0) {
|
151
|
-
|
152
|
-
|
165
|
+
VALUE major = rb_ary_entry(version, (long)0);
|
166
|
+
VALUE minor = rb_ary_entry(version, (long)1);
|
153
167
|
|
154
|
-
|
155
|
-
|
168
|
+
version_directive.major = NUM2INT(major);
|
169
|
+
version_directive.minor = NUM2INT(minor);
|
156
170
|
}
|
157
171
|
|
158
172
|
if(RTEST(tags)) {
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
#endif
|
173
|
+
long i = 0;
|
174
|
+
long len;
|
175
|
+
rb_encoding * encoding = rb_utf8_encoding();
|
163
176
|
|
164
|
-
|
177
|
+
Check_Type(tags, T_ARRAY);
|
165
178
|
|
166
|
-
|
167
|
-
|
179
|
+
len = RARRAY_LEN(tags);
|
180
|
+
data->head = xcalloc((size_t)len, sizeof(yaml_tag_directive_t));
|
181
|
+
tail = data->head;
|
168
182
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
183
|
+
for(i = 0; i < len && i < RARRAY_LEN(tags); i++) {
|
184
|
+
VALUE tuple = RARRAY_AREF(tags, i);
|
185
|
+
VALUE name;
|
186
|
+
VALUE value;
|
173
187
|
|
174
|
-
|
188
|
+
Check_Type(tuple, T_ARRAY);
|
175
189
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
190
|
+
if(RARRAY_LEN(tuple) < 2) {
|
191
|
+
rb_raise(rb_eRuntimeError, "tag tuple must be of length 2");
|
192
|
+
}
|
193
|
+
|
194
|
+
name = RARRAY_AREF(tuple, 0);
|
195
|
+
value = RARRAY_AREF(tuple, 1);
|
196
|
+
StringValue(name);
|
197
|
+
StringValue(value);
|
198
|
+
name = rb_str_export_to_enc(name, encoding);
|
199
|
+
value = rb_str_export_to_enc(value, encoding);
|
186
200
|
|
187
|
-
|
188
|
-
|
201
|
+
tail->handle = (yaml_char_t *)StringValueCStr(name);
|
202
|
+
tail->prefix = (yaml_char_t *)StringValueCStr(value);
|
189
203
|
|
190
|
-
|
191
|
-
|
204
|
+
tail++;
|
205
|
+
}
|
192
206
|
}
|
193
207
|
|
194
208
|
yaml_document_start_event_initialize(
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
209
|
+
&event,
|
210
|
+
(RARRAY_LEN(version) > 0) ? &version_directive : NULL,
|
211
|
+
data->head,
|
212
|
+
tail,
|
213
|
+
imp ? 1 : 0
|
214
|
+
);
|
201
215
|
|
202
216
|
emit(emitter, &event);
|
203
217
|
|
204
|
-
if(head) xfree(head);
|
205
|
-
|
206
218
|
return self;
|
207
219
|
}
|
208
220
|
|
221
|
+
static VALUE start_document_ensure(VALUE d)
|
222
|
+
{
|
223
|
+
struct start_document_data * data = (struct start_document_data *)d;
|
224
|
+
|
225
|
+
xfree(data->head);
|
226
|
+
|
227
|
+
return Qnil;
|
228
|
+
}
|
229
|
+
|
230
|
+
/* call-seq: emitter.start_document(version, tags, implicit)
|
231
|
+
*
|
232
|
+
* Start a document emission with YAML +version+, +tags+, and an +implicit+
|
233
|
+
* start.
|
234
|
+
*
|
235
|
+
* See Psych::Handler#start_document
|
236
|
+
*/
|
237
|
+
static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
|
238
|
+
{
|
239
|
+
struct start_document_data data = {
|
240
|
+
.self = self,
|
241
|
+
.version = version,
|
242
|
+
.tags = tags,
|
243
|
+
.imp = imp,
|
244
|
+
|
245
|
+
.head = NULL,
|
246
|
+
};
|
247
|
+
|
248
|
+
return rb_ensure(start_document_try, (VALUE)&data, start_document_ensure, (VALUE)&data);
|
249
|
+
}
|
250
|
+
|
209
251
|
/* call-seq: emitter.end_document(implicit)
|
210
252
|
*
|
211
253
|
* End a document emission with an +implicit+ ending.
|
@@ -233,49 +275,46 @@ static VALUE end_document(VALUE self, VALUE imp)
|
|
233
275
|
* See Psych::Handler#scalar
|
234
276
|
*/
|
235
277
|
static VALUE scalar(
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
278
|
+
VALUE self,
|
279
|
+
VALUE value,
|
280
|
+
VALUE anchor,
|
281
|
+
VALUE tag,
|
282
|
+
VALUE plain,
|
283
|
+
VALUE quoted,
|
284
|
+
VALUE style
|
285
|
+
) {
|
244
286
|
yaml_emitter_t * emitter;
|
245
287
|
yaml_event_t event;
|
246
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
247
288
|
rb_encoding *encoding;
|
248
|
-
#endif
|
249
289
|
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
|
250
290
|
|
251
291
|
Check_Type(value, T_STRING);
|
252
292
|
|
253
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
254
293
|
encoding = rb_utf8_encoding();
|
255
294
|
|
256
295
|
value = rb_str_export_to_enc(value, encoding);
|
257
296
|
|
258
297
|
if(!NIL_P(anchor)) {
|
259
|
-
|
260
|
-
|
298
|
+
Check_Type(anchor, T_STRING);
|
299
|
+
anchor = rb_str_export_to_enc(anchor, encoding);
|
261
300
|
}
|
262
301
|
|
263
302
|
if(!NIL_P(tag)) {
|
264
|
-
|
265
|
-
|
303
|
+
Check_Type(tag, T_STRING);
|
304
|
+
tag = rb_str_export_to_enc(tag, encoding);
|
266
305
|
}
|
267
|
-
#endif
|
268
306
|
|
307
|
+
const char *value_ptr = StringValuePtr(value);
|
269
308
|
yaml_scalar_event_initialize(
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
309
|
+
&event,
|
310
|
+
(yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
|
311
|
+
(yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
|
312
|
+
(yaml_char_t*)value_ptr,
|
313
|
+
(int)RSTRING_LEN(value),
|
314
|
+
plain ? 1 : 0,
|
315
|
+
quoted ? 1 : 0,
|
316
|
+
(yaml_scalar_style_t)NUM2INT(style)
|
317
|
+
);
|
279
318
|
|
280
319
|
emit(emitter, &event);
|
281
320
|
|
@@ -290,38 +329,36 @@ static VALUE scalar(
|
|
290
329
|
* See Psych::Handler#start_sequence
|
291
330
|
*/
|
292
331
|
static VALUE start_sequence(
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
332
|
+
VALUE self,
|
333
|
+
VALUE anchor,
|
334
|
+
VALUE tag,
|
335
|
+
VALUE implicit,
|
336
|
+
VALUE style
|
337
|
+
) {
|
299
338
|
yaml_emitter_t * emitter;
|
300
339
|
yaml_event_t event;
|
301
340
|
|
302
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
303
341
|
rb_encoding * encoding = rb_utf8_encoding();
|
304
342
|
|
305
343
|
if(!NIL_P(anchor)) {
|
306
|
-
|
307
|
-
|
344
|
+
Check_Type(anchor, T_STRING);
|
345
|
+
anchor = rb_str_export_to_enc(anchor, encoding);
|
308
346
|
}
|
309
347
|
|
310
348
|
if(!NIL_P(tag)) {
|
311
|
-
|
312
|
-
|
349
|
+
Check_Type(tag, T_STRING);
|
350
|
+
tag = rb_str_export_to_enc(tag, encoding);
|
313
351
|
}
|
314
|
-
#endif
|
315
352
|
|
316
353
|
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
|
317
354
|
|
318
355
|
yaml_sequence_start_event_initialize(
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
356
|
+
&event,
|
357
|
+
(yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
|
358
|
+
(yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
|
359
|
+
implicit ? 1 : 0,
|
360
|
+
(yaml_sequence_style_t)NUM2INT(style)
|
361
|
+
);
|
325
362
|
|
326
363
|
emit(emitter, &event);
|
327
364
|
|
@@ -355,40 +392,37 @@ static VALUE end_sequence(VALUE self)
|
|
355
392
|
* See Psych::Handler#start_mapping
|
356
393
|
*/
|
357
394
|
static VALUE start_mapping(
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
395
|
+
VALUE self,
|
396
|
+
VALUE anchor,
|
397
|
+
VALUE tag,
|
398
|
+
VALUE implicit,
|
399
|
+
VALUE style
|
400
|
+
) {
|
364
401
|
yaml_emitter_t * emitter;
|
365
402
|
yaml_event_t event;
|
366
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
367
403
|
rb_encoding *encoding;
|
368
|
-
|
404
|
+
|
369
405
|
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
|
370
406
|
|
371
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
372
407
|
encoding = rb_utf8_encoding();
|
373
408
|
|
374
409
|
if(!NIL_P(anchor)) {
|
375
|
-
|
376
|
-
|
410
|
+
Check_Type(anchor, T_STRING);
|
411
|
+
anchor = rb_str_export_to_enc(anchor, encoding);
|
377
412
|
}
|
378
413
|
|
379
414
|
if(!NIL_P(tag)) {
|
380
|
-
|
381
|
-
|
415
|
+
Check_Type(tag, T_STRING);
|
416
|
+
tag = rb_str_export_to_enc(tag, encoding);
|
382
417
|
}
|
383
|
-
#endif
|
384
418
|
|
385
419
|
yaml_mapping_start_event_initialize(
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
420
|
+
&event,
|
421
|
+
(yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
|
422
|
+
(yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
|
423
|
+
implicit ? 1 : 0,
|
424
|
+
(yaml_mapping_style_t)NUM2INT(style)
|
425
|
+
);
|
392
426
|
|
393
427
|
emit(emitter, &event);
|
394
428
|
|
@@ -426,17 +460,15 @@ static VALUE alias(VALUE self, VALUE anchor)
|
|
426
460
|
yaml_event_t event;
|
427
461
|
TypedData_Get_Struct(self, yaml_emitter_t, &psych_emitter_type, emitter);
|
428
462
|
|
429
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
430
463
|
if(!NIL_P(anchor)) {
|
431
|
-
|
432
|
-
|
464
|
+
Check_Type(anchor, T_STRING);
|
465
|
+
anchor = rb_str_export_to_enc(anchor, rb_utf8_encoding());
|
433
466
|
}
|
434
|
-
#endif
|
435
467
|
|
436
468
|
yaml_alias_event_initialize(
|
437
|
-
|
438
|
-
|
439
|
-
|
469
|
+
&event,
|
470
|
+
(yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor))
|
471
|
+
);
|
440
472
|
|
441
473
|
emit(emitter, &event);
|
442
474
|
|
@@ -524,6 +556,7 @@ static VALUE set_line_width(VALUE self, VALUE width)
|
|
524
556
|
|
525
557
|
void Init_psych_emitter(void)
|
526
558
|
{
|
559
|
+
#undef rb_intern
|
527
560
|
VALUE psych = rb_define_module("Psych");
|
528
561
|
VALUE handler = rb_define_class_under(psych, "Handler", rb_cObject);
|
529
562
|
cPsychEmitter = rb_define_class_under(psych, "Emitter", handler);
|
@@ -548,9 +581,9 @@ void Init_psych_emitter(void)
|
|
548
581
|
rb_define_method(cPsychEmitter, "line_width", line_width, 0);
|
549
582
|
rb_define_method(cPsychEmitter, "line_width=", set_line_width, 1);
|
550
583
|
|
584
|
+
id_io = rb_intern("io");
|
551
585
|
id_write = rb_intern("write");
|
552
586
|
id_line_width = rb_intern("line_width");
|
553
587
|
id_indentation = rb_intern("indentation");
|
554
588
|
id_canonical = rb_intern("canonical");
|
555
589
|
}
|
556
|
-
/* vim: set noet sws=4 sw=4: */
|