_ruamel_yaml.pxd 8.9 KB

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