Ruby  2.0.0p645(2015-04-13revision50299)
psych_emitter.c
Go to the documentation of this file.
1 #include <psych.h>
2 
4 static ID id_write;
7 static ID id_canonical;
8 
9 static void emit(yaml_emitter_t * emitter, yaml_event_t * event)
10 {
11  if(!yaml_emitter_emit(emitter, event))
12  rb_raise(rb_eRuntimeError, "%s", emitter->problem);
13 }
14 
15 static int writer(void *ctx, unsigned char *buffer, size_t size)
16 {
17  VALUE io = (VALUE)ctx;
18  VALUE str = rb_str_new((const char *)buffer, (long)size);
19  VALUE wrote = rb_funcall(io, id_write, 1, str);
20  return (int)NUM2INT(wrote);
21 }
22 
23 static void dealloc(void * ptr)
24 {
25  yaml_emitter_t * emitter;
26 
27  emitter = (yaml_emitter_t *)ptr;
28  yaml_emitter_delete(emitter);
29  xfree(emitter);
30 }
31 
32 static VALUE allocate(VALUE klass)
33 {
34  yaml_emitter_t * emitter;
35 
36  emitter = xmalloc(sizeof(yaml_emitter_t));
37 
38  yaml_emitter_initialize(emitter);
39  yaml_emitter_set_unicode(emitter, 1);
40  yaml_emitter_set_indent(emitter, 2);
41 
42  return Data_Wrap_Struct(klass, 0, dealloc, emitter);
43 }
44 
45 /* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
46  *
47  * Create a new Psych::Emitter that writes to +io+.
48  */
49 static VALUE initialize(int argc, VALUE *argv, VALUE self)
50 {
51  yaml_emitter_t * emitter;
52  VALUE io, options;
54  VALUE indent;
56 
57  Data_Get_Struct(self, yaml_emitter_t, emitter);
58 
59  if (rb_scan_args(argc, argv, "11", &io, &options) == 2) {
60  line_width = rb_funcall(options, id_line_width, 0);
61  indent = rb_funcall(options, id_indentation, 0);
62  canonical = rb_funcall(options, id_canonical, 0);
63 
64  yaml_emitter_set_width(emitter, NUM2INT(line_width));
65  yaml_emitter_set_indent(emitter, NUM2INT(indent));
66  yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0);
67  }
68 
69  yaml_emitter_set_output(emitter, writer, (void *)io);
70 
71  return self;
72 }
73 
74 /* call-seq: emitter.start_stream(encoding)
75  *
76  * Start a stream emission with +encoding+
77  *
78  * See Psych::Handler#start_stream
79  */
80 static VALUE start_stream(VALUE self, VALUE encoding)
81 {
82  yaml_emitter_t * emitter;
83  yaml_event_t event;
84  Data_Get_Struct(self, yaml_emitter_t, emitter);
85  Check_Type(encoding, T_FIXNUM);
86 
88 
89  emit(emitter, &event);
90 
91  return self;
92 }
93 
94 /* call-seq: emitter.end_stream
95  *
96  * End a stream emission
97  *
98  * See Psych::Handler#end_stream
99  */
100 static VALUE end_stream(VALUE self)
101 {
102  yaml_emitter_t * emitter;
103  yaml_event_t event;
104  Data_Get_Struct(self, yaml_emitter_t, emitter);
105 
107 
108  emit(emitter, &event);
109 
110  return self;
111 }
112 
113 /* call-seq: emitter.start_document(version, tags, implicit)
114  *
115  * Start a document emission with YAML +version+, +tags+, and an +implicit+
116  * start.
117  *
118  * See Psych::Handler#start_document
119  */
121 {
122  yaml_emitter_t * emitter;
125  yaml_event_t event;
126  yaml_version_directive_t version_directive;
127  Data_Get_Struct(self, yaml_emitter_t, emitter);
128 
129 
130  Check_Type(version, T_ARRAY);
131 
132  if(RARRAY_LEN(version) > 0) {
133  VALUE major = rb_ary_entry(version, (long)0);
134  VALUE minor = rb_ary_entry(version, (long)1);
135 
136  version_directive.major = NUM2INT(major);
137  version_directive.minor = NUM2INT(minor);
138  }
139 
140  if(RTEST(tags)) {
141  int i = 0;
142 #ifdef HAVE_RUBY_ENCODING_H
143  rb_encoding * encoding = rb_utf8_encoding();
144 #endif
145 
146  Check_Type(tags, T_ARRAY);
147 
148  head = xcalloc((size_t)RARRAY_LEN(tags), sizeof(yaml_tag_directive_t));
149  tail = head;
150 
151  for(i = 0; i < RARRAY_LEN(tags); i++) {
152  VALUE tuple = RARRAY_PTR(tags)[i];
153  VALUE name;
154  VALUE value;
155 
156  Check_Type(tuple, T_ARRAY);
157 
158  if(RARRAY_LEN(tuple) < 2) {
159  xfree(head);
160  rb_raise(rb_eRuntimeError, "tag tuple must be of length 2");
161  }
162  name = RARRAY_PTR(tuple)[0];
163  value = RARRAY_PTR(tuple)[1];
164 #ifdef HAVE_RUBY_ENCODING_H
165  name = rb_str_export_to_enc(name, encoding);
166  value = rb_str_export_to_enc(value, encoding);
167 #endif
168 
169  tail->handle = (yaml_char_t *)StringValuePtr(name);
170  tail->prefix = (yaml_char_t *)StringValuePtr(value);
171 
172  tail++;
173  }
174  }
175 
177  &event,
178  (RARRAY_LEN(version) > 0) ? &version_directive : NULL,
179  head,
180  tail,
181  imp ? 1 : 0
182  );
183 
184  emit(emitter, &event);
185 
186  if(head) xfree(head);
187 
188  return self;
189 }
190 
191 /* call-seq: emitter.end_document(implicit)
192  *
193  * End a document emission with an +implicit+ ending.
194  *
195  * See Psych::Handler#end_document
196  */
197 static VALUE end_document(VALUE self, VALUE imp)
198 {
199  yaml_emitter_t * emitter;
200  yaml_event_t event;
201  Data_Get_Struct(self, yaml_emitter_t, emitter);
202 
203  yaml_document_end_event_initialize(&event, imp ? 1 : 0);
204 
205  emit(emitter, &event);
206 
207  return self;
208 }
209 
210 /* call-seq: emitter.scalar(value, anchor, tag, plain, quoted, style)
211  *
212  * Emit a scalar with +value+, +anchor+, +tag+, and a +plain+ or +quoted+
213  * string type with +style+.
214  *
215  * See Psych::Handler#scalar
216  */
217 static VALUE scalar(
218  VALUE self,
219  VALUE value,
220  VALUE anchor,
221  VALUE tag,
222  VALUE plain,
223  VALUE quoted,
224  VALUE style
225  ) {
226  yaml_emitter_t * emitter;
227  yaml_event_t event;
228 #ifdef HAVE_RUBY_ENCODING_H
229  rb_encoding *encoding;
230 #endif
231  Data_Get_Struct(self, yaml_emitter_t, emitter);
232 
233  Check_Type(value, T_STRING);
234 
235 #ifdef HAVE_RUBY_ENCODING_H
236  encoding = rb_utf8_encoding();
237 
238  value = rb_str_export_to_enc(value, encoding);
239 
240  if(!NIL_P(anchor)) {
241  Check_Type(anchor, T_STRING);
242  anchor = rb_str_export_to_enc(anchor, encoding);
243  }
244 
245  if(!NIL_P(tag)) {
246  Check_Type(tag, T_STRING);
247  tag = rb_str_export_to_enc(tag, encoding);
248  }
249 #endif
250 
252  &event,
253  (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)),
254  (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)),
255  (yaml_char_t*)StringValuePtr(value),
256  (int)RSTRING_LEN(value),
257  plain ? 1 : 0,
258  quoted ? 1 : 0,
260  );
261 
262  emit(emitter, &event);
263 
264  return self;
265 }
266 
267 /* call-seq: emitter.start_sequence(anchor, tag, implicit, style)
268  *
269  * Start emitting a sequence with +anchor+, a +tag+, +implicit+ sequence
270  * start and end, along with +style+.
271  *
272  * See Psych::Handler#start_sequence
273  */
275  VALUE self,
276  VALUE anchor,
277  VALUE tag,
278  VALUE implicit,
279  VALUE style
280  ) {
281  yaml_emitter_t * emitter;
282  yaml_event_t event;
283 
284 #ifdef HAVE_RUBY_ENCODING_H
285  rb_encoding * encoding = rb_utf8_encoding();
286 
287  if(!NIL_P(anchor)) {
288  Check_Type(anchor, T_STRING);
289  anchor = rb_str_export_to_enc(anchor, encoding);
290  }
291 
292  if(!NIL_P(tag)) {
293  Check_Type(tag, T_STRING);
294  tag = rb_str_export_to_enc(tag, encoding);
295  }
296 #endif
297 
298  Data_Get_Struct(self, yaml_emitter_t, emitter);
299 
301  &event,
302  (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)),
303  (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)),
304  implicit ? 1 : 0,
306  );
307 
308  emit(emitter, &event);
309 
310  return self;
311 }
312 
313 /* call-seq: emitter.end_sequence
314  *
315  * End sequence emission.
316  *
317  * See Psych::Handler#end_sequence
318  */
320 {
321  yaml_emitter_t * emitter;
322  yaml_event_t event;
323  Data_Get_Struct(self, yaml_emitter_t, emitter);
324 
326 
327  emit(emitter, &event);
328 
329  return self;
330 }
331 
332 /* call-seq: emitter.start_mapping(anchor, tag, implicit, style)
333  *
334  * Start emitting a YAML map with +anchor+, +tag+, an +implicit+ start
335  * and end, and +style+.
336  *
337  * See Psych::Handler#start_mapping
338  */
340  VALUE self,
341  VALUE anchor,
342  VALUE tag,
343  VALUE implicit,
344  VALUE style
345  ) {
346  yaml_emitter_t * emitter;
347  yaml_event_t event;
348 #ifdef HAVE_RUBY_ENCODING_H
349  rb_encoding *encoding;
350 #endif
351  Data_Get_Struct(self, yaml_emitter_t, emitter);
352 
353 #ifdef HAVE_RUBY_ENCODING_H
354  encoding = rb_utf8_encoding();
355 
356  if(!NIL_P(anchor)) {
357  Check_Type(anchor, T_STRING);
358  anchor = rb_str_export_to_enc(anchor, encoding);
359  }
360 
361  if(!NIL_P(tag)) {
362  Check_Type(tag, T_STRING);
363  tag = rb_str_export_to_enc(tag, encoding);
364  }
365 #endif
366 
368  &event,
369  (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)),
370  (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)),
371  implicit ? 1 : 0,
373  );
374 
375  emit(emitter, &event);
376 
377  return self;
378 }
379 
380 /* call-seq: emitter.end_mapping
381  *
382  * Emit the end of a mapping.
383  *
384  * See Psych::Handler#end_mapping
385  */
386 static VALUE end_mapping(VALUE self)
387 {
388  yaml_emitter_t * emitter;
389  yaml_event_t event;
390  Data_Get_Struct(self, yaml_emitter_t, emitter);
391 
393 
394  emit(emitter, &event);
395 
396  return self;
397 }
398 
399 /* call-seq: emitter.alias(anchor)
400  *
401  * Emit an alias with +anchor+.
402  *
403  * See Psych::Handler#alias
404  */
405 static VALUE alias(VALUE self, VALUE anchor)
406 {
407  yaml_emitter_t * emitter;
408  yaml_event_t event;
409  Data_Get_Struct(self, yaml_emitter_t, emitter);
410 
411 #ifdef HAVE_RUBY_ENCODING_H
412  if(!NIL_P(anchor)) {
413  Check_Type(anchor, T_STRING);
414  anchor = rb_str_export_to_enc(anchor, rb_utf8_encoding());
415  }
416 #endif
417 
419  &event,
420  (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor))
421  );
422 
423  emit(emitter, &event);
424 
425  return self;
426 }
427 
428 /* call-seq: emitter.canonical = true
429  *
430  * Set the output style to canonical, or not.
431  */
432 static VALUE set_canonical(VALUE self, VALUE style)
433 {
434  yaml_emitter_t * emitter;
435  Data_Get_Struct(self, yaml_emitter_t, emitter);
436 
437  yaml_emitter_set_canonical(emitter, Qtrue == style ? 1 : 0);
438 
439  return style;
440 }
441 
442 /* call-seq: emitter.canonical
443  *
444  * Get the output style, canonical or not.
445  */
446 static VALUE canonical(VALUE self)
447 {
448  yaml_emitter_t * emitter;
449  Data_Get_Struct(self, yaml_emitter_t, emitter);
450 
451  return (emitter->canonical == 0) ? Qfalse : Qtrue;
452 }
453 
454 /* call-seq: emitter.indentation = level
455  *
456  * Set the indentation level to +level+. The level must be less than 10 and
457  * greater than 1.
458  */
460 {
461  yaml_emitter_t * emitter;
462  Data_Get_Struct(self, yaml_emitter_t, emitter);
463 
464  yaml_emitter_set_indent(emitter, NUM2INT(level));
465 
466  return level;
467 }
468 
469 /* call-seq: emitter.indentation
470  *
471  * Get the indentation level.
472  */
473 static VALUE indentation(VALUE self)
474 {
475  yaml_emitter_t * emitter;
476  Data_Get_Struct(self, yaml_emitter_t, emitter);
477 
478  return INT2NUM(emitter->best_indent);
479 }
480 
481 /* call-seq: emitter.line_width
482  *
483  * Get the preferred line width.
484  */
485 static VALUE line_width(VALUE self)
486 {
487  yaml_emitter_t * emitter;
488  Data_Get_Struct(self, yaml_emitter_t, emitter);
489 
490  return INT2NUM(emitter->best_width);
491 }
492 
493 /* call-seq: emitter.line_width = width
494  *
495  * Set the preferred line with to +width+.
496  */
497 static VALUE set_line_width(VALUE self, VALUE width)
498 {
499  yaml_emitter_t * emitter;
500  Data_Get_Struct(self, yaml_emitter_t, emitter);
501 
502  yaml_emitter_set_width(emitter, NUM2INT(width));
503 
504  return width;
505 }
506 
508 {
509  VALUE psych = rb_define_module("Psych");
510  VALUE handler = rb_define_class_under(psych, "Handler", rb_cObject);
511  cPsychEmitter = rb_define_class_under(psych, "Emitter", handler);
512 
514 
515  rb_define_method(cPsychEmitter, "initialize", initialize, -1);
516  rb_define_method(cPsychEmitter, "start_stream", start_stream, 1);
517  rb_define_method(cPsychEmitter, "end_stream", end_stream, 0);
518  rb_define_method(cPsychEmitter, "start_document", start_document, 3);
519  rb_define_method(cPsychEmitter, "end_document", end_document, 1);
520  rb_define_method(cPsychEmitter, "scalar", scalar, 6);
521  rb_define_method(cPsychEmitter, "start_sequence", start_sequence, 4);
522  rb_define_method(cPsychEmitter, "end_sequence", end_sequence, 0);
523  rb_define_method(cPsychEmitter, "start_mapping", start_mapping, 4);
524  rb_define_method(cPsychEmitter, "end_mapping", end_mapping, 0);
525  rb_define_method(cPsychEmitter, "alias", alias, 1);
526  rb_define_method(cPsychEmitter, "canonical", canonical, 0);
527  rb_define_method(cPsychEmitter, "canonical=", set_canonical, 1);
528  rb_define_method(cPsychEmitter, "indentation", indentation, 0);
529  rb_define_method(cPsychEmitter, "indentation=", set_indentation, 1);
530  rb_define_method(cPsychEmitter, "line_width", line_width, 0);
531  rb_define_method(cPsychEmitter, "line_width=", set_line_width, 1);
532 
533  id_write = rb_intern("write");
534  id_line_width = rb_intern("line_width");
535  id_indentation = rb_intern("indentation");
536  id_canonical = rb_intern("canonical");
537 }
538 /* vim: set noet sws=4 sw=4: */
static VALUE alias(VALUE self, VALUE anchor)
yaml_stream_end_event_initialize(yaml_event_t *event)
Create the STREAM-END event.
Definition: api.c:680
static ID id_canonical
Definition: psych_emitter.c:7
VALUE rb_ary_entry(VALUE ary, long offset)
Definition: array.c:1088
#define RARRAY_LEN(a)
Definition: ruby.h:899
The event structure.
Definition: yaml.h:384
#define tail
Definition: st.c:108
static VALUE start_sequence(VALUE self, VALUE anchor, VALUE tag, VALUE implicit, VALUE style)
#define INT2NUM(x)
Definition: ruby.h:1178
int i
Definition: win32ole.c:784
#define T_FIXNUM
Definition: ruby.h:497
int canonical
If the output is in the canonical style?
Definition: yaml.h:1605
int minor
Definition: tcltklib.c:110
#define NUM2INT(x)
Definition: ruby.h:622
#define Data_Get_Struct(obj, type, sval)
Definition: ruby.h:1025
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.
#define Qtrue
Definition: ruby.h:434
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.
Definition: api.c:815
static ID id_write
Definition: psych_emitter.c:4
yaml_emitter_set_output(yaml_emitter_t *emitter, yaml_write_handler_t *handler, void *data)
Set a generic output handler.
Definition: api.c:489
static VALUE allocate(VALUE klass)
Definition: psych_emitter.c:32
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Definition: vm_eval.c:773
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
Definition: class.c:534
#define Check_Type(v, t)
Definition: ruby.h:539
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:1788
unsigned char yaml_char_t
The character type (UTF-8 octet).
Definition: yaml.h:78
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.
Definition: yaml.h:81
static void emit(yaml_emitter_t *emitter, yaml_event_t *event)
Definition: psych_emitter.c:9
#define T_ARRAY
Definition: ruby.h:492
yaml_char_t * prefix
The tag prefix.
Definition: yaml.h:93
yaml_stream_start_event_initialize(yaml_event_t *event, yaml_encoding_t encoding)
Create the STREAM-START event.
Definition: api.c:663
yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
Create an ALIAS event.
Definition: api.c:791
rb_encoding * rb_utf8_encoding(void)
Definition: encoding.c:1166
yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)
Emit an event.
Definition: emitter.c:281
#define head
Definition: st.c:107
#define Data_Wrap_Struct(klass, mark, free, sval)
Definition: ruby.h:1007
static void dealloc(void *ptr)
Definition: psych_emitter.c:23
static VALUE set_line_width(VALUE self, VALUE width)
The emitter structure.
Definition: yaml.h:1525
#define level
RUBY_EXTERN VALUE rb_cObject
Definition: ruby.h:1426
static VALUE canonical(VALUE self)
VALUE rb_eRuntimeError
Definition: error.c:515
VALUE cPsychEmitter
Definition: psych_emitter.c:3
int major
The major version number.
Definition: yaml.h:83
static VALUE start_stream(VALUE self, VALUE encoding)
Definition: psych_emitter.c:80
#define NIL_P(v)
Definition: ruby.h:446
enum yaml_scalar_style_e yaml_scalar_style_t
Scalar styles.
int argc
Definition: ruby.c:130
static VALUE end_stream(VALUE self)
#define Qfalse
Definition: ruby.h:433
yaml_sequence_end_event_initialize(yaml_event_t *event)
Create a SEQUENCE-END event.
Definition: api.c:912
static VALUE end_sequence(VALUE self)
static VALUE end_mapping(VALUE self)
static VALUE set_canonical(VALUE self, VALUE style)
static VALUE scalar(VALUE self, VALUE value, VALUE anchor, VALUE tag, VALUE plain, VALUE quoted, VALUE style)
static VALUE indentation(VALUE self)
#define RSTRING_LEN(str)
Definition: ruby.h:862
yaml_char_t * handle
The tag handle.
Definition: yaml.h:91
yaml_document_end_event_initialize(yaml_event_t *event, int implicit)
Create the DOCUMENT-END event.
Definition: api.c:775
yaml_emitter_set_width(yaml_emitter_t *emitter, int width)
Set the preferred line width.
Definition: api.c:542
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
Definition: class.c:1570
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.
Definition: api.c:518
unsigned long ID
Definition: ruby.h:105
static int options(unsigned char *cp)
Definition: nkf.c:6355
unsigned long VALUE
Definition: ruby.h:104
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.
Definition: api.c:696
The tag directive data.
Definition: yaml.h:89
yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
Set if unescaped non-ASCII characters are allowed.
Definition: api.c:554
void xfree(void *)
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.
Definition: api.c:928
int size
Definition: encoding.c:52
#define xmalloc
Definition: defines.h:64
static VALUE initialize(int argc, VALUE *argv, VALUE self)
Definition: psych_emitter.c:49
int best_indent
The number of indentation spaces.
Definition: yaml.h:1607
#define RARRAY_PTR(a)
Definition: ruby.h:904
int minor
The minor version number.
Definition: yaml.h:85
static VALUE start_mapping(VALUE self, VALUE anchor, VALUE tag, VALUE implicit, VALUE style)
#define RTEST(v)
Definition: ruby.h:445
#define T_STRING
Definition: ruby.h:490
VALUE rb_str_export_to_enc(VALUE, rb_encoding *)
Definition: string.c:632
static ID id_line_width
Definition: psych_emitter.c:5
yaml_mapping_end_event_initialize(yaml_event_t *event)
Create a MAPPING-END event.
Definition: api.c:967
static VALUE end_document(VALUE self, VALUE imp)
const char * name
Definition: nkf.c:208
static int writer(void *ctx, unsigned char *buffer, size_t size)
Definition: psych_emitter.c:15
int best_width
The preferred width of the output lines.
Definition: yaml.h:1609
#define StringValuePtr(v)
Definition: ruby.h:547
yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
Set the intendation increment.
Definition: api.c:530
static ID id_indentation
Definition: psych_emitter.c:6
enum yaml_mapping_style_e yaml_mapping_style_t
Mapping styles.
static VALUE line_width(VALUE self)
static void version(void)
Definition: nkf.c:898
const char * problem
Error description.
Definition: yaml.h:1535
int major
Definition: tcltklib.c:109
void Init_psych_emitter()
VALUE rb_define_module(const char *name)
Definition: class.c:606
yaml_emitter_initialize(yaml_emitter_t *emitter)
Initialize an emitter.
Definition: api.c:349
#define rb_intern(str)
#define NULL
Definition: _sdbm.c:102
yaml_emitter_delete(yaml_emitter_t *emitter)
Destroy an emitter.
Definition: api.c:386
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
Definition: class.c:1344
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.
Definition: api.c:873
char ** argv
Definition: ruby.c:131
VALUE rb_str_new(const char *, long)
Definition: string.c:425
#define xcalloc
Definition: defines.h:66