Ruby  2.1.3p242(2014-09-19revision47630)
yaml.h
Go to the documentation of this file.
1 
11 #ifndef YAML_H
12 #define YAML_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdlib.h>
19 #include <stdio.h>
20 #include <string.h>
21 
29 #ifdef _WIN32
30 # if defined(YAML_DECLARE_STATIC)
31 # define YAML_DECLARE(type) type
32 # elif defined(YAML_DECLARE_EXPORT)
33 # define YAML_DECLARE(type) __declspec(dllexport) type
34 # else
35 # define YAML_DECLARE(type) __declspec(dllimport) type
36 # endif
37 #else
38 # define YAML_DECLARE(type) type
39 #endif
40 
56 YAML_DECLARE(const char *)
58 
67 YAML_DECLARE(void)
68 yaml_get_version(int *major, int *minor, int *patch);
69 
78 typedef unsigned char yaml_char_t;
79 
81 typedef struct yaml_version_directive_s {
83  int major;
85  int minor;
87 
89 typedef struct yaml_tag_directive_s {
95 
97 typedef enum yaml_encoding_e {
107 
110 typedef enum yaml_break_e {
119 } yaml_break_t;
120 
122 typedef enum yaml_error_type_e {
125 
128 
137 
143 
145 typedef struct yaml_mark_s {
147  size_t index;
148 
150  size_t line;
151 
153  size_t column;
154 } yaml_mark_t;
155 
164 typedef enum yaml_scalar_style_e {
167 
170 
175 
181 
183 typedef enum yaml_sequence_style_e {
186 
192 
194 typedef enum yaml_mapping_style_e {
197 
202 /* YAML_FLOW_SET_MAPPING_STYLE */
204 
213 typedef enum yaml_token_type_e {
216 
221 
230 
237 
246 
255 
265 
267 typedef struct yaml_token_s {
268 
271 
273  union {
274 
276  struct {
279  } stream_start;
280 
282  struct {
285  } alias;
286 
288  struct {
291  } anchor;
292 
294  struct {
299  } tag;
300 
302  struct {
306  size_t length;
309  } scalar;
310 
312  struct {
314  int major;
316  int minor;
318 
320  struct {
325  } tag_directive;
326 
327  } data;
328 
333 
334 } yaml_token_t;
335 
342 YAML_DECLARE(void)
344 
353 typedef enum yaml_event_type_e {
356 
361 
366 
371 
376 
382 
384 typedef struct yaml_event_s {
385 
388 
390  union {
391 
393  struct {
396  } stream_start;
397 
399  struct {
402 
404  struct {
409  } tag_directives;
410 
412  int implicit;
413  } document_start;
414 
416  struct {
418  int implicit;
419  } document_end;
420 
422  struct {
425  } alias;
426 
428  struct {
436  size_t length;
443  } scalar;
444 
446  struct {
450  yaml_char_t *tag;
452  int implicit;
455  } sequence_start;
456 
458  struct {
462  yaml_char_t *tag;
464  int implicit;
467  } mapping_start;
468 
469  } data;
470 
475 
476 } yaml_event_t;
477 
487 YAML_DECLARE(int)
489  yaml_encoding_t encoding);
490 
499 YAML_DECLARE(int)
501 
521 YAML_DECLARE(int)
523  yaml_version_directive_t *version_directive,
524  yaml_tag_directive_t *tag_directives_start,
525  yaml_tag_directive_t *tag_directives_end,
526  int implicit);
527 
540 YAML_DECLARE(int)
542 
552 YAML_DECLARE(int)
554 
577 YAML_DECLARE(int)
579  yaml_char_t *anchor, yaml_char_t *tag,
580  yaml_char_t *value, int length,
581  int plain_implicit, int quoted_implicit,
582  yaml_scalar_style_t style);
583 
600 YAML_DECLARE(int)
602  yaml_char_t *anchor, yaml_char_t *tag, int implicit,
603  yaml_sequence_style_t style);
604 
613 YAML_DECLARE(int)
615 
632 YAML_DECLARE(int)
634  yaml_char_t *anchor, yaml_char_t *tag, int implicit,
635  yaml_mapping_style_t style);
636 
645 YAML_DECLARE(int)
647 
654 YAML_DECLARE(void)
656 
665 #define YAML_NULL_TAG "tag:yaml.org,2002:null"
666 
667 #define YAML_BOOL_TAG "tag:yaml.org,2002:bool"
668 
669 #define YAML_STR_TAG "tag:yaml.org,2002:str"
670 
671 #define YAML_INT_TAG "tag:yaml.org,2002:int"
672 
673 #define YAML_FLOAT_TAG "tag:yaml.org,2002:float"
674 
675 #define YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"
676 
678 #define YAML_SEQ_TAG "tag:yaml.org,2002:seq"
679 
680 #define YAML_MAP_TAG "tag:yaml.org,2002:map"
681 
683 #define YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG
684 
685 #define YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG
686 
687 #define YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG
688 
690 typedef enum yaml_node_type_e {
693 
701 
703 typedef struct yaml_node_s yaml_node_t;
704 
706 typedef int yaml_node_item_t;
707 
709 typedef struct yaml_node_pair_s {
711  int key;
713  int value;
715 
717 struct yaml_node_s {
718 
721 
724 
726  union {
727 
729  struct {
733  size_t length;
736  } scalar;
737 
739  struct {
741  struct {
743  yaml_node_item_t *start;
745  yaml_node_item_t *end;
747  yaml_node_item_t *top;
748  } items;
751  } sequence;
752 
754  struct {
756  struct {
763  } pairs;
766  } mapping;
767 
768  } data;
769 
774 
775 };
776 
778 typedef struct yaml_document_s {
779 
781  struct {
788  } nodes;
789 
792 
794  struct {
799  } tag_directives;
800 
805 
810 
812 
831 YAML_DECLARE(int)
833  yaml_version_directive_t *version_directive,
834  yaml_tag_directive_t *tag_directives_start,
835  yaml_tag_directive_t *tag_directives_end,
836  int start_implicit, int end_implicit);
837 
844 YAML_DECLARE(void)
846 
860 yaml_document_get_node(yaml_document_t *document, int index);
861 
880 
895 YAML_DECLARE(int)
897  yaml_char_t *tag, yaml_char_t *value, int length,
898  yaml_scalar_style_t style);
899 
912 YAML_DECLARE(int)
914  yaml_char_t *tag, yaml_sequence_style_t style);
915 
928 YAML_DECLARE(int)
930  yaml_char_t *tag, yaml_mapping_style_t style);
931 
942 YAML_DECLARE(int)
944  int sequence, int item);
945 
957 YAML_DECLARE(int)
959  int mapping, int key, int value);
960 
986 typedef int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size,
987  size_t *size_read);
988 
993 typedef struct yaml_simple_key_s {
995  int possible;
996 
998  int required;
999 
1002 
1006 
1010 typedef enum yaml_parser_state_e {
1060 
1065 typedef struct yaml_alias_data_s {
1069  int index;
1073 
1081 typedef struct yaml_parser_s {
1082 
1091  const char *problem;
1099  const char *context;
1102 
1114 
1117 
1119  union {
1121  struct {
1123  const unsigned char *start;
1125  const unsigned char *end;
1127  const unsigned char *current;
1128  } string;
1129 
1132  } input;
1133 
1135  int eof;
1136 
1138  struct {
1147  } buffer;
1148 
1149  /* The number of unread characters in the buffer. */
1150  size_t unread;
1151 
1153  struct {
1155  unsigned char *start;
1157  unsigned char *end;
1159  unsigned char *pointer;
1161  unsigned char *last;
1162  } raw_buffer;
1163 
1166 
1168  size_t offset;
1169 
1172 
1184 
1187 
1190 
1192  struct {
1201  } tokens;
1202 
1205 
1206  /* Does the tokens queue contain a token ready for dequeueing. */
1208 
1210  struct {
1212  int *start;
1214  int *end;
1216  int *top;
1217  } indents;
1218 
1220  int indent;
1221 
1224 
1226  struct {
1233  } simple_keys;
1234 
1245  struct {
1252  } states;
1253 
1256 
1258  struct {
1265  } marks;
1266 
1268  struct {
1275  } tag_directives;
1276 
1287  struct {
1294  } aliases;
1295 
1298 
1303 } yaml_parser_t;
1304 
1316 YAML_DECLARE(int)
1318 
1325 YAML_DECLARE(void)
1327 
1340 YAML_DECLARE(void)
1342  const unsigned char *input, size_t size);
1343 
1354 YAML_DECLARE(void)
1356 
1366 YAML_DECLARE(void)
1368  yaml_read_handler_t *handler, void *data);
1369 
1377 YAML_DECLARE(void)
1379 
1401 YAML_DECLARE(int)
1403 
1425 YAML_DECLARE(int)
1427 
1450 YAML_DECLARE(int)
1451 yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);
1452 
1476 typedef int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size);
1477 
1479 typedef enum yaml_emitter_state_e {
1517 
1525 typedef struct yaml_emitter_s {
1526 
1535  const char *problem;
1536 
1548 
1551 
1553  union {
1555  struct {
1557  unsigned char *buffer;
1559  size_t size;
1561  size_t *size_written;
1562  } string;
1563 
1566  } output;
1567 
1569  struct {
1578  } buffer;
1579 
1581  struct {
1583  unsigned char *start;
1585  unsigned char *end;
1587  unsigned char *pointer;
1589  unsigned char *last;
1590  } raw_buffer;
1591 
1594 
1611  int unicode;
1614 
1616  struct {
1623  } states;
1624 
1627 
1629  struct {
1638  } events;
1639 
1641  struct {
1643  int *start;
1645  int *end;
1647  int *top;
1648  } indents;
1649 
1651  struct {
1658  } tag_directives;
1659 
1661  int indent;
1662 
1665 
1674 
1676  int line;
1678  int column;
1685 
1687  struct {
1693  int alias;
1694  } anchor_data;
1695 
1697  struct {
1706  } tag_data;
1707 
1709  struct {
1713  size_t length;
1726  } scalar_data;
1727 
1738  int opened;
1740  int closed;
1741 
1743  struct {
1747  int anchor;
1750  } *anchors;
1751 
1754 
1757 
1762 } yaml_emitter_t;
1763 
1775 YAML_DECLARE(int)
1777 
1784 YAML_DECLARE(void)
1786 
1802 YAML_DECLARE(void)
1804  unsigned char *output, size_t size, size_t *size_written);
1805 
1816 YAML_DECLARE(void)
1818 
1828 YAML_DECLARE(void)
1830  yaml_write_handler_t *handler, void *data);
1831 
1839 YAML_DECLARE(void)
1841 
1850 YAML_DECLARE(void)
1852 
1860 YAML_DECLARE(void)
1861 yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent);
1862 
1870 YAML_DECLARE(void)
1871 yaml_emitter_set_width(yaml_emitter_t *emitter, int width);
1872 
1880 YAML_DECLARE(void)
1881 yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode);
1882 
1890 YAML_DECLARE(void)
1891 yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break);
1892 
1907 YAML_DECLARE(int)
1909 
1920 YAML_DECLARE(int)
1922 
1933 YAML_DECLARE(int)
1935 
1950 YAML_DECLARE(int)
1951 yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document);
1952 
1961 YAML_DECLARE(int)
1963 
1966 #ifdef __cplusplus
1967 }
1968 #endif
1969 
1970 #endif /* #ifndef YAML_H */
1971 
1972