source: trunk/packages/pyyaml/ext/_yaml.pxd @ 1685

Last change on this file since 1685 was 898, checked in by hartmans, 16 years ago

Add pyyaml and libyaml packages
backported from lenny.
There is discussion about how these should go in the repository; these are added in this form
in order to make forward progress.

File size: 8.8 KB
RevLine 
[898]1
2cdef extern from "_yaml.h":
3
4    void malloc(int l)
5    void memcpy(char *d, char *s, int l)
6    int strlen(char *s)
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)
14
15    ctypedef enum:
16        SIZEOF_VOID_P
17    ctypedef enum yaml_encoding_t:
18        YAML_ANY_ENCODING
19        YAML_UTF8_ENCODING
20        YAML_UTF16LE_ENCODING
21        YAML_UTF16BE_ENCODING
22    ctypedef enum yaml_break_t:
23        YAML_ANY_BREAK
24        YAML_CR_BREAK
25        YAML_LN_BREAK
26        YAML_CRLN_BREAK
27    ctypedef enum yaml_error_type_t:
28        YAML_NO_ERROR
29        YAML_MEMORY_ERROR
30        YAML_READER_ERROR
31        YAML_SCANNER_ERROR
32        YAML_PARSER_ERROR
33        YAML_WRITER_ERROR
34        YAML_EMITTER_ERROR
35    ctypedef enum yaml_scalar_style_t:
36        YAML_ANY_SCALAR_STYLE
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:
51        YAML_NO_TOKEN
52        YAML_STREAM_START_TOKEN
53        YAML_STREAM_END_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
60        YAML_BLOCK_END_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
66        YAML_FLOW_ENTRY_TOKEN
67        YAML_KEY_TOKEN
68        YAML_VALUE_TOKEN
69        YAML_ALIAS_TOKEN
70        YAML_ANCHOR_TOKEN
71        YAML_TAG_TOKEN
72        YAML_SCALAR_TOKEN
73    ctypedef enum yaml_event_type_t:
74        YAML_NO_EVENT
75        YAML_STREAM_START_EVENT
76        YAML_STREAM_END_EVENT
77        YAML_DOCUMENT_START_EVENT
78        YAML_DOCUMENT_END_EVENT
79        YAML_ALIAS_EVENT
80        YAML_SCALAR_EVENT
81        YAML_SEQUENCE_START_EVENT
82        YAML_SEQUENCE_END_EVENT
83        YAML_MAPPING_START_EVENT
84        YAML_MAPPING_END_EVENT
85
86    ctypedef int yaml_read_handler_t(void *data, char *buffer,
87            int size, int *size_read) except 0
88
89    ctypedef int yaml_write_handler_t(void *data, char *buffer,
90            int size) except 0
91
92    ctypedef struct yaml_mark_t:
93        int index
94        int line
95        int column
96    ctypedef struct yaml_version_directive_t:
97        int major
98        int minor
99    ctypedef struct yaml_tag_directive_t:
100        char *handle
101        char *prefix
102
103    ctypedef struct _yaml_token_stream_start_data_t:
104        yaml_encoding_t encoding
105    ctypedef struct _yaml_token_alias_data_t:
106        char *value
107    ctypedef struct _yaml_token_anchor_data_t:
108        char *value
109    ctypedef struct _yaml_token_tag_data_t:
110        char *handle
111        char *suffix
112    ctypedef struct _yaml_token_scalar_data_t:
113        char *value
114        int length
115        yaml_scalar_style_t style
116    ctypedef struct _yaml_token_version_directive_data_t:
117        int major
118        int minor
119    ctypedef struct _yaml_token_tag_directive_data_t:
120        char *handle
121        char *prefix
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
134        yaml_mark_t end_mark
135
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
144        int implicit
145    ctypedef struct _yaml_event_document_end_data_t:
146        int implicit
147    ctypedef struct _yaml_event_alias_data_t:
148        char *anchor
149    ctypedef struct _yaml_event_scalar_data_t:
150        char *anchor
151        char *tag
152        char *value
153        int length
154        int plain_implicit
155        int quoted_implicit
156        yaml_scalar_style_t style
157    ctypedef struct _yaml_event_sequence_start_data_t:
158        char *anchor
159        char *tag
160        int implicit
161        yaml_sequence_style_t style
162    ctypedef struct _yaml_event_mapping_start_data_t:
163        char *anchor
164        char *tag
165        int implicit
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
179        yaml_mark_t end_mark
180
181    ctypedef struct yaml_parser_t:
182        yaml_error_type_t error
183        char *problem
184        int problem_offset
185        int problem_value
186        yaml_mark_t problem_mark
187        char *context
188        yaml_mark_t context_mark
189
190    ctypedef struct yaml_emitter_t:
191        yaml_error_type_t error
192        char *problem
193
194    char *yaml_get_version_string()
195    void yaml_get_version(int *major, int *minor, int *patch)
196
197    void yaml_token_delete(yaml_token_t *token)
198
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,
206            int implicit)
207    int yaml_document_end_event_initialize(yaml_event_t *event,
208            int implicit)
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)
221
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 *
232
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)
249
Note: See TracBrowser for help on using the repository browser.