node.c File Reference
`#include "ruby/ruby.h"`
`#include "syck.h"`

Go to the source code of this file.

## Functions

SyckNode * | syck_alloc_node (enum syck_kind_tag type)
void | syck_free_node (SyckNode *n)
SyckNode * | syck_alloc_map (void)
SyckNode * | syck_alloc_seq (void)
SyckNode * | syck_alloc_str (void)
SyckNode * | syck_new_str (const char *str, enum scalar_style style)
SyckNode * | syck_new_str2 (const char *str, long len, enum scalar_style style)
void | syck_replace_str (SyckNode *n, char *str, enum scalar_style style)
void | syck_replace_str2 (SyckNode *n, char *str, long len, enum scalar_style style)
void | syck_str_blow_away_commas (SyckNode *n)
char * | syck_str_read (SyckNode *n)
SyckNode * | syck_new_map (SYMID key, SYMID value)
void | syck_map_empty (SyckNode *n)
void | syck_map_add (SyckNode *map, SYMID key, SYMID value)
void | syck_map_update (SyckNode *map1, SyckNode *map2)
long | syck_map_count (SyckNode *map)
void | syck_map_assign (SyckNode *map, enum map_part p, long idx, SYMID id)
SYMID | syck_map_read (SyckNode *map, enum map_part p, long idx)
SyckNode * | syck_new_seq (SYMID value)
void | syck_seq_empty (SyckNode *n)
void | syck_seq_add (SyckNode *arr, SYMID value)
long | syck_seq_count (SyckNode *seq)
void | syck_seq_assign (SyckNode *seq, long idx, SYMID id)
SYMID | syck_seq_read (SyckNode *seq, long idx)
void | syck_free_members (SyckNode *n)

## Function Documentation

SyckNode* syck_alloc_map | ( | void |  | ) |

Definition at line 48 of file node.c.

References ALLOC_CT, _syck_node::data, map_none, _syck_node::pairs, S_ALLOC, S_ALLOC_N, syck_alloc_node(), syck_map_kind, and SYMID.

Referenced by syck_map_alloc(), syck_new_map(), syck_node_transform(), and yyparse().

SyckNode* syck_alloc_node | ( | enum syck_kind_tag | type | ) |

Definition at line 16 of file node.c.

References _syck_node::anchor, _syck_node::id, _syck_node::kind, NULL, S_ALLOC, _syck_node::shortcut, type, and _syck_node::type_id.

Referenced by syck_alloc_map(), syck_alloc_seq(), and syck_alloc_str().

SyckNode* syck_alloc_seq | ( | void |  | ) |

Definition at line 67 of file node.c.

References ALLOC_CT, _syck_node::data, _syck_node::list, S_ALLOC, S_ALLOC_N, seq_none, syck_alloc_node(), syck_seq_kind, and SYMID.

Referenced by syck_new_seq(), syck_node_transform(), syck_seq_alloc(), and yyparse().

SyckNode* syck_alloc_str | ( | void |  | ) |

Definition at line 85 of file node.c.

References _syck_node::data, NULL, S_ALLOC, scalar_none, _syck_node::str, syck_alloc_node(), and syck_str_kind.

Referenced by syck_new_str2(), syck_scalar_alloc(), sycklex_bytecode_utf8(), and sycklex_yaml_utf8().

void syck_free_members | ( | SyckNode * | n | ) |

Definition at line 370 of file node.c.

References _syck_node::data, _syck_node::kind, _syck_node::list, NULL, _syck_node::pairs, S_FREE, _syck_node::str, syck_map_kind, syck_seq_kind, and syck_str_kind.

Referenced by syck_free_node().

void syck_free_node | ( | SyckNode * | n | ) |

Definition at line 31 of file node.c.

References _syck_node::anchor, NULL, S_FREE, syck_free_members(), and _syck_node::type_id.

Referenced by syck_hdlr_add_anchor(), syck_hdlr_add_node(), syck_hdlr_remove_anchor(), syck_map_alloc(), syck_node_transform(), syck_scalar_alloc(), syck_seq_alloc(), syck_st_free_nodes(), and yyparse().

void syck_map_add | ( | SyckNode * | map,
|  | SYMID | key,
|  | SYMID | value
| ) |  |

Definition at line 197 of file node.c.

References ALLOC_CT, ASSERT, _syck_node::data, NULL, _syck_node::pairs, S_REALLOC_N, and SYMID.

Referenced by syck_map_add_m(), syck_map_initialize(), syck_map_value_set(), syck_new_map(), and syck_node_transform().

void syck_map_assign | ( | SyckNode * | map,
|  | enum map_part | p,
|  | long | idx,
|  | SYMID | id
| ) |  |

Definition at line 259 of file node.c.

References ASSERT, _syck_node::data, id, map_key, NULL, and _syck_node::pairs.

Referenced by apply_seq_in_map().

long syck_map_count | ( | SyckNode * | map | ) |

Definition at line 251 of file node.c.

References ASSERT, _syck_node::data, NULL, and _syck_node::pairs.

Referenced by apply_seq_in_map(), and syck_genericresolver_node_import().

void syck_map_empty | ( | SyckNode * | n | ) |

Definition at line 181 of file node.c.

References ALLOC_CT, ASSERT, _syck_node::data, _syck_node::list, NULL, _syck_node::pairs, S_ALLOC_N, S_FREE, and SYMID.

Referenced by syck_map_value_set().

SYMID syck_map_read | ( | SyckNode * | map,
|  | enum map_part | p,
|  | long | idx
| ) |  |

Definition at line 277 of file node.c.

References ASSERT, _syck_node::data, map_key, NULL, and _syck_node::pairs.

Referenced by rb_syck_emitter_handler(), syck_genericresolver_node_import(), syck_node_mark(), syck_node_transform(), syck_resolver_node_import(), syck_yaml2byte_handler(), and yaml_org_handler().

void syck_map_update | ( | SyckNode * | map1,
|  | SyckNode * | map2
| ) |  |

Definition at line 219 of file node.c.

References ALLOC_CT, ASSERT, _syck_node::data, NULL, _syck_node::pairs, S_REALLOC_N, and SYMID.

Referenced by yyparse().

SyckNode* syck_new_map | ( | SYMID | key,
|  | SYMID | value
| ) |  |

Definition at line 170 of file node.c.

References syck_alloc_map(), and syck_map_add().

Referenced by rb_syck_bad_anchor_handler(), and yyparse().

SyckNode* syck_new_seq | ( | SYMID | value | ) |

Definition at line 295 of file node.c.

References syck_alloc_seq(), and syck_seq_add().

Referenced by yyparse().

SyckNode* syck_new_str | ( | const char * | str,
|  | enum scalar_style | style
| ) |  |

Definition at line 102 of file node.c.

References strlen(), and syck_new_str2().

SyckNode* syck_new_str2 | ( | const char * | str,
|  | long | len,
|  | enum scalar_style | style
| ) |  |

Definition at line 108 of file node.c.

References _syck_node::data, len, S_ALLOC_N, _syck_node::str, and syck_alloc_str().

Referenced by syck_new_str(), and syck_node_transform().

void syck_replace_str | ( | SyckNode * | n,
|  | char * | str,
|  | enum scalar_style | style
| ) |  |

Definition at line 123 of file node.c.

References strlen(), and syck_replace_str2().

void syck_replace_str2 | ( | SyckNode * | n,
|  | char * | str,
|  | long | len,
|  | enum scalar_style | style
| ) |  |

Definition at line 129 of file node.c.

References _syck_node::data, len, NULL, S_ALLOC_N, S_FREE, and _syck_node::str.

Referenced by syck_replace_str().

void syck_seq_add | ( | SyckNode * | arr,
|  | SYMID | value
| ) |  |

Definition at line 320 of file node.c.

References ALLOC_CT, ASSERT, _syck_node::data, _syck_node::list, NULL, S_REALLOC_N, and SYMID.

Referenced by syck_new_seq(), syck_node_transform(), syck_seq_add_m(), syck_seq_value_set(), and yyparse().

void syck_seq_assign | ( | SyckNode * | seq,
|  | long | idx,
|  | SYMID | id
| ) |  |

Definition at line 348 of file node.c.

References ASSERT, _syck_node::data, id, _syck_node::list, and NULL.

long syck_seq_count | ( | SyckNode * | seq | ) |

Definition at line 340 of file node.c.

References ASSERT, _syck_node::data, _syck_node::list, and NULL.

Referenced by syck_genericresolver_node_import().

void syck_seq_empty | ( | SyckNode * | n | ) |

Definition at line 306 of file node.c.

References ALLOC_CT, ASSERT, _syck_node::data, _syck_node::list, NULL, S_ALLOC_N, S_FREE, and SYMID.

Referenced by syck_seq_value_set().

SYMID syck_seq_read | ( | SyckNode * | seq,
|  | long | idx
| ) |  |

Definition at line 359 of file node.c.

References ASSERT, _syck_node::data, _syck_node::list, and NULL.

Referenced by rb_syck_emitter_handler(), syck_genericresolver_node_import(), syck_node_mark(), syck_node_transform(), syck_resolver_node_import(), syck_yaml2byte_handler(), and yaml_org_handler().

void syck_str_blow_away_commas | ( | SyckNode * | n | ) |

Definition at line 145 of file node.c.

References _syck_node::data, memmove(), and _syck_node::str.

Referenced by yaml_org_handler().

char* syck_str_read | ( | SyckNode * | n | ) |

Definition at line 163 of file node.c.

References ASSERT, _syck_node::data, NULL, and _syck_node::str.