Update libyaml bindings.
[pyyaml/python3.git] / ext / _yaml.pxd
blobadf3ad28d1a8c6288c9cf9929f21a771655929e9
2 cdef extern from "_yaml.h":
4     void memcpy(char *d, char *s, int l)
5     int strlen(char *s)
6     int PyString_CheckExact(object o)
7     int PyUnicode_CheckExact(object o)
8     char *PyString_AS_STRING(object o)
9     int PyString_GET_SIZE(object o)
10     object PyString_FromStringAndSize(char *v, int l)
11     object PyUnicode_DecodeUTF8(char *s, int s, char *e)
12     object PyUnicode_AsUTF8String(object o)
14     cdef enum yaml_encoding_t:
15         YAML_ANY_ENCODING
16         YAML_UTF8_ENCODING
17         YAML_UTF16LE_ENCODING
18         YAML_UTF16BE_ENCODING
19     cdef enum yaml_error_type_t:
20         YAML_NO_ERROR
21         YAML_MEMORY_ERROR
22         YAML_READER_ERROR
23         YAML_SCANNER_ERROR
24         YAML_PARSER_ERROR
25         YAML_WRITER_ERROR
26         YAML_EMITTER_ERROR
27     cdef enum yaml_scalar_style_t:
28         YAML_ANY_SCALAR_STYLE
29         YAML_PLAIN_SCALAR_STYLE
30         YAML_SINGLE_QUOTED_SCALAR_STYLE
31         YAML_DOUBLE_QUOTED_SCALAR_STYLE
32         YAML_LITERAL_SCALAR_STYLE
33         YAML_FOLDED_SCALAR_STYLE
34     cdef enum yaml_sequence_style_t:
35         YAML_ANY_SEQUENCE_STYLE
36         YAML_BLOCK_SEQUENCE_STYLE
37         YAML_FLOW_SEQUENCE_STYLE
38     cdef enum yaml_mapping_style_t:
39         YAML_ANY_MAPPING_STYLE
40         YAML_BLOCK_MAPPING_STYLE
41         YAML_FLOW_MAPPING_STYLE
42     cdef enum yaml_token_type_t:
43         YAML_NO_TOKEN
44         YAML_STREAM_START_TOKEN
45         YAML_STREAM_END_TOKEN
46         YAML_VERSION_DIRECTIVE_TOKEN
47         YAML_TAG_DIRECTIVE_TOKEN
48         YAML_DOCUMENT_START_TOKEN
49         YAML_DOCUMENT_END_TOKEN
50         YAML_BLOCK_SEQUENCE_START_TOKEN
51         YAML_BLOCK_MAPPING_START_TOKEN
52         YAML_BLOCK_END_TOKEN
53         YAML_FLOW_SEQUENCE_START_TOKEN
54         YAML_FLOW_SEQUENCE_END_TOKEN
55         YAML_FLOW_MAPPING_START_TOKEN
56         YAML_FLOW_MAPPING_END_TOKEN
57         YAML_BLOCK_ENTRY_TOKEN
58         YAML_FLOW_ENTRY_TOKEN
59         YAML_KEY_TOKEN
60         YAML_VALUE_TOKEN
61         YAML_ALIAS_TOKEN
62         YAML_ANCHOR_TOKEN
63         YAML_TAG_TOKEN
64         YAML_SCALAR_TOKEN
65     cdef enum yaml_event_type_t:
66         YAML_NO_EVENT
67         YAML_STREAM_START_EVENT
68         YAML_STREAM_END_EVENT
69         YAML_DOCUMENT_START_EVENT
70         YAML_DOCUMENT_END_EVENT
71         YAML_ALIAS_EVENT
72         YAML_SCALAR_EVENT
73         YAML_SEQUENCE_START_EVENT
74         YAML_SEQUENCE_END_EVENT
75         YAML_MAPPING_START_EVENT
76         YAML_MAPPING_END_EVENT
78     ctypedef int yaml_read_handler_t(void *data, char *buffer,
79             int size, int *size_read) except 0
81     ctypedef struct yaml_mark_t:
82         int index
83         int line
84         int column
85     ctypedef struct yaml_version_directive_t:
86         int major
87         int minor
88     ctypedef struct yaml_tag_directive_t:
89         char *handle
90         char *prefix
92     ctypedef struct _yaml_token_stream_start_data_t:
93         yaml_encoding_t encoding
94     ctypedef struct _yaml_token_alias_data_t:
95         char *value
96     ctypedef struct _yaml_token_anchor_data_t:
97         char *value
98     ctypedef struct _yaml_token_tag_data_t:
99         char *handle
100         char *suffix
101     ctypedef struct _yaml_token_scalar_data_t:
102         char *value
103         int length
104         yaml_scalar_style_t style
105     ctypedef struct _yaml_token_version_directive_data_t:
106         int major
107         int minor
108     ctypedef struct _yaml_token_tag_directive_data_t:
109         char *handle
110         char *prefix
111     ctypedef union _yaml_token_data_t:
112         _yaml_token_stream_start_data_t stream_start
113         _yaml_token_alias_data_t alias
114         _yaml_token_anchor_data_t anchor
115         _yaml_token_tag_data_t tag
116         _yaml_token_scalar_data_t scalar
117         _yaml_token_version_directive_data_t version_directive
118         _yaml_token_tag_directive_data_t tag_directive
119     ctypedef struct yaml_token_t:
120         yaml_token_type_t type
121         _yaml_token_data_t data
122         yaml_mark_t start_mark
123         yaml_mark_t end_mark
125     ctypedef struct _yaml_event_stream_start_data_t:
126         yaml_encoding_t encoding
127     ctypedef struct _yaml_event_document_start_data_t:
128         yaml_version_directive_t *version_directive
129         yaml_tag_directive_t **tag_directives
130         int implicit
131     ctypedef struct _yaml_event_document_end_data_t:
132         int implicit
133     ctypedef struct _yaml_event_alias_data_t:
134         char *anchor
135     ctypedef struct _yaml_event_scalar_data_t:
136         char *anchor
137         char *tag
138         char *value
139         int length
140         int plain_implicit
141         int quoted_implicit
142         yaml_scalar_style_t style
143     ctypedef struct _yaml_event_sequence_start_data_t:
144         char *anchor
145         char *tag
146         int implicit
147         yaml_sequence_style_t style
148     ctypedef struct _yaml_event_mapping_start_data_t:
149         char *anchor
150         char *tag
151         int implicit
152         yaml_mapping_style_t style
153     ctypedef union _yaml_event_data_t:
154         _yaml_event_stream_start_data_t stream_start
155         _yaml_event_document_start_data_t document_start
156         _yaml_event_document_end_data_t document_end
157         _yaml_event_alias_data_t alias
158         _yaml_event_scalar_data_t scalar
159         _yaml_event_sequence_start_data_t sequence_start
160         _yaml_event_mapping_start_data_t mapping_start
161     ctypedef struct yaml_event_t:
162         yaml_event_type_t type
163         _yaml_event_data_t data
164         yaml_mark_t start_mark
165         yaml_mark_t end_mark
167     ctypedef struct yaml_parser_t:
168         yaml_error_type_t error
169         char *problem
170         int problem_offset
171         int problem_value
172         yaml_mark_t problem_mark
173         char *context
174         yaml_mark_t context_mark
176     char *yaml_get_version_string()
177     void yaml_get_version(int *major, int *minor, int *patch)
178     void yaml_token_delete(yaml_token_t *token)
179     void yaml_event_delete(yaml_event_t *event)
180     int yaml_parser_initialize(yaml_parser_t *parser)
181     void yaml_parser_delete(yaml_parser_t *parser)
182     void yaml_parser_set_input_string(yaml_parser_t *parser,
183             char *input, int size)
184     void yaml_parser_set_input(yaml_parser_t *parser,
185             yaml_read_handler_t *handler, void *data)
186     void yaml_parser_set_encoding(yaml_parser_t *parser,
187             yaml_encoding_t encoding)
188     int yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token) except *
189     int yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event) except *