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

Revision 195, 3.6 KB checked in by xi, 8 years ago (diff)

Add pyrex-based bindings for the libyaml scanner.

RevLine 
[195]1
2cdef extern from "_yaml.h":
3
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)
9
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
61    ctypedef int yaml_read_handler_t(void *data, char *buffer,
62            int size, int *size_read)
63
64    ctypedef struct yaml_mark_t:
65        int index
66        int line
67        int column
68    ctypedef struct _yaml_token_tag_data_t:
69        char *handle
70        char *suffix
71    ctypedef struct _yaml_token_scalar_data_t:
72        char *value
73        int length
74        yaml_scalar_style_t style
75    ctypedef struct _yaml_token_version_directive_data_t:
76        int major
77        int minor
78    ctypedef struct _yaml_token_tag_directive_data_t:
79        char *handle
80        char *prefix
81    ctypedef union _yaml_token_data_t:
82        yaml_encoding_t encoding
83        char *anchor
84        _yaml_token_tag_data_t tag
85        _yaml_token_scalar_data_t scalar
86        _yaml_token_version_directive_data_t version_directive
87        _yaml_token_tag_directive_data_t tag_directive
88    ctypedef struct yaml_token_t:
89        yaml_token_type_t type
90        _yaml_token_data_t data
91        yaml_mark_t start_mark
92        yaml_mark_t end_mark
93    ctypedef struct yaml_parser_t:
94        yaml_error_type_t error
95        char *problem
96        int problem_offset
97        int problem_value
98        yaml_mark_t problem_mark
99        char *context
100        yaml_mark_t context_mark
101
102    char *yaml_get_version_string()
103    void yaml_get_version(int *major, int *minor, int *patch)
104    void yaml_token_delete(yaml_token_t *token)
105    yaml_parser_t *yaml_parser_new()
106    void yaml_parser_delete(yaml_parser_t *parser)
107    void yaml_parser_set_input_string(yaml_parser_t *parser,
108            char *input, int size)
109    void yaml_parser_set_input(yaml_parser_t *parser,
110            yaml_read_handler_t *handler, void *data)
111    void yaml_parser_set_encoding(yaml_parser_t *parser,
112            yaml_encoding_t encoding)
113    yaml_token_t *yaml_parser_get_token(yaml_parser_t *parser)
114    yaml_token_t *yaml_parser_peek_token(yaml_parser_t *parser)
115
Note: See TracBrowser for help on using the repository browser.