2 cdef extern from "_yaml.h":
5 void memcpy(char *d, char *s, int l)
7 int PyString_CheckExact(object o)
8 int PyUnicode_CheckExact(object o)
9 char *PyString_AS_STRING(object o)
10 int PyString_GET_SIZE(object o)
11 object PyString_FromStringAndSize(char *v, int l)
12 object PyUnicode_DecodeUTF8(char *s, int s, char *e)
13 object PyUnicode_AsUTF8String(object o)
17 ctypedef enum yaml_encoding_t:
22 ctypedef enum yaml_break_t:
27 ctypedef enum yaml_error_type_t:
35 ctypedef enum yaml_scalar_style_t:
37 YAML_PLAIN_SCALAR_STYLE
38 YAML_SINGLE_QUOTED_SCALAR_STYLE
39 YAML_DOUBLE_QUOTED_SCALAR_STYLE
40 YAML_LITERAL_SCALAR_STYLE
41 YAML_FOLDED_SCALAR_STYLE
42 ctypedef enum yaml_sequence_style_t:
43 YAML_ANY_SEQUENCE_STYLE
44 YAML_BLOCK_SEQUENCE_STYLE
45 YAML_FLOW_SEQUENCE_STYLE
46 ctypedef enum yaml_mapping_style_t:
47 YAML_ANY_MAPPING_STYLE
48 YAML_BLOCK_MAPPING_STYLE
49 YAML_FLOW_MAPPING_STYLE
50 ctypedef enum yaml_token_type_t:
52 YAML_STREAM_START_TOKEN
54 YAML_VERSION_DIRECTIVE_TOKEN
55 YAML_TAG_DIRECTIVE_TOKEN
56 YAML_DOCUMENT_START_TOKEN
57 YAML_DOCUMENT_END_TOKEN
58 YAML_BLOCK_SEQUENCE_START_TOKEN
59 YAML_BLOCK_MAPPING_START_TOKEN
61 YAML_FLOW_SEQUENCE_START_TOKEN
62 YAML_FLOW_SEQUENCE_END_TOKEN
63 YAML_FLOW_MAPPING_START_TOKEN
64 YAML_FLOW_MAPPING_END_TOKEN
65 YAML_BLOCK_ENTRY_TOKEN
73 ctypedef enum yaml_event_type_t:
75 YAML_STREAM_START_EVENT
77 YAML_DOCUMENT_START_EVENT
78 YAML_DOCUMENT_END_EVENT
81 YAML_SEQUENCE_START_EVENT
82 YAML_SEQUENCE_END_EVENT
83 YAML_MAPPING_START_EVENT
84 YAML_MAPPING_END_EVENT
86 ctypedef int yaml_read_handler_t(void *data, char *buffer,
87 int size, int *size_read) except 0
89 ctypedef int yaml_write_handler_t(void *data, char *buffer,
92 ctypedef struct yaml_mark_t:
96 ctypedef struct yaml_version_directive_t:
99 ctypedef struct yaml_tag_directive_t:
103 ctypedef struct _yaml_token_stream_start_data_t:
104 yaml_encoding_t encoding
105 ctypedef struct _yaml_token_alias_data_t:
107 ctypedef struct _yaml_token_anchor_data_t:
109 ctypedef struct _yaml_token_tag_data_t:
112 ctypedef struct _yaml_token_scalar_data_t:
115 yaml_scalar_style_t style
116 ctypedef struct _yaml_token_version_directive_data_t:
119 ctypedef struct _yaml_token_tag_directive_data_t:
122 ctypedef union _yaml_token_data_t:
123 _yaml_token_stream_start_data_t stream_start
124 _yaml_token_alias_data_t alias
125 _yaml_token_anchor_data_t anchor
126 _yaml_token_tag_data_t tag
127 _yaml_token_scalar_data_t scalar
128 _yaml_token_version_directive_data_t version_directive
129 _yaml_token_tag_directive_data_t tag_directive
130 ctypedef struct yaml_token_t:
131 yaml_token_type_t type
132 _yaml_token_data_t data
133 yaml_mark_t start_mark
136 ctypedef struct _yaml_event_stream_start_data_t:
137 yaml_encoding_t encoding
138 ctypedef struct _yaml_event_document_start_data_tag_directives_t:
139 yaml_tag_directive_t *start
140 yaml_tag_directive_t *end
141 ctypedef struct _yaml_event_document_start_data_t:
142 yaml_version_directive_t *version_directive
143 _yaml_event_document_start_data_tag_directives_t tag_directives
145 ctypedef struct _yaml_event_document_end_data_t:
147 ctypedef struct _yaml_event_alias_data_t:
149 ctypedef struct _yaml_event_scalar_data_t:
156 yaml_scalar_style_t style
157 ctypedef struct _yaml_event_sequence_start_data_t:
161 yaml_sequence_style_t style
162 ctypedef struct _yaml_event_mapping_start_data_t:
166 yaml_mapping_style_t style
167 ctypedef union _yaml_event_data_t:
168 _yaml_event_stream_start_data_t stream_start
169 _yaml_event_document_start_data_t document_start
170 _yaml_event_document_end_data_t document_end
171 _yaml_event_alias_data_t alias
172 _yaml_event_scalar_data_t scalar
173 _yaml_event_sequence_start_data_t sequence_start
174 _yaml_event_mapping_start_data_t mapping_start
175 ctypedef struct yaml_event_t:
176 yaml_event_type_t type
177 _yaml_event_data_t data
178 yaml_mark_t start_mark
181 ctypedef struct yaml_parser_t:
182 yaml_error_type_t error
186 yaml_mark_t problem_mark
188 yaml_mark_t context_mark
190 ctypedef struct yaml_emitter_t:
191 yaml_error_type_t error
194 char *yaml_get_version_string()
195 void yaml_get_version(int *major, int *minor, int *patch)
197 void yaml_token_delete(yaml_token_t *token)
199 int yaml_stream_start_event_initialize(yaml_event_t *event,
200 yaml_encoding_t encoding)
201 int yaml_stream_end_event_initialize(yaml_event_t *event)
202 int yaml_document_start_event_initialize(yaml_event_t *event,
203 yaml_version_directive_t *version_directive,
204 yaml_tag_directive_t *tag_directives_start,
205 yaml_tag_directive_t *tag_directives_end,
207 int yaml_document_end_event_initialize(yaml_event_t *event,
209 int yaml_alias_event_initialize(yaml_event_t *event, char *anchor)
210 int yaml_scalar_event_initialize(yaml_event_t *event,
211 char *anchor, char *tag, char *value, int length,
212 int plain_implicit, int quoted_implicit,
213 yaml_scalar_style_t style)
214 int yaml_sequence_start_event_initialize(yaml_event_t *event,
215 char *anchor, char *tag, int implicit, yaml_sequence_style_t style)
216 int yaml_sequence_end_event_initialize(yaml_event_t *event)
217 int yaml_mapping_start_event_initialize(yaml_event_t *event,
218 char *anchor, char *tag, int implicit, yaml_mapping_style_t style)
219 int yaml_mapping_end_event_initialize(yaml_event_t *event)
220 void yaml_event_delete(yaml_event_t *event)
222 int yaml_parser_initialize(yaml_parser_t *parser)
223 void yaml_parser_delete(yaml_parser_t *parser)
224 void yaml_parser_set_input_string(yaml_parser_t *parser,
225 char *input, int size)
226 void yaml_parser_set_input(yaml_parser_t *parser,
227 yaml_read_handler_t *handler, void *data)
228 void yaml_parser_set_encoding(yaml_parser_t *parser,
229 yaml_encoding_t encoding)
230 int yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token) except *
231 int yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event) except *
233 int yaml_emitter_initialize(yaml_emitter_t *emitter)
234 void yaml_emitter_delete(yaml_emitter_t *emitter)
235 void yaml_emitter_set_output_string(yaml_emitter_t *emitter,
236 char *output, int size, int *size_written)
237 void yaml_emitter_set_output(yaml_emitter_t *emitter,
238 yaml_write_handler_t *handler, void *data)
239 void yaml_emitter_set_encoding(yaml_emitter_t *emitter,
240 yaml_encoding_t encoding)
241 void yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical)
242 void yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
243 void yaml_emitter_set_width(yaml_emitter_t *emitter, int width)
244 void yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
245 void yaml_emitter_set_break(yaml_emitter_t *emitter,
246 yaml_break_t line_break)
247 int yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event) except *
248 int yaml_emitter_flush(yaml_emitter_t *emitter)