summaryrefslogtreecommitdiffstats
path: root/_ruamel_yaml.pxd
blob: d8dc3c6bdaa270550b48e13fbf9659d17363dfaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
cdef extern from "_ruamel_yaml.h":

    void malloc(int l)
    void memcpy(char *d, char *s, int l)
    int strlen(char *s)
    int PyString_CheckExact(object o)
    int PyUnicode_CheckExact(object o)
    char *PyString_AS_STRING(object o)
    int PyString_GET_SIZE(object o)
    object PyString_FromStringAndSize(char *v, int l)
    object PyUnicode_FromString(char *u)
    object PyUnicode_DecodeUTF8(char *u, int s, char *e)
    object PyUnicode_AsUTF8String(object o)
    int PY_MAJOR_VERSION

    ctypedef enum:
        SIZEOF_VOID_P
    ctypedef enum yaml_encoding_t:
        YAML_ANY_ENCODING
        YAML_UTF8_ENCODING
        YAML_UTF16LE_ENCODING
        YAML_UTF16BE_ENCODING
    ctypedef enum yaml_break_t:
        YAML_ANY_BREAK
        YAML_CR_BREAK
        YAML_LN_BREAK
        YAML_CRLN_BREAK
    ctypedef enum yaml_error_type_t:
        YAML_NO_ERROR
        YAML_MEMORY_ERROR
        YAML_READER_ERROR
        YAML_SCANNER_ERROR
        YAML_PARSER_ERROR
        YAML_WRITER_ERROR
        YAML_EMITTER_ERROR
    ctypedef enum yaml_scalar_style_t:
        YAML_ANY_SCALAR_STYLE
        YAML_PLAIN_SCALAR_STYLE
        YAML_SINGLE_QUOTED_SCALAR_STYLE
        YAML_DOUBLE_QUOTED_SCALAR_STYLE
        YAML_LITERAL_SCALAR_STYLE
        YAML_FOLDED_SCALAR_STYLE
    ctypedef enum yaml_sequence_style_t:
        YAML_ANY_SEQUENCE_STYLE
        YAML_BLOCK_SEQUENCE_STYLE
        YAML_FLOW_SEQUENCE_STYLE
    ctypedef enum yaml_mapping_style_t:
        YAML_ANY_MAPPING_STYLE
        YAML_BLOCK_MAPPING_STYLE
        YAML_FLOW_MAPPING_STYLE
    ctypedef enum yaml_token_type_t:
        YAML_NO_TOKEN
        YAML_STREAM_START_TOKEN
        YAML_STREAM_END_TOKEN
        YAML_VERSION_DIRECTIVE_TOKEN
        YAML_TAG_DIRECTIVE_TOKEN
        YAML_DOCUMENT_START_TOKEN
        YAML_DOCUMENT_END_TOKEN
        YAML_BLOCK_SEQUENCE_START_TOKEN
        YAML_BLOCK_MAPPING_START_TOKEN
        YAML_BLOCK_END_TOKEN
        YAML_FLOW_SEQUENCE_START_TOKEN
        YAML_FLOW_SEQUENCE_END_TOKEN
        YAML_FLOW_MAPPING_START_TOKEN
        YAML_FLOW_MAPPING_END_TOKEN
        YAML_BLOCK_ENTRY_TOKEN
        YAML_FLOW_ENTRY_TOKEN
        YAML_KEY_TOKEN
        YAML_VALUE_TOKEN
        YAML_ALIAS_TOKEN
        YAML_ANCHOR_TOKEN
        YAML_TAG_TOKEN
        YAML_SCALAR_TOKEN
    ctypedef enum yaml_event_type_t:
        YAML_NO_EVENT
        YAML_STREAM_START_EVENT
        YAML_STREAM_END_EVENT
        YAML_DOCUMENT_START_EVENT
        YAML_DOCUMENT_END_EVENT
        YAML_ALIAS_EVENT
        YAML_SCALAR_EVENT
        YAML_SEQUENCE_START_EVENT
        YAML_SEQUENCE_END_EVENT
        YAML_MAPPING_START_EVENT
        YAML_MAPPING_END_EVENT

    ctypedef int yaml_read_handler_t(void *data, char *buffer,
            int size, int *size_read) except 0

    ctypedef int yaml_write_handler_t(void *data, char *buffer,
            int size) except 0

    ctypedef struct yaml_mark_t:
        int index
        int line
        int column
    ctypedef struct yaml_version_directive_t:
        int major
        int minor
    ctypedef struct yaml_tag_directive_t:
        char *handle
        char *prefix

    ctypedef struct _yaml_token_stream_start_data_t:
        yaml_encoding_t encoding
    ctypedef struct _yaml_token_alias_data_t:
        char *value
    ctypedef struct _yaml_token_anchor_data_t:
        char *value
    ctypedef struct _yaml_token_tag_data_t:
        char *handle
        char *suffix
    ctypedef struct _yaml_token_scalar_data_t:
        char *value
        int length
        yaml_scalar_style_t style
    ctypedef struct _yaml_token_version_directive_data_t:
        int major
        int minor
    ctypedef struct _yaml_token_tag_directive_data_t:
        char *handle
        char *prefix
    ctypedef union _yaml_token_data_t:
        _yaml_token_stream_start_data_t stream_start
        _yaml_token_alias_data_t alias
        _yaml_token_anchor_data_t anchor
        _yaml_token_tag_data_t tag
        _yaml_token_scalar_data_t scalar
        _yaml_token_version_directive_data_t version_directive
        _yaml_token_tag_directive_data_t tag_directive
    ctypedef struct yaml_token_t:
        yaml_token_type_t type
        _yaml_token_data_t data
        yaml_mark_t start_mark
        yaml_mark_t end_mark

    ctypedef struct _yaml_event_stream_start_data_t:
        yaml_encoding_t encoding
    ctypedef struct _yaml_event_document_start_data_tag_directives_t:
        yaml_tag_directive_t *start
        yaml_tag_directive_t *end
    ctypedef struct _yaml_event_document_start_data_t:
        yaml_version_directive_t *version_directive
        _yaml_event_document_start_data_tag_directives_t tag_directives
        int implicit
    ctypedef struct _yaml_event_document_end_data_t:
        int implicit
    ctypedef struct _yaml_event_alias_data_t:
        char *anchor
    ctypedef struct _yaml_event_scalar_data_t:
        char *anchor
        char *tag
        char *value
        int length
        int plain_implicit
        int quoted_implicit
        yaml_scalar_style_t style
    ctypedef struct _yaml_event_sequence_start_data_t:
        char *anchor
        char *tag
        int implicit
        yaml_sequence_style_t style
    ctypedef struct _yaml_event_mapping_start_data_t:
        char *anchor
        char *tag
        int implicit
        yaml_mapping_style_t style
    ctypedef union _yaml_event_data_t:
        _yaml_event_stream_start_data_t stream_start
        _yaml_event_document_start_data_t document_start
        _yaml_event_document_end_data_t document_end
        _yaml_event_alias_data_t alias
        _yaml_event_scalar_data_t scalar
        _yaml_event_sequence_start_data_t sequence_start
        _yaml_event_mapping_start_data_t mapping_start
    ctypedef struct yaml_event_t:
        yaml_event_type_t type
        _yaml_event_data_t data
        yaml_mark_t start_mark
        yaml_mark_t end_mark

    ctypedef struct yaml_parser_t:
        yaml_error_type_t error
        char *problem
        int problem_offset
        int problem_value
        yaml_mark_t problem_mark
        char *context
        yaml_mark_t context_mark

    ctypedef struct yaml_emitter_t:
        yaml_error_type_t error
        char *problem

    char *yaml_get_version_string()
    void yaml_get_version(int *major, int *minor, int *patch)

    void yaml_token_delete(yaml_token_t *token)

    int yaml_stream_start_event_initialize(yaml_event_t *event,
            yaml_encoding_t encoding)
    int yaml_stream_end_event_initialize(yaml_event_t *event)
    int yaml_document_start_event_initialize(yaml_event_t *event,
            yaml_version_directive_t *version_directive,
            yaml_tag_directive_t *tag_directives_start,
            yaml_tag_directive_t *tag_directives_end,
            int implicit)
    int yaml_document_end_event_initialize(yaml_event_t *event,
            int implicit)
    int yaml_alias_event_initialize(yaml_event_t *event, char *anchor)
    int yaml_scalar_event_initialize(yaml_event_t *event,
            char *anchor, char *tag, char *value, int length,
            int plain_implicit, int quoted_implicit,
            yaml_scalar_style_t style)
    int yaml_sequence_start_event_initialize(yaml_event_t *event,
            char *anchor, char *tag, int implicit, yaml_sequence_style_t style)
    int yaml_sequence_end_event_initialize(yaml_event_t *event)
    int yaml_mapping_start_event_initialize(yaml_event_t *event,
            char *anchor, char *tag, int implicit, yaml_mapping_style_t style)
    int yaml_mapping_end_event_initialize(yaml_event_t *event)
    void yaml_event_delete(yaml_event_t *event)

    int yaml_parser_initialize(yaml_parser_t *parser)
    void yaml_parser_delete(yaml_parser_t *parser)
    void yaml_parser_set_input_string(yaml_parser_t *parser,
            char *input, int size)
    void yaml_parser_set_input(yaml_parser_t *parser,
            yaml_read_handler_t *handler, void *data)
    void yaml_parser_set_encoding(yaml_parser_t *parser,
            yaml_encoding_t encoding)
    int yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token) except *
    int yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event) except *

    int yaml_emitter_initialize(yaml_emitter_t *emitter)
    void yaml_emitter_delete(yaml_emitter_t *emitter)
    void yaml_emitter_set_output_string(yaml_emitter_t *emitter,
            char *output, int size, int *size_written)
    void yaml_emitter_set_output(yaml_emitter_t *emitter,
            yaml_write_handler_t *handler, void *data)
    void yaml_emitter_set_encoding(yaml_emitter_t *emitter,
            yaml_encoding_t encoding)
    void yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical)
    void yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
    void yaml_emitter_set_width(yaml_emitter_t *emitter, int width)
    void yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
    void yaml_emitter_set_break(yaml_emitter_t *emitter,
            yaml_break_t line_break)
    int yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event) except *
    int yaml_emitter_flush(yaml_emitter_t *emitter)