94 if (emitter->closed)
return 1;
120 emitter->document = document;
122 if (!emitter->opened) {
134 emitter->anchors =
yaml_malloc(
sizeof(*(emitter->anchors))
135 * (document->nodes.top - document->nodes.start));
136 if (!emitter->anchors)
goto error;
137 memset(emitter->anchors, 0,
sizeof(*(emitter->anchors))
138 * (document->nodes.top - document->nodes.start));
141 document->tag_directives.start, document->tag_directives.end,
142 document->start_implicit, mark, mark);
216 switch (node->
type) {
219 item < node->
data.sequence.items.top; item ++) {
225 pair < node->
data.mapping.pairs.top; pair ++) {
244 #define ANCHOR_TEMPLATE "id%03d"
245 #define ANCHOR_TEMPLATE_LENGTH 16
252 if (!anchor)
return NULL;
272 if (!anchor)
return 0;
281 switch (node->
type) {
322 int plain_implicit = (strcmp((
char *)node->
tag,
324 int quoted_implicit = (strcmp((
char *)node->
tag,
328 node->
data.
scalar.length, plain_implicit, quoted_implicit,
354 item < node->
data.sequence.items.top; item ++) {
384 pair < node->
data.mapping.pairs.top; pair ++) {
union yaml_node_s::@29 data
The node data.
#define STREAM_END_EVENT_INIT(event, start_mark, end_mark)
#define ANCHOR_TEMPLATE_LENGTH
#define SCALAR_EVENT_INIT(event, event_anchor, event_tag, event_value, event_length,event_plain_implicit, event_quoted_implicit, event_style, start_mark, end_mark)
static yaml_char_t * yaml_emitter_generate_anchor(yaml_emitter_t *emitter, int anchor_id)
static void yaml_emitter_anchor_node(yaml_emitter_t *emitter, int index)
int last_anchor_id
The last assigned anchor id.
static void yaml_emitter_delete_document_and_anchors(yaml_emitter_t *emitter)
yaml_document_t * document
The currently emitted document.
#define STREAM_START_EVENT_INIT(event, event_encoding, start_mark, end_mark)
yaml_node_type_t type
The node type.
struct yaml_node_s::@29::@32 mapping
The mapping parameters (for YAML_MAPPING_NODE).
#define SEQUENCE_START_EVENT_INIT(event, event_anchor, event_tag,event_implicit, event_style, start_mark, end_mark)
unsigned char yaml_char_t
The character type (UTF-8 octet).
Let the parser choose the encoding.
int references
The number of references.
#define MAPPING_START_EVENT_INIT(event, event_anchor, event_tag,event_implicit, event_style, start_mark, end_mark)
An element of a mapping node.
yaml_document_delete(yaml_document_t *document)
Delete a YAML document and all its nodes.
int yaml_node_item_t
An element of a sequence node.
yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)
Emit an event.
#define SEQUENCE_END_EVENT_INIT(event, start_mark, end_mark)
#define STACK_EMPTY(context, stack)
int key
The key of the element.
#define YAML_DEFAULT_SEQUENCE_TAG
The default sequence tag is !!seq.
memset(y->frac+ix+1, 0,(y->Prec-(ix+1))*sizeof(BDIGIT))
yaml_emitter_close(yaml_emitter_t *emitter)
Finish a YAML stream.
yaml_char_t * tag
The node tag.
static int yaml_emitter_dump_node(yaml_emitter_t *emitter, int index)
int serialized
If the node has been emitted?
#define ALIAS_EVENT_INIT(event, event_anchor, start_mark, end_mark)
#define YAML_DECLARE(type)
The public API declaration.
static int yaml_emitter_dump_scalar(yaml_emitter_t *emitter, yaml_node_t *node, yaml_char_t *anchor)
#define STACK_DEL(context, stack)
yaml_node_t * top
The top of the stack.
struct yaml_node_s::@29::@30 scalar
The scalar parameters (for YAML_SCALAR_NODE).
#define DOCUMENT_END_EVENT_INIT(event, event_implicit, start_mark, end_mark)
static int yaml_emitter_dump_alias(yaml_emitter_t *emitter, yaml_char_t *anchor)
#define MAPPING_END_EVENT_INIT(event, start_mark, end_mark)
yaml_version_directive_t * version_directive
The version directive.
yaml_char_t * anchor
The anchor value.
int value
The value of the element.
struct yaml_node_s::@29::@31 sequence
The sequence parameters (for YAML_SEQUENCE_NODE).
static int yaml_emitter_dump_mapping(yaml_emitter_t *emitter, yaml_node_t *node, yaml_char_t *anchor)
#define DOCUMENT_START_EVENT_INIT(event, event_version_directive,event_tag_directives_start, event_tag_directives_end, event_implicit, start_mark, end_mark)
#define YAML_DEFAULT_SCALAR_TAG
The default scalar tag is !!str.
struct yaml_document_s::@35 nodes
The document nodes.
yaml_node_t * start
The beginning of the stack.
static VALUE mark(VALUE self)
static int yaml_emitter_dump_sequence(yaml_emitter_t *emitter, yaml_node_t *node, yaml_char_t *anchor)
yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document)
Emit a YAML document.
#define assert(condition)
yaml_emitter_open(yaml_emitter_t *emitter)
Start a YAML stream.
#define YAML_DEFAULT_MAPPING_TAG
The default mapping tag is !!map.
struct yaml_emitter_s::@58 * anchors
The information associated with the document nodes.