yaml2byte.c File Reference
`#include "ruby/ruby.h"`
`#include <syck.h>`
`#include <assert.h>`
`#include "yamlbyte.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Data Structures

struct | bytestring_t

## Macros

#define | YAMLBYTE_UTF8
#define | TRACE0(a) do { printf(a); printf("\n"); fflush(stdout); } while(0)
#define | TRACE1(a, b) do { printf(a,b); printf("\n"); fflush(stdout); } while(0)
#define | TRACE2(a, b, c) do { printf(a,b,c); printf("\n"); fflush(stdout); } while(0)
#define | TRACE3(a, b, c, d) do { printf(a,b,c,d); printf("\n"); fflush(stdout); } while(0)
#define | CHUNKSIZE 64
#define | HASH ((long)0xCAFECAFE)

## Functions

bytestring_t * | bytestring_alloc (void)
void | bytestring_append (bytestring_t *str, char code, char *start, char *finish)
void | bytestring_extend (bytestring_t *str, bytestring_t *ext)
SYMID | syck_yaml2byte_handler (SyckParser *p, SyckNode *n)
char * | syck_yaml2byte (char *yamlstr)

## Macro Definition Documentation

#define CHUNKSIZE 64

Definition at line 28 of file yaml2byte.c.

Referenced by bytestring_alloc(), bytestring_append(), and bytestring_extend().

#define HASH ((long)0xCAFECAFE)

Definition at line 29 of file yaml2byte.c.

Referenced by bytestring_alloc(), bytestring_append(), and bytestring_extend().

#define TRACE0 | ( |  | a | ) | do { printf(a); printf("\n"); fflush(stdout); } while(0)

Definition at line 18 of file yaml2byte.c.

#define TRACE1 | ( |  | a,
|  |  | b
| ) |  | do { printf(a,b); printf("\n"); fflush(stdout); } while(0)

Definition at line 20 of file yaml2byte.c.

#define TRACE2 | ( |  | a,
|  |  | b,
|  |  | c
| ) |  | do { printf(a,b,c); printf("\n"); fflush(stdout); } while(0)

Definition at line 22 of file yaml2byte.c.

#define TRACE3 | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | do { printf(a,b,c,d); printf("\n"); fflush(stdout); } while(0)

Definition at line 24 of file yaml2byte.c.

#define YAMLBYTE_UTF8

Definition at line 14 of file yaml2byte.c.

## Function Documentation

bytestring_t* bytestring_alloc | ( | void |  | ) |

Definition at line 37 of file yaml2byte.c.

References bytestring_t::buffer, CHUNKSIZE, HASH, bytestring_t::hash, bytestring_t::length, bytestring_t::printed, bytestring_t::remaining, S_ALLOC, and S_ALLOC_N.

Referenced by syck_yaml2byte_handler().

void bytestring_append | ( | bytestring_t * | str,
|  | char | code,
|  | char * | start,
|  | char * | finish
| ) |  |

Definition at line 49 of file yaml2byte.c.

References assert, bytestring_t::buffer, CHUNKSIZE, HASH, bytestring_t::hash, bytestring_t::length, bytestring_t::remaining, S_REALLOC_N, and strlen().

Referenced by bytestring_extend(), and syck_yaml2byte_handler().

void bytestring_extend | ( | bytestring_t * | str,
|  | bytestring_t * | ext
| ) |  |

Definition at line 81 of file yaml2byte.c.

References assert, bytestring_t::buffer, bytestring_append(), CHUNKSIZE, HASH, bytestring_t::hash, bytestring_t::length, bytestring_t::printed, bytestring_t::remaining, S_REALLOC_N, YAMLBYTE_ALIAS, and YAMLBYTE_ANCHOR.

Referenced by syck_yaml2byte_handler().

char* syck_yaml2byte | ( | char * | yamlstr | ) |

Definition at line 217 of file yaml2byte.c.

References bytestring_t::buffer, NULL, S_ALLOC_N, strlen(), syck_free_parser(), syck_lookup_sym(), syck_new_parser(), syck_parse(), syck_parser_error_handler(), syck_parser_handler(), syck_parser_implicit_typing(), syck_parser_str_auto(), syck_parser_taguri_expansion(), syck_yaml2byte_handler(), and SYMID.

SYMID syck_yaml2byte_handler | ( | SyckParser * | p,
|  | SyckNode * | n
| ) |  |

Definition at line 118 of file yaml2byte.c.

References _syck_node::anchor, assert, bytestring_alloc(), bytestring_append(), bytestring_extend(), _syck_node::data, i, _syck_node::kind, _syck_node::list, map_key, map_value, NULL, _syck_node::pairs, S_ALLOC_N, S_FREE, _syck_node::str, strlen(), syck_add_sym(), syck_lookup_sym(), syck_map_kind, syck_map_read(), syck_seq_kind, syck_seq_read(), syck_str_kind, SYMID, _syck_node::type_id, YAMLBYTE_ANCHOR, YAMLBYTE_CONTINUE, YAMLBYTE_END_BRANCH, YAMLBYTE_MAPPING, YAMLBYTE_NEWLINE, YAMLBYTE_NULLCHAR, YAMLBYTE_SCALAR, YAMLBYTE_SEQUENCE, and YAMLBYTE_TRANSFER.

Referenced by rb_syck_compile(), and syck_yaml2byte().