source: pyyaml/trunk/ext/_yaml.pxd @ 334

Revision 334, 8.9 KB checked in by xi, 5 years ago (diff)

Fixed str/bytes issues with Python 3 in _yaml.pyx.

RevLine 
[195]1
2cdef extern from "_yaml.h":
3
[223]4    void malloc(int l)
[209]5    void memcpy(char *d, char *s, int l)
6    int strlen(char *s)
[195]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)
[334]12    object PyUnicode_FromString(char *u)
13    object PyUnicode_DecodeUTF8(char *u, int s, char *e)
[209]14    object PyUnicode_AsUTF8String(object o)
[334]15    int PY_MAJOR_VERSION
[195]16
[223]17    ctypedef enum:
18        SIZEOF_VOID_P
19    ctypedef enum yaml_encoding_t:
[195]20        YAML_ANY_ENCODING
21        YAML_UTF8_ENCODING
22        YAML_UTF16LE_ENCODING
23        YAML_UTF16BE_ENCODING
[223]24    ctypedef enum yaml_break_t:
25        YAML_ANY_BREAK
26        YAML_CR_BREAK
27        YAML_LN_BREAK
28        YAML_CRLN_BREAK
29    ctypedef enum yaml_error_type_t:
[195]30        YAML_NO_ERROR
31        YAML_MEMORY_ERROR
32        YAML_READER_ERROR
33        YAML_SCANNER_ERROR
34        YAML_PARSER_ERROR
35        YAML_WRITER_ERROR
36        YAML_EMITTER_ERROR
[223]37    ctypedef enum yaml_scalar_style_t:
[195]38        YAML_ANY_SCALAR_STYLE
39        YAML_PLAIN_SCALAR_STYLE
40        YAML_SINGLE_QUOTED_SCALAR_STYLE
41        YAML_DOUBLE_QUOTED_SCALAR_STYLE
42        YAML_LITERAL_SCALAR_STYLE
43        YAML_FOLDED_SCALAR_STYLE
[223]44    ctypedef enum yaml_sequence_style_t:
[195]45        YAML_ANY_SEQUENCE_STYLE
46        YAML_BLOCK_SEQUENCE_STYLE
47        YAML_FLOW_SEQUENCE_STYLE
[223]48    ctypedef enum yaml_mapping_style_t:
[195]49        YAML_ANY_MAPPING_STYLE
50        YAML_BLOCK_MAPPING_STYLE
51        YAML_FLOW_MAPPING_STYLE
[223]52    ctypedef enum yaml_token_type_t:
[209]53        YAML_NO_TOKEN
[195]54        YAML_STREAM_START_TOKEN
55        YAML_STREAM_END_TOKEN
56        YAML_VERSION_DIRECTIVE_TOKEN
57        YAML_TAG_DIRECTIVE_TOKEN
58        YAML_DOCUMENT_START_TOKEN
59        YAML_DOCUMENT_END_TOKEN
60        YAML_BLOCK_SEQUENCE_START_TOKEN
61        YAML_BLOCK_MAPPING_START_TOKEN
62        YAML_BLOCK_END_TOKEN
63        YAML_FLOW_SEQUENCE_START_TOKEN
64        YAML_FLOW_SEQUENCE_END_TOKEN
65        YAML_FLOW_MAPPING_START_TOKEN
66        YAML_FLOW_MAPPING_END_TOKEN
67        YAML_BLOCK_ENTRY_TOKEN
68        YAML_FLOW_ENTRY_TOKEN
69        YAML_KEY_TOKEN
70        YAML_VALUE_TOKEN
71        YAML_ALIAS_TOKEN
72        YAML_ANCHOR_TOKEN
73        YAML_TAG_TOKEN
74        YAML_SCALAR_TOKEN
[223]75    ctypedef enum yaml_event_type_t:
[209]76        YAML_NO_EVENT
[205]77        YAML_STREAM_START_EVENT
78        YAML_STREAM_END_EVENT
79        YAML_DOCUMENT_START_EVENT
80        YAML_DOCUMENT_END_EVENT
81        YAML_ALIAS_EVENT
82        YAML_SCALAR_EVENT
83        YAML_SEQUENCE_START_EVENT
84        YAML_SEQUENCE_END_EVENT
85        YAML_MAPPING_START_EVENT
86        YAML_MAPPING_END_EVENT
[195]87
88    ctypedef int yaml_read_handler_t(void *data, char *buffer,
[209]89            int size, int *size_read) except 0
[195]90
[223]91    ctypedef int yaml_write_handler_t(void *data, char *buffer,
92            int size) except 0
93
[195]94    ctypedef struct yaml_mark_t:
95        int index
96        int line
97        int column
[205]98    ctypedef struct yaml_version_directive_t:
99        int major
100        int minor
101    ctypedef struct yaml_tag_directive_t:
102        char *handle
103        char *prefix
104
105    ctypedef struct _yaml_token_stream_start_data_t:
106        yaml_encoding_t encoding
107    ctypedef struct _yaml_token_alias_data_t:
108        char *value
109    ctypedef struct _yaml_token_anchor_data_t:
110        char *value
[195]111    ctypedef struct _yaml_token_tag_data_t:
112        char *handle
113        char *suffix
114    ctypedef struct _yaml_token_scalar_data_t:
115        char *value
116        int length
117        yaml_scalar_style_t style
118    ctypedef struct _yaml_token_version_directive_data_t:
119        int major
120        int minor
121    ctypedef struct _yaml_token_tag_directive_data_t:
122        char *handle
123        char *prefix
124    ctypedef union _yaml_token_data_t:
[205]125        _yaml_token_stream_start_data_t stream_start
126        _yaml_token_alias_data_t alias
127        _yaml_token_anchor_data_t anchor
[195]128        _yaml_token_tag_data_t tag
129        _yaml_token_scalar_data_t scalar
130        _yaml_token_version_directive_data_t version_directive
131        _yaml_token_tag_directive_data_t tag_directive
132    ctypedef struct yaml_token_t:
133        yaml_token_type_t type
134        _yaml_token_data_t data
135        yaml_mark_t start_mark
136        yaml_mark_t end_mark
[205]137
138    ctypedef struct _yaml_event_stream_start_data_t:
139        yaml_encoding_t encoding
[223]140    ctypedef struct _yaml_event_document_start_data_tag_directives_t:
141        yaml_tag_directive_t *start
142        yaml_tag_directive_t *end
[205]143    ctypedef struct _yaml_event_document_start_data_t:
144        yaml_version_directive_t *version_directive
[223]145        _yaml_event_document_start_data_tag_directives_t tag_directives
[205]146        int implicit
147    ctypedef struct _yaml_event_document_end_data_t:
148        int implicit
149    ctypedef struct _yaml_event_alias_data_t:
150        char *anchor
151    ctypedef struct _yaml_event_scalar_data_t:
152        char *anchor
153        char *tag
154        char *value
155        int length
156        int plain_implicit
157        int quoted_implicit
158        yaml_scalar_style_t style
159    ctypedef struct _yaml_event_sequence_start_data_t:
160        char *anchor
161        char *tag
162        int implicit
163        yaml_sequence_style_t style
164    ctypedef struct _yaml_event_mapping_start_data_t:
165        char *anchor
166        char *tag
167        int implicit
168        yaml_mapping_style_t style
169    ctypedef union _yaml_event_data_t:
170        _yaml_event_stream_start_data_t stream_start
171        _yaml_event_document_start_data_t document_start
172        _yaml_event_document_end_data_t document_end
173        _yaml_event_alias_data_t alias
174        _yaml_event_scalar_data_t scalar
175        _yaml_event_sequence_start_data_t sequence_start
176        _yaml_event_mapping_start_data_t mapping_start
177    ctypedef struct yaml_event_t:
178        yaml_event_type_t type
179        _yaml_event_data_t data
180        yaml_mark_t start_mark
181        yaml_mark_t end_mark
182
[195]183    ctypedef struct yaml_parser_t:
184        yaml_error_type_t error
185        char *problem
186        int problem_offset
187        int problem_value
188        yaml_mark_t problem_mark
189        char *context
190        yaml_mark_t context_mark
191
[223]192    ctypedef struct yaml_emitter_t:
193        yaml_error_type_t error
194        char *problem
195
[195]196    char *yaml_get_version_string()
197    void yaml_get_version(int *major, int *minor, int *patch)
[223]198
[195]199    void yaml_token_delete(yaml_token_t *token)
[223]200
201    int yaml_stream_start_event_initialize(yaml_event_t *event,
202            yaml_encoding_t encoding)
203    int yaml_stream_end_event_initialize(yaml_event_t *event)
204    int yaml_document_start_event_initialize(yaml_event_t *event,
205            yaml_version_directive_t *version_directive,
206            yaml_tag_directive_t *tag_directives_start,
207            yaml_tag_directive_t *tag_directives_end,
208            int implicit)
209    int yaml_document_end_event_initialize(yaml_event_t *event,
210            int implicit)
211    int yaml_alias_event_initialize(yaml_event_t *event, char *anchor)
212    int yaml_scalar_event_initialize(yaml_event_t *event,
213            char *anchor, char *tag, char *value, int length,
214            int plain_implicit, int quoted_implicit,
215            yaml_scalar_style_t style)
216    int yaml_sequence_start_event_initialize(yaml_event_t *event,
217            char *anchor, char *tag, int implicit, yaml_sequence_style_t style)
218    int yaml_sequence_end_event_initialize(yaml_event_t *event)
219    int yaml_mapping_start_event_initialize(yaml_event_t *event,
220            char *anchor, char *tag, int implicit, yaml_mapping_style_t style)
221    int yaml_mapping_end_event_initialize(yaml_event_t *event)
[205]222    void yaml_event_delete(yaml_event_t *event)
[223]223
[209]224    int yaml_parser_initialize(yaml_parser_t *parser)
[195]225    void yaml_parser_delete(yaml_parser_t *parser)
226    void yaml_parser_set_input_string(yaml_parser_t *parser,
227            char *input, int size)
228    void yaml_parser_set_input(yaml_parser_t *parser,
229            yaml_read_handler_t *handler, void *data)
230    void yaml_parser_set_encoding(yaml_parser_t *parser,
231            yaml_encoding_t encoding)
[209]232    int yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token) except *
233    int yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event) except *
[195]234
[223]235    int yaml_emitter_initialize(yaml_emitter_t *emitter)
236    void yaml_emitter_delete(yaml_emitter_t *emitter)
237    void yaml_emitter_set_output_string(yaml_emitter_t *emitter,
238            char *output, int size, int *size_written)
239    void yaml_emitter_set_output(yaml_emitter_t *emitter,
240            yaml_write_handler_t *handler, void *data)
241    void yaml_emitter_set_encoding(yaml_emitter_t *emitter,
242            yaml_encoding_t encoding)
243    void yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical)
244    void yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
245    void yaml_emitter_set_width(yaml_emitter_t *emitter, int width)
246    void yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
247    void yaml_emitter_set_break(yaml_emitter_t *emitter,
248            yaml_break_t line_break)
249    int yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event) except *
250    int yaml_emitter_flush(yaml_emitter_t *emitter)
251
Note: See TracBrowser for help on using the repository browser.