20 #define PSYCH_TRANSCODE(_str, _yaml_enc, _internal_enc) \
22 rb_enc_associate_index((_str), (_yaml_enc)); \
24 (_str) = rb_str_export_to_enc((_str), (_internal_enc)); \
37 memcpy(buf, str, *read);
78 #ifdef HAVE_RUBY_ENCODING_H
86 if (source_encoding == utf8) {
91 if (source_encoding == utf16le) {
96 if (source_encoding == utf16be) {
110 VALUE io_external_encoding;
111 int io_external_enc_index;
116 if (
NIL_P(io_external_encoding)) {
238 #ifdef HAVE_RUBY_ENCODING_H
244 if (
rb_scan_args(argc, argv,
"11", &yaml, &path) == 1) {
259 #ifdef HAVE_RUBY_ENCODING_H
267 #ifdef HAVE_RUBY_ENCODING_H
305 VALUE version =
event.data.document_start.version_directive ?
314 event.data.document_start.tag_directives.start;
316 event.data.document_start.tag_directives.end;
317 for(; start != end; start++) {
323 #ifdef HAVE_RUBY_ENCODING_H
331 #ifdef HAVE_RUBY_ENCODING_H
341 args[2] = tag_directives;
342 args[3] =
event.data.document_start.implicit == 1 ?
Qtrue :
Qfalse;
351 args[1] =
event.data.document_end.implicit == 1 ?
Qtrue :
Qfalse;
362 #ifdef HAVE_RUBY_ENCODING_H
377 VALUE plain_implicit, quoted_implicit, style;
384 #ifdef HAVE_RUBY_ENCODING_H
391 #ifdef HAVE_RUBY_ENCODING_H
399 #ifdef HAVE_RUBY_ENCODING_H
405 event.data.scalar.plain_implicit == 0 ?
Qfalse :
Qtrue;
408 event.data.scalar.quoted_implicit == 0 ?
Qfalse :
Qtrue;
416 args[4] = plain_implicit;
417 args[5] = quoted_implicit;
427 VALUE implicit, style;
431 #ifdef HAVE_RUBY_ENCODING_H
440 #ifdef HAVE_RUBY_ENCODING_H
446 event.data.sequence_start.implicit == 0 ?
Qfalse :
Qtrue;
467 VALUE implicit, style;
471 #ifdef HAVE_RUBY_ENCODING_H
479 #ifdef HAVE_RUBY_ENCODING_H
485 event.data.mapping_start.implicit == 0 ?
Qfalse :
Qtrue;