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