mkrf 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +2 -0
  2. data/MIT-LICENSE +7 -0
  3. data/README +54 -0
  4. data/Rakefile +107 -0
  5. data/lib/mkrf.rb +4 -0
  6. data/lib/mkrf/availability.rb +219 -0
  7. data/lib/mkrf/generator.rb +146 -0
  8. data/test/abstract_unit.rb +4 -0
  9. data/test/fixtures/down_a_directory/header_down_a_directory.h +1 -0
  10. data/test/fixtures/stdmkrf.h +1 -0
  11. data/test/sample_files/libtrivial/Rakefile +31 -0
  12. data/test/sample_files/libtrivial/extconf.rb +3 -0
  13. data/test/sample_files/libtrivial/lib/libtrivial.c +5 -0
  14. data/test/sample_files/libtrivial/lib/libtrivial.o +0 -0
  15. data/test/sample_files/libtrivial/libtrivial_so.bundle +0 -0
  16. data/test/sample_files/libtrivial/mkrf.log +1 -0
  17. data/test/sample_files/libxml-ruby-0.3.8/CHANGELOG +74 -0
  18. data/test/sample_files/libxml-ruby-0.3.8/LICENSE +22 -0
  19. data/test/sample_files/libxml-ruby-0.3.8/README +144 -0
  20. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/cbg.c +76 -0
  21. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb +49 -0
  22. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c +86 -0
  23. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h +82 -0
  24. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.rb +107 -0
  25. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/mkrf.log +1 -0
  26. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/old_extconf.rb +95 -0
  27. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.c +372 -0
  28. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.h +21 -0
  29. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.c +224 -0
  30. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.h +21 -0
  31. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c +1159 -0
  32. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.h +27 -0
  33. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.c +168 -0
  34. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.h +17 -0
  35. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.c +167 -0
  36. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.h +21 -0
  37. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.c +2139 -0
  38. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.h +28 -0
  39. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.c +248 -0
  40. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.h +26 -0
  41. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.c +153 -0
  42. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.h +21 -0
  43. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c +1417 -0
  44. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.h +31 -0
  45. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.c +715 -0
  46. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.h +22 -0
  47. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.c +426 -0
  48. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.h +52 -0
  49. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.c +142 -0
  50. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.h +16 -0
  51. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.c +43 -0
  52. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.h +12 -0
  53. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.c +20 -0
  54. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.h +13 -0
  55. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c +363 -0
  56. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.h +24 -0
  57. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.c +125 -0
  58. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.h +24 -0
  59. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.c +100 -0
  60. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.h +27 -0
  61. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.c +21 -0
  62. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.h +18 -0
  63. data/test/sample_files/libxml-ruby-0.3.8/ext/xml/sax_parser_callbacks.inc +202 -0
  64. data/test/sample_files/syck-0.55/CHANGELOG +186 -0
  65. data/test/sample_files/syck-0.55/COPYING +54 -0
  66. data/test/sample_files/syck-0.55/Makefile +582 -0
  67. data/test/sample_files/syck-0.55/Makefile.am +5 -0
  68. data/test/sample_files/syck-0.55/Makefile.in +582 -0
  69. data/test/sample_files/syck-0.55/README +105 -0
  70. data/test/sample_files/syck-0.55/README.BYTECODE +484 -0
  71. data/test/sample_files/syck-0.55/README.EXT +444 -0
  72. data/test/sample_files/syck-0.55/RELEASE +123 -0
  73. data/test/sample_files/syck-0.55/TODO +25 -0
  74. data/test/sample_files/syck-0.55/aclocal.m4 +883 -0
  75. data/test/sample_files/syck-0.55/bootstrap +7 -0
  76. data/test/sample_files/syck-0.55/config.h +79 -0
  77. data/test/sample_files/syck-0.55/config.h.in +78 -0
  78. data/test/sample_files/syck-0.55/config.status +1197 -0
  79. data/test/sample_files/syck-0.55/config/README +14 -0
  80. data/test/sample_files/syck-0.55/config/depcomp +529 -0
  81. data/test/sample_files/syck-0.55/config/install-sh +323 -0
  82. data/test/sample_files/syck-0.55/config/missing +357 -0
  83. data/test/sample_files/syck-0.55/configure +6728 -0
  84. data/test/sample_files/syck-0.55/configure.in +36 -0
  85. data/test/sample_files/syck-0.55/ext/ruby/CHANGELOG +303 -0
  86. data/test/sample_files/syck-0.55/ext/ruby/README +400 -0
  87. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/MANIFEST +1 -0
  88. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/bytecode.c +1170 -0
  89. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/emitter.c +1224 -0
  90. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/extconf.rb +10 -0
  91. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.c +1894 -0
  92. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.h +79 -0
  93. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/handler.c +174 -0
  94. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/implicit.c +2989 -0
  95. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/mkrf.log +1 -0
  96. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/node.c +407 -0
  97. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/rubyext.c +2385 -0
  98. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.c +504 -0
  99. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.h +458 -0
  100. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/token.c +2707 -0
  101. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yaml2byte.c +250 -0
  102. data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yamlbyte.h +170 -0
  103. data/test/sample_files/syck-0.55/ext/ruby/install.rb +1022 -0
  104. data/test/sample_files/syck-0.55/ext/ruby/lib/okay.rb +161 -0
  105. data/test/sample_files/syck-0.55/ext/ruby/lib/okay/news.rb +69 -0
  106. data/test/sample_files/syck-0.55/ext/ruby/lib/okay/rpc.rb +434 -0
  107. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml.rb +436 -0
  108. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/baseemitter.rb +247 -0
  109. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/basenode.rb +216 -0
  110. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/compat.rb +26 -0
  111. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/constants.rb +45 -0
  112. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/dbm.rb +111 -0
  113. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/emitter.rb +107 -0
  114. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/encoding.rb +33 -0
  115. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/error.rb +34 -0
  116. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/rubytypes.rb +438 -0
  117. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/store.rb +29 -0
  118. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stream.rb +40 -0
  119. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stringio.rb +83 -0
  120. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/syck.rb +19 -0
  121. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/tag.rb +86 -0
  122. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/types.rb +188 -0
  123. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/yamlnode.rb +54 -0
  124. data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/ypath.rb +52 -0
  125. data/test/sample_files/syck-0.55/ext/ruby/lib/yod.rb +1168 -0
  126. data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-modules.rb +27 -0
  127. data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-sample.rb +336 -0
  128. data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-validate.rb +341 -0
  129. data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-client.rb +51 -0
  130. data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-server.rb +85 -0
  131. data/test/sample_files/syck-0.55/ext/ruby/samples/yaml-sortHashKeys.rb +128 -0
  132. data/test/sample_files/syck-0.55/ext/ruby/tests/basic.rb +1653 -0
  133. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsAnchorAlias.yml +51 -0
  134. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBasicTests.yml +282 -0
  135. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockMapping.yml +78 -0
  136. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockSequence.yml +0 -0
  137. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsDocumentSeparator.yml +102 -0
  138. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsErrorTests.yml +23 -0
  139. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFlowCollections.yml +73 -0
  140. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFoldedScalars.yml +215 -0
  141. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsMapInSeq.yml +0 -0
  142. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsNullsAndEmpties.yml +66 -0
  143. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsRubyTests.yml +182 -0
  144. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsSpecificationExamples.yml +2699 -0
  145. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsTypeTransfers.yml +265 -0
  146. data/test/sample_files/syck-0.55/ext/ruby/yts/YtsYpath.yml +221 -0
  147. data/test/sample_files/syck-0.55/ext/ruby/yts/cookbook.rb +159 -0
  148. data/test/sample_files/syck-0.55/ext/ruby/yts/index.yml +10 -0
  149. data/test/sample_files/syck-0.55/ext/ruby/yts/yts.rb +193 -0
  150. data/test/sample_files/syck-0.55/lib/Makefile +497 -0
  151. data/test/sample_files/syck-0.55/lib/Makefile.am +27 -0
  152. data/test/sample_files/syck-0.55/lib/Makefile.in +497 -0
  153. data/test/sample_files/syck-0.55/lib/bytecode.c +1170 -0
  154. data/test/sample_files/syck-0.55/lib/bytecode.re +525 -0
  155. data/test/sample_files/syck-0.55/lib/emitter.c +1224 -0
  156. data/test/sample_files/syck-0.55/lib/gram.c +1894 -0
  157. data/test/sample_files/syck-0.55/lib/gram.h +79 -0
  158. data/test/sample_files/syck-0.55/lib/gram.output +2005 -0
  159. data/test/sample_files/syck-0.55/lib/gram.y +481 -0
  160. data/test/sample_files/syck-0.55/lib/handler.c +174 -0
  161. data/test/sample_files/syck-0.55/lib/implicit.c +2989 -0
  162. data/test/sample_files/syck-0.55/lib/implicit.re +206 -0
  163. data/test/sample_files/syck-0.55/lib/node.c +407 -0
  164. data/test/sample_files/syck-0.55/lib/syck.c +504 -0
  165. data/test/sample_files/syck-0.55/lib/syck.h +458 -0
  166. data/test/sample_files/syck-0.55/lib/syck_st.c +577 -0
  167. data/test/sample_files/syck-0.55/lib/syck_st.h +46 -0
  168. data/test/sample_files/syck-0.55/lib/token.c +2707 -0
  169. data/test/sample_files/syck-0.55/lib/token.re +1139 -0
  170. data/test/sample_files/syck-0.55/lib/yaml2byte.c +250 -0
  171. data/test/sample_files/syck-0.55/lib/yamlbyte.h +170 -0
  172. data/test/sample_files/syck-0.55/stamp-h1 +1 -0
  173. data/test/sample_files/syck-0.55/tests/Basic.c +141 -0
  174. data/test/sample_files/syck-0.55/tests/CuTest.c +294 -0
  175. data/test/sample_files/syck-0.55/tests/CuTest.h +84 -0
  176. data/test/sample_files/syck-0.55/tests/Emit.c +87 -0
  177. data/test/sample_files/syck-0.55/tests/Makefile +480 -0
  178. data/test/sample_files/syck-0.55/tests/Makefile.am +13 -0
  179. data/test/sample_files/syck-0.55/tests/Makefile.in +480 -0
  180. data/test/sample_files/syck-0.55/tests/Parse.c +208 -0
  181. data/test/sample_files/syck-0.55/tests/YTS.c +2310 -0
  182. data/test/sample_files/syck-0.55/tests/YTS.c.erb +326 -0
  183. data/test/sample_files/syck-0.55/tests/YTS.c.rb +44 -0
  184. data/test/test_availability.rb +68 -0
  185. data/test/test_generator.rb +74 -0
  186. metadata +252 -0
@@ -0,0 +1,458 @@
1
+ /*
2
+ * syck.h
3
+ *
4
+ * $Author: why $
5
+ * $Date: 2005/04/13 06:27:54 $
6
+ *
7
+ * Copyright (C) 2003 why the lucky stiff
8
+ */
9
+
10
+ #ifndef SYCK_H
11
+ #define SYCK_H
12
+
13
+ #define SYCK_YAML_MAJOR 1
14
+ #define SYCK_YAML_MINOR 0
15
+
16
+ #define SYCK_VERSION "0.55"
17
+ #define YAML_DOMAIN "yaml.org,2002"
18
+
19
+ #include <stdio.h>
20
+ #include <ctype.h>
21
+ #ifdef HAVE_ST_H
22
+ #include <st.h>
23
+ #else
24
+ #include "syck_st.h"
25
+ #endif
26
+
27
+ #if defined(__cplusplus)
28
+ extern "C" {
29
+ #endif
30
+
31
+ /*
32
+ * Memory Allocation
33
+ */
34
+ #if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
35
+ #include <alloca.h>
36
+ #endif
37
+
38
+ #if DEBUG
39
+ void syck_assert( char *, unsigned );
40
+ # define ASSERT(f) \
41
+ if ( f ) \
42
+ {} \
43
+ else \
44
+ syck_assert( __FILE__, __LINE__ )
45
+ #else
46
+ # define ASSERT(f)
47
+ #endif
48
+
49
+ #ifndef NULL
50
+ # define NULL (void *)0
51
+ #endif
52
+
53
+ #define ALLOC_CT 8
54
+ #define SYCK_BUFFERSIZE 4096
55
+ #define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n))
56
+ #define S_ALLOC(type) (type*)malloc(sizeof(type))
57
+ #define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n))
58
+ #define S_FREE(n) free(n); n = NULL;
59
+
60
+ #define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
61
+
62
+ #define S_MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
63
+ #define S_MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
64
+ #define S_MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
65
+ #define S_MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
66
+
67
+ #define BLOCK_FOLD 10
68
+ #define BLOCK_LIT 20
69
+ #define BLOCK_PLAIN 30
70
+ #define NL_CHOMP 40
71
+ #define NL_KEEP 50
72
+
73
+ /*
74
+ * Node definitions
75
+ */
76
+ #ifndef ST_DATA_T_DEFINED
77
+ typedef long st_data_t;
78
+ #endif
79
+
80
+ #define SYMID unsigned long
81
+
82
+ typedef struct _syck_node SyckNode;
83
+
84
+ enum syck_kind_tag {
85
+ syck_map_kind,
86
+ syck_seq_kind,
87
+ syck_str_kind
88
+ };
89
+
90
+ enum map_part {
91
+ map_key,
92
+ map_value
93
+ };
94
+
95
+ enum map_style {
96
+ map_none,
97
+ map_inline
98
+ };
99
+
100
+ enum seq_style {
101
+ seq_none,
102
+ seq_inline
103
+ };
104
+
105
+ enum scalar_style {
106
+ scalar_none,
107
+ scalar_1quote,
108
+ scalar_2quote,
109
+ scalar_fold,
110
+ scalar_literal,
111
+ scalar_plain
112
+ };
113
+
114
+ /*
115
+ * Node metadata struct
116
+ */
117
+ struct _syck_node {
118
+ /* Symbol table ID */
119
+ SYMID id;
120
+ /* Underlying kind */
121
+ enum syck_kind_tag kind;
122
+ /* Fully qualified tag-uri for type */
123
+ char *type_id;
124
+ /* Anchor name */
125
+ char *anchor;
126
+ union {
127
+ /* Storage for map data */
128
+ struct SyckMap {
129
+ enum map_style style;
130
+ SYMID *keys;
131
+ SYMID *values;
132
+ long capa;
133
+ long idx;
134
+ } *pairs;
135
+ /* Storage for sequence data */
136
+ struct SyckSeq {
137
+ enum seq_style style;
138
+ SYMID *items;
139
+ long capa;
140
+ long idx;
141
+ } *list;
142
+ /* Storage for string data */
143
+ struct SyckStr {
144
+ enum scalar_style style;
145
+ char *ptr;
146
+ long len;
147
+ } *str;
148
+ } data;
149
+ /* Shortcut node */
150
+ void *shortcut;
151
+ };
152
+
153
+ /*
154
+ * Parser definitions
155
+ */
156
+ typedef struct _syck_parser SyckParser;
157
+ typedef struct _syck_file SyckIoFile;
158
+ typedef struct _syck_str SyckIoStr;
159
+ typedef struct _syck_level SyckLevel;
160
+
161
+ typedef SYMID (*SyckNodeHandler)(SyckParser *, SyckNode *);
162
+ typedef void (*SyckErrorHandler)(SyckParser *, char *);
163
+ typedef SyckNode * (*SyckBadAnchorHandler)(SyckParser *, char *);
164
+ typedef long (*SyckIoFileRead)(char *, SyckIoFile *, long, long);
165
+ typedef long (*SyckIoStrRead)(char *, SyckIoStr *, long, long);
166
+
167
+ enum syck_io_type {
168
+ syck_io_str,
169
+ syck_io_file
170
+ };
171
+
172
+ enum syck_parser_input {
173
+ syck_yaml_utf8,
174
+ syck_yaml_utf16,
175
+ syck_yaml_utf32,
176
+ syck_bytecode_utf8
177
+ };
178
+
179
+ enum syck_level_status {
180
+ syck_lvl_header,
181
+ syck_lvl_doc,
182
+ syck_lvl_open,
183
+ syck_lvl_seq,
184
+ syck_lvl_map,
185
+ syck_lvl_block,
186
+ syck_lvl_str,
187
+ syck_lvl_iseq,
188
+ syck_lvl_imap,
189
+ syck_lvl_end,
190
+ syck_lvl_pause,
191
+ syck_lvl_anctag,
192
+ syck_lvl_mapx,
193
+ syck_lvl_seqx
194
+ };
195
+
196
+ /*
197
+ * Parser structs
198
+ */
199
+ struct _syck_file {
200
+ /* File pointer */
201
+ FILE *ptr;
202
+ /* Function which FILE -> buffer */
203
+ SyckIoFileRead read;
204
+ };
205
+
206
+ struct _syck_str {
207
+ /* String buffer pointers */
208
+ char *beg, *ptr, *end;
209
+ /* Function which string -> buffer */
210
+ SyckIoStrRead read;
211
+ };
212
+
213
+ struct _syck_level {
214
+ /* Indent */
215
+ int spaces;
216
+ /* Counts nodes emitted at this level, useful for parsing
217
+ * keys and pairs in bytecode */
218
+ int ncount;
219
+ /* Does node have anchors or tags? */
220
+ int anctag;
221
+ /* Domain prefixing at the given level */
222
+ char *domain;
223
+ /* Keeps a node status */
224
+ enum syck_level_status status;
225
+ };
226
+
227
+ struct _syck_parser {
228
+ /* Root node */
229
+ SYMID root, root_on_error;
230
+ /* Implicit typing flag */
231
+ int implicit_typing, taguri_expansion;
232
+ /* Scripting language function to handle nodes */
233
+ SyckNodeHandler handler;
234
+ /* Error handler */
235
+ SyckErrorHandler error_handler;
236
+ /* InvalidAnchor handler */
237
+ SyckBadAnchorHandler bad_anchor_handler;
238
+ /* Parser input type */
239
+ enum syck_parser_input input_type;
240
+ /* IO type */
241
+ enum syck_io_type io_type;
242
+ /* Custom buffer size */
243
+ size_t bufsize;
244
+ /* Buffer pointers */
245
+ char *buffer, *linectptr, *lineptr, *toktmp, *token, *cursor, *marker, *limit;
246
+ /* Line counter */
247
+ int linect;
248
+ /* Last token from yylex() */
249
+ int last_token;
250
+ /* Force a token upon next call to yylex() */
251
+ int force_token;
252
+ /* EOF flag */
253
+ int eof;
254
+ union {
255
+ SyckIoFile *file;
256
+ SyckIoStr *str;
257
+ } io;
258
+ /* Symbol table for anchors */
259
+ st_table *anchors, *bad_anchors;
260
+ /* Optional symbol table for SYMIDs */
261
+ st_table *syms;
262
+ /* Levels of indentation */
263
+ SyckLevel *levels;
264
+ int lvl_idx;
265
+ int lvl_capa;
266
+ /* Pointer for extension's use */
267
+ void *bonus;
268
+ };
269
+
270
+ /*
271
+ * Emitter definitions
272
+ */
273
+ typedef struct _syck_emitter SyckEmitter;
274
+ typedef struct _syck_emitter_node SyckEmitterNode;
275
+
276
+ typedef void (*SyckOutputHandler)(SyckEmitter *, char *, long);
277
+ typedef void (*SyckEmitterHandler)(SyckEmitter *, st_data_t);
278
+
279
+ enum doc_stage {
280
+ doc_open,
281
+ doc_need_header,
282
+ doc_processing
283
+ };
284
+
285
+ /*
286
+ * Emitter struct
287
+ */
288
+ struct _syck_emitter {
289
+ /* Headerless doc flag */
290
+ int headless;
291
+ /* Force header? */
292
+ int use_header;
293
+ /* Force version? */
294
+ int use_version;
295
+ /* Sort hash keys */
296
+ int sort_keys;
297
+ /* Anchor format */
298
+ char *anchor_format;
299
+ /* Explicit typing on all collections? */
300
+ int explicit_typing;
301
+ /* Best width on folded scalars */
302
+ int best_width;
303
+ /* Use literal[1] or folded[2] blocks on all text? */
304
+ enum scalar_style style;
305
+ /* Stage of written document */
306
+ enum doc_stage stage;
307
+ /* Level counter */
308
+ int level;
309
+ /* Default indentation */
310
+ int indent;
311
+ /* Object ignore ID */
312
+ SYMID ignore_id;
313
+ /* Symbol table for anchors */
314
+ st_table *markers, *anchors, *anchored;
315
+ /* Custom buffer size */
316
+ size_t bufsize;
317
+ /* Buffer */
318
+ char *buffer, *marker;
319
+ /* Absolute position of the buffer */
320
+ long bufpos;
321
+ /* Handler for emitter nodes */
322
+ SyckEmitterHandler emitter_handler;
323
+ /* Handler for output */
324
+ SyckOutputHandler output_handler;
325
+ /* Levels of indentation */
326
+ SyckLevel *levels;
327
+ int lvl_idx;
328
+ int lvl_capa;
329
+ /* Pointer for extension's use */
330
+ void *bonus;
331
+ };
332
+
333
+ /*
334
+ * Emitter node metadata struct
335
+ */
336
+ struct _syck_emitter_node {
337
+ /* Node buffer position */
338
+ long pos;
339
+ /* Current indent */
340
+ long indent;
341
+ /* Collection? */
342
+ int is_shortcut;
343
+ };
344
+
345
+ /*
346
+ * Handler prototypes
347
+ */
348
+ SYMID syck_hdlr_add_node( SyckParser *, SyckNode * );
349
+ SyckNode *syck_hdlr_add_anchor( SyckParser *, char *, SyckNode * );
350
+ void syck_hdlr_remove_anchor( SyckParser *, char * );
351
+ SyckNode *syck_hdlr_get_anchor( SyckParser *, char * );
352
+ void syck_add_transfer( char *, SyckNode *, int );
353
+ char *syck_xprivate( char *, int );
354
+ char *syck_taguri( char *, char *, int );
355
+ int syck_tagcmp( char *, char * );
356
+ int syck_add_sym( SyckParser *, char * );
357
+ int syck_lookup_sym( SyckParser *, SYMID, char ** );
358
+ int syck_try_implicit( SyckNode * );
359
+ char *syck_type_id_to_uri( char * );
360
+ void try_tag_implicit( SyckNode *, int );
361
+ char *syck_match_implicit( char *, size_t );
362
+
363
+ /*
364
+ * API prototypes
365
+ */
366
+ char *syck_strndup( char *, long );
367
+ long syck_io_file_read( char *, SyckIoFile *, long, long );
368
+ long syck_io_str_read( char *, SyckIoStr *, long, long );
369
+ char *syck_base64enc( char *, long );
370
+ char *syck_base64dec( char *, long );
371
+ SyckEmitter *syck_new_emitter();
372
+ SYMID syck_emitter_mark_node( SyckEmitter *, st_data_t );
373
+ void syck_emitter_ignore_id( SyckEmitter *, SYMID );
374
+ void syck_output_handler( SyckEmitter *, SyckOutputHandler );
375
+ void syck_emitter_handler( SyckEmitter *, SyckEmitterHandler );
376
+ void syck_free_emitter( SyckEmitter * );
377
+ void syck_emitter_clear( SyckEmitter * );
378
+ void syck_emitter_write( SyckEmitter *, char *, long );
379
+ void syck_emitter_escape( SyckEmitter *, char *, long );
380
+ void syck_emitter_flush( SyckEmitter *, long );
381
+ void syck_emit( SyckEmitter *, st_data_t );
382
+ void syck_emit_scalar( SyckEmitter *, char *, enum scalar_style, int, int, char, char *, long );
383
+ void syck_emit_1quoted( SyckEmitter *, int, char *, long );
384
+ void syck_emit_2quoted( SyckEmitter *, int, char *, long );
385
+ void syck_emit_folded( SyckEmitter *, int, char, char *, long );
386
+ void syck_emit_literal( SyckEmitter *, char, char *, long );
387
+ void syck_emit_seq( SyckEmitter *, char *, enum seq_style );
388
+ void syck_emit_item( SyckEmitter *, st_data_t );
389
+ void syck_emit_map( SyckEmitter *, char *, enum map_style );
390
+ void syck_emit_end( SyckEmitter * );
391
+ void syck_emit_tag( SyckEmitter *, char *, char * );
392
+ void syck_emit_indent( SyckEmitter * );
393
+ SyckLevel *syck_emitter_current_level( SyckEmitter * );
394
+ SyckLevel *syck_emitter_parent_level( SyckEmitter * );
395
+ void syck_emitter_pop_level( SyckEmitter * );
396
+ void syck_emitter_add_level( SyckEmitter *, int, enum syck_level_status );
397
+ void syck_emitter_reset_levels( SyckEmitter * );
398
+ SyckParser *syck_new_parser();
399
+ void syck_free_parser( SyckParser * );
400
+ void syck_parser_set_root_on_error( SyckParser *, SYMID );
401
+ void syck_parser_implicit_typing( SyckParser *, int );
402
+ void syck_parser_taguri_expansion( SyckParser *, int );
403
+ int syck_scan_scalar( int, char *, long );
404
+ void syck_parser_handler( SyckParser *, SyckNodeHandler );
405
+ void syck_parser_error_handler( SyckParser *, SyckErrorHandler );
406
+ void syck_parser_bad_anchor_handler( SyckParser *, SyckBadAnchorHandler );
407
+ void syck_parser_file( SyckParser *, FILE *, SyckIoFileRead );
408
+ void syck_parser_str( SyckParser *, char *, long, SyckIoStrRead );
409
+ void syck_parser_str_auto( SyckParser *, char *, SyckIoStrRead );
410
+ SyckLevel *syck_parser_current_level( SyckParser * );
411
+ void syck_parser_add_level( SyckParser *, int, enum syck_level_status );
412
+ void syck_parser_pop_level( SyckParser * );
413
+ void free_any_io( SyckParser * );
414
+ long syck_parser_read( SyckParser * );
415
+ long syck_parser_readlen( SyckParser *, long );
416
+ SYMID syck_parse( SyckParser * );
417
+ void syck_default_error_handler( SyckParser *, char * );
418
+ SYMID syck_yaml2byte_handler( SyckParser *, SyckNode * );
419
+ char *syck_yaml2byte( char * );
420
+
421
+ /*
422
+ * Allocation prototypes
423
+ */
424
+ SyckNode *syck_alloc_map();
425
+ SyckNode *syck_alloc_seq();
426
+ SyckNode *syck_alloc_str();
427
+ void syck_free_node( SyckNode * );
428
+ void syck_free_members( SyckNode * );
429
+ SyckNode *syck_new_str( char *, enum scalar_style );
430
+ SyckNode *syck_new_str2( char *, long, enum scalar_style );
431
+ void syck_replace_str( SyckNode *, char *, enum scalar_style );
432
+ void syck_replace_str2( SyckNode *, char *, long, enum scalar_style );
433
+ void syck_str_blow_away_commas( SyckNode * );
434
+ char *syck_str_read( SyckNode * );
435
+ SyckNode *syck_new_map( SYMID, SYMID );
436
+ void syck_map_empty( SyckNode * );
437
+ void syck_map_add( SyckNode *, SYMID, SYMID );
438
+ SYMID syck_map_read( SyckNode *, enum map_part, long );
439
+ void syck_map_assign( SyckNode *, enum map_part, long, SYMID );
440
+ long syck_map_count( SyckNode * );
441
+ void syck_map_update( SyckNode *, SyckNode * );
442
+ SyckNode *syck_new_seq( SYMID );
443
+ void syck_seq_empty( SyckNode * );
444
+ void syck_seq_add( SyckNode *, SYMID );
445
+ void syck_seq_assign( SyckNode *, long, SYMID );
446
+ SYMID syck_seq_read( SyckNode *, long );
447
+ long syck_seq_count( SyckNode * );
448
+
449
+ /*
450
+ * Lexer prototypes
451
+ */
452
+ void syckerror( char * );
453
+
454
+ #if defined(__cplusplus)
455
+ } /* extern "C" { */
456
+ #endif
457
+
458
+ #endif /* ifndef SYCK_H */