3 #if !defined(RARRAY_CONST_PTR) 4 #define RARRAY_CONST_PTR(s) (const VALUE *)RARRAY_PTR(s) 6 #if !defined(RARRAY_AREF) 7 #define RARRAY_AREF(a, i) RARRAY_CONST_PTR(a)[i] 23 static int writer(
void *ctx,
unsigned char *buffer,
size_t size)
41 static size_t memsize(
const void *ptr)
53 #ifdef RUBY_TYPED_FREE_IMMEDIATELY 84 if (
rb_scan_args(argc, argv,
"11", &io, &options) == 2) {
115 emit(emitter, &event);
134 emit(emitter, &event);
177 for(i = 0; i < len && i <
RARRAY_LEN(tags); i++) {
210 emit(emitter, &event);
212 if(head)
xfree(head);
231 emit(emitter, &event);
284 emit(emitter, &event);
328 emit(emitter, &event);
347 emit(emitter, &event);
392 emit(emitter, &event);
411 emit(emitter, &event);
438 emit(emitter, &event);
static VALUE alias(VALUE self, VALUE anchor)
yaml_stream_end_event_initialize(yaml_event_t *event)
Create the STREAM-END event.
VALUE rb_ary_entry(VALUE ary, long offset)
#define RUBY_TYPED_FREE_IMMEDIATELY
static VALUE start_sequence(VALUE self, VALUE anchor, VALUE tag, VALUE implicit, VALUE style)
int canonical
If the output is in the canonical style?
void Init_psych_emitter(void)
enum yaml_encoding_e yaml_encoding_t
The stream encoding.
static VALUE set_indentation(VALUE self, VALUE level)
enum yaml_sequence_style_e yaml_sequence_style_t
Sequence styles.
yaml_scalar_event_initialize(yaml_event_t *event, yaml_char_t *anchor, yaml_char_t *tag, yaml_char_t *value, int length, int plain_implicit, int quoted_implicit, yaml_scalar_style_t style)
Create a SCALAR event.
#define TypedData_Get_Struct(obj, type, data_type, sval)
yaml_emitter_set_output(yaml_emitter_t *emitter, yaml_write_handler_t *handler, void *data)
Set a generic output handler.
static VALUE allocate(VALUE klass)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
void rb_raise(VALUE exc, const char *fmt,...)
unsigned char yaml_char_t
The character type (UTF-8 octet).
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
The version directive data.
static void emit(yaml_emitter_t *emitter, yaml_event_t *event)
yaml_char_t * prefix
The tag prefix.
yaml_stream_start_event_initialize(yaml_event_t *event, yaml_encoding_t encoding)
Create the STREAM-START event.
yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
Create an ALIAS event.
rb_encoding * rb_utf8_encoding(void)
yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)
Emit an event.
static void dealloc(void *ptr)
static VALUE set_line_width(VALUE self, VALUE width)
RUBY_EXTERN VALUE rb_cObject
static VALUE canonical(VALUE self)
int major
The major version number.
static VALUE start_stream(VALUE self, VALUE encoding)
enum yaml_scalar_style_e yaml_scalar_style_t
Scalar styles.
static VALUE end_stream(VALUE self)
yaml_sequence_end_event_initialize(yaml_event_t *event)
Create a SEQUENCE-END event.
static VALUE end_sequence(VALUE self)
static VALUE end_mapping(VALUE self)
static VALUE set_canonical(VALUE self, VALUE style)
static const rb_data_type_t psych_emitter_type
static VALUE scalar(VALUE self, VALUE value, VALUE anchor, VALUE tag, VALUE plain, VALUE quoted, VALUE style)
static VALUE indentation(VALUE self)
yaml_char_t * handle
The tag handle.
yaml_document_end_event_initialize(yaml_event_t *event, int implicit)
Create the DOCUMENT-END event.
yaml_emitter_set_width(yaml_emitter_t *emitter, int width)
Set the preferred line width.
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
VALUE rb_ivar_set(VALUE, ID, VALUE)
yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical)
Set if the output should be in the "canonical" format as in the YAML specification.
static int options(unsigned char *cp)
yaml_document_start_event_initialize(yaml_event_t *event, yaml_version_directive_t *version_directive, yaml_tag_directive_t *tag_directives_start, yaml_tag_directive_t *tag_directives_end, int implicit)
Create the DOCUMENT-START event.
yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
Set if unescaped non-ASCII characters are allowed.
register unsigned int len
yaml_mapping_start_event_initialize(yaml_event_t *event, yaml_char_t *anchor, yaml_char_t *tag, int implicit, yaml_mapping_style_t style)
Create a MAPPING-START event.
#define RARRAY_AREF(a, i)
static VALUE initialize(int argc, VALUE *argv, VALUE self)
int best_indent
The number of indentation spaces.
int minor
The minor version number.
static VALUE start_mapping(VALUE self, VALUE anchor, VALUE tag, VALUE implicit, VALUE style)
VALUE rb_str_export_to_enc(VALUE, rb_encoding *)
#define TypedData_Make_Struct(klass, type, data_type, sval)
VALUE rb_enc_str_new(const char *, long, rb_encoding *)
yaml_mapping_end_event_initialize(yaml_event_t *event)
Create a MAPPING-END event.
static VALUE end_document(VALUE self, VALUE imp)
static int writer(void *ctx, unsigned char *buffer, size_t size)
int best_width
The preferred width of the output lines.
#define StringValuePtr(v)
yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
Set the indentation increment.
enum yaml_mapping_style_e yaml_mapping_style_t
Mapping styles.
static VALUE line_width(VALUE self)
const char * problem
Error description.
VALUE rb_define_module(const char *name)
yaml_emitter_initialize(yaml_emitter_t *emitter)
Initialize an emitter.
yaml_emitter_delete(yaml_emitter_t *emitter)
Destroy an emitter.
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rb_attr_get(VALUE, ID)
yaml_sequence_start_event_initialize(yaml_event_t *event, yaml_char_t *anchor, yaml_char_t *tag, int implicit, yaml_sequence_style_t style)
Create a SEQUENCE-START event.