nokogiri 1.18.0-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +39 -0
  3. data/LICENSE-DEPENDENCIES.md +2224 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +293 -0
  6. data/bin/nokogiri +131 -0
  7. data/dependencies.yml +42 -0
  8. data/ext/nokogiri/depend +38 -0
  9. data/ext/nokogiri/extconf.rb +1173 -0
  10. data/ext/nokogiri/gumbo.c +610 -0
  11. data/ext/nokogiri/html4_document.c +171 -0
  12. data/ext/nokogiri/html4_element_description.c +299 -0
  13. data/ext/nokogiri/html4_entity_lookup.c +37 -0
  14. data/ext/nokogiri/html4_sax_parser.c +40 -0
  15. data/ext/nokogiri/html4_sax_parser_context.c +98 -0
  16. data/ext/nokogiri/html4_sax_push_parser.c +96 -0
  17. data/ext/nokogiri/include/libexslt/exslt.h +108 -0
  18. data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
  19. data/ext/nokogiri/include/libexslt/exsltexports.h +63 -0
  20. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +336 -0
  21. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
  22. data/ext/nokogiri/include/libxml2/libxml/SAX.h +202 -0
  23. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +171 -0
  24. data/ext/nokogiri/include/libxml2/libxml/c14n.h +115 -0
  25. data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
  26. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
  27. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
  28. data/ext/nokogiri/include/libxml2/libxml/dict.h +82 -0
  29. data/ext/nokogiri/include/libxml2/libxml/encoding.h +244 -0
  30. data/ext/nokogiri/include/libxml2/libxml/entities.h +166 -0
  31. data/ext/nokogiri/include/libxml2/libxml/globals.h +41 -0
  32. data/ext/nokogiri/include/libxml2/libxml/hash.h +251 -0
  33. data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
  34. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +186 -0
  35. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +98 -0
  36. data/ext/nokogiri/include/libxml2/libxml/parser.h +1390 -0
  37. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +671 -0
  38. data/ext/nokogiri/include/libxml2/libxml/pattern.h +106 -0
  39. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +219 -0
  40. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +959 -0
  41. data/ext/nokogiri/include/libxml2/libxml/schematron.h +143 -0
  42. data/ext/nokogiri/include/libxml2/libxml/threads.h +87 -0
  43. data/ext/nokogiri/include/libxml2/libxml/tree.h +1382 -0
  44. data/ext/nokogiri/include/libxml2/libxml/uri.h +106 -0
  45. data/ext/nokogiri/include/libxml2/libxml/valid.h +477 -0
  46. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +136 -0
  47. data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
  48. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +438 -0
  49. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
  50. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +962 -0
  51. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +146 -0
  52. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +188 -0
  53. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
  54. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +436 -0
  55. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +215 -0
  56. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +102 -0
  57. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +249 -0
  58. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +152 -0
  59. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
  60. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +366 -0
  61. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +347 -0
  62. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +489 -0
  63. data/ext/nokogiri/include/libxml2/libxml/xpath.h +579 -0
  64. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +633 -0
  65. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +138 -0
  66. data/ext/nokogiri/include/libxslt/attributes.h +39 -0
  67. data/ext/nokogiri/include/libxslt/documents.h +93 -0
  68. data/ext/nokogiri/include/libxslt/extensions.h +262 -0
  69. data/ext/nokogiri/include/libxslt/extra.h +72 -0
  70. data/ext/nokogiri/include/libxslt/functions.h +78 -0
  71. data/ext/nokogiri/include/libxslt/imports.h +75 -0
  72. data/ext/nokogiri/include/libxslt/keys.h +53 -0
  73. data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
  74. data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
  75. data/ext/nokogiri/include/libxslt/pattern.h +84 -0
  76. data/ext/nokogiri/include/libxslt/preproc.h +43 -0
  77. data/ext/nokogiri/include/libxslt/security.h +104 -0
  78. data/ext/nokogiri/include/libxslt/templates.h +77 -0
  79. data/ext/nokogiri/include/libxslt/transform.h +207 -0
  80. data/ext/nokogiri/include/libxslt/variables.h +118 -0
  81. data/ext/nokogiri/include/libxslt/xslt.h +110 -0
  82. data/ext/nokogiri/include/libxslt/xsltInternals.h +1995 -0
  83. data/ext/nokogiri/include/libxslt/xsltconfig.h +146 -0
  84. data/ext/nokogiri/include/libxslt/xsltexports.h +64 -0
  85. data/ext/nokogiri/include/libxslt/xsltlocale.h +44 -0
  86. data/ext/nokogiri/include/libxslt/xsltutils.h +343 -0
  87. data/ext/nokogiri/libxml2_polyfill.c +114 -0
  88. data/ext/nokogiri/nokogiri.c +294 -0
  89. data/ext/nokogiri/nokogiri.h +238 -0
  90. data/ext/nokogiri/test_global_handlers.c +40 -0
  91. data/ext/nokogiri/xml_attr.c +103 -0
  92. data/ext/nokogiri/xml_attribute_decl.c +70 -0
  93. data/ext/nokogiri/xml_cdata.c +62 -0
  94. data/ext/nokogiri/xml_comment.c +57 -0
  95. data/ext/nokogiri/xml_document.c +784 -0
  96. data/ext/nokogiri/xml_document_fragment.c +29 -0
  97. data/ext/nokogiri/xml_dtd.c +208 -0
  98. data/ext/nokogiri/xml_element_content.c +131 -0
  99. data/ext/nokogiri/xml_element_decl.c +69 -0
  100. data/ext/nokogiri/xml_encoding_handler.c +112 -0
  101. data/ext/nokogiri/xml_entity_decl.c +112 -0
  102. data/ext/nokogiri/xml_entity_reference.c +50 -0
  103. data/ext/nokogiri/xml_namespace.c +181 -0
  104. data/ext/nokogiri/xml_node.c +2459 -0
  105. data/ext/nokogiri/xml_node_set.c +518 -0
  106. data/ext/nokogiri/xml_processing_instruction.c +54 -0
  107. data/ext/nokogiri/xml_reader.c +777 -0
  108. data/ext/nokogiri/xml_relax_ng.c +149 -0
  109. data/ext/nokogiri/xml_sax_parser.c +403 -0
  110. data/ext/nokogiri/xml_sax_parser_context.c +390 -0
  111. data/ext/nokogiri/xml_sax_push_parser.c +206 -0
  112. data/ext/nokogiri/xml_schema.c +226 -0
  113. data/ext/nokogiri/xml_syntax_error.c +93 -0
  114. data/ext/nokogiri/xml_text.c +59 -0
  115. data/ext/nokogiri/xml_xpath_context.c +486 -0
  116. data/ext/nokogiri/xslt_stylesheet.c +421 -0
  117. data/gumbo-parser/CHANGES.md +63 -0
  118. data/gumbo-parser/Makefile +129 -0
  119. data/gumbo-parser/THANKS +27 -0
  120. data/lib/nokogiri/3.1/nokogiri.so +0 -0
  121. data/lib/nokogiri/3.2/nokogiri.so +0 -0
  122. data/lib/nokogiri/3.3/nokogiri.so +0 -0
  123. data/lib/nokogiri/3.4/nokogiri.so +0 -0
  124. data/lib/nokogiri/class_resolver.rb +67 -0
  125. data/lib/nokogiri/css/node.rb +58 -0
  126. data/lib/nokogiri/css/parser.rb +772 -0
  127. data/lib/nokogiri/css/parser.y +277 -0
  128. data/lib/nokogiri/css/parser_extras.rb +36 -0
  129. data/lib/nokogiri/css/selector_cache.rb +38 -0
  130. data/lib/nokogiri/css/syntax_error.rb +9 -0
  131. data/lib/nokogiri/css/tokenizer.rb +155 -0
  132. data/lib/nokogiri/css/tokenizer.rex +57 -0
  133. data/lib/nokogiri/css/xpath_visitor.rb +375 -0
  134. data/lib/nokogiri/css.rb +132 -0
  135. data/lib/nokogiri/decorators/slop.rb +42 -0
  136. data/lib/nokogiri/encoding_handler.rb +57 -0
  137. data/lib/nokogiri/extension.rb +32 -0
  138. data/lib/nokogiri/gumbo.rb +15 -0
  139. data/lib/nokogiri/html.rb +48 -0
  140. data/lib/nokogiri/html4/builder.rb +37 -0
  141. data/lib/nokogiri/html4/document.rb +235 -0
  142. data/lib/nokogiri/html4/document_fragment.rb +166 -0
  143. data/lib/nokogiri/html4/element_description.rb +25 -0
  144. data/lib/nokogiri/html4/element_description_defaults.rb +2040 -0
  145. data/lib/nokogiri/html4/encoding_reader.rb +121 -0
  146. data/lib/nokogiri/html4/entity_lookup.rb +15 -0
  147. data/lib/nokogiri/html4/sax/parser.rb +48 -0
  148. data/lib/nokogiri/html4/sax/parser_context.rb +15 -0
  149. data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
  150. data/lib/nokogiri/html4.rb +42 -0
  151. data/lib/nokogiri/html5/builder.rb +40 -0
  152. data/lib/nokogiri/html5/document.rb +199 -0
  153. data/lib/nokogiri/html5/document_fragment.rb +200 -0
  154. data/lib/nokogiri/html5/node.rb +103 -0
  155. data/lib/nokogiri/html5.rb +368 -0
  156. data/lib/nokogiri/jruby/dependencies.rb +3 -0
  157. data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
  158. data/lib/nokogiri/syntax_error.rb +6 -0
  159. data/lib/nokogiri/version/constant.rb +6 -0
  160. data/lib/nokogiri/version/info.rb +224 -0
  161. data/lib/nokogiri/version.rb +4 -0
  162. data/lib/nokogiri/xml/attr.rb +66 -0
  163. data/lib/nokogiri/xml/attribute_decl.rb +22 -0
  164. data/lib/nokogiri/xml/builder.rb +494 -0
  165. data/lib/nokogiri/xml/cdata.rb +13 -0
  166. data/lib/nokogiri/xml/character_data.rb +9 -0
  167. data/lib/nokogiri/xml/document.rb +514 -0
  168. data/lib/nokogiri/xml/document_fragment.rb +276 -0
  169. data/lib/nokogiri/xml/dtd.rb +34 -0
  170. data/lib/nokogiri/xml/element_content.rb +46 -0
  171. data/lib/nokogiri/xml/element_decl.rb +17 -0
  172. data/lib/nokogiri/xml/entity_decl.rb +23 -0
  173. data/lib/nokogiri/xml/entity_reference.rb +20 -0
  174. data/lib/nokogiri/xml/namespace.rb +57 -0
  175. data/lib/nokogiri/xml/node/save_options.rb +76 -0
  176. data/lib/nokogiri/xml/node.rb +1650 -0
  177. data/lib/nokogiri/xml/node_set.rb +449 -0
  178. data/lib/nokogiri/xml/notation.rb +19 -0
  179. data/lib/nokogiri/xml/parse_options.rb +213 -0
  180. data/lib/nokogiri/xml/pp/character_data.rb +21 -0
  181. data/lib/nokogiri/xml/pp/node.rb +73 -0
  182. data/lib/nokogiri/xml/pp.rb +4 -0
  183. data/lib/nokogiri/xml/processing_instruction.rb +11 -0
  184. data/lib/nokogiri/xml/reader.rb +139 -0
  185. data/lib/nokogiri/xml/relax_ng.rb +75 -0
  186. data/lib/nokogiri/xml/sax/document.rb +258 -0
  187. data/lib/nokogiri/xml/sax/parser.rb +199 -0
  188. data/lib/nokogiri/xml/sax/parser_context.rb +129 -0
  189. data/lib/nokogiri/xml/sax/push_parser.rb +64 -0
  190. data/lib/nokogiri/xml/sax.rb +54 -0
  191. data/lib/nokogiri/xml/schema.rb +140 -0
  192. data/lib/nokogiri/xml/searchable.rb +274 -0
  193. data/lib/nokogiri/xml/syntax_error.rb +94 -0
  194. data/lib/nokogiri/xml/text.rb +11 -0
  195. data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
  196. data/lib/nokogiri/xml/xpath.rb +21 -0
  197. data/lib/nokogiri/xml/xpath_context.rb +27 -0
  198. data/lib/nokogiri/xml.rb +65 -0
  199. data/lib/nokogiri/xslt/stylesheet.rb +49 -0
  200. data/lib/nokogiri/xslt.rb +129 -0
  201. data/lib/nokogiri.rb +128 -0
  202. data/lib/xsd/xmlparser/nokogiri.rb +105 -0
  203. metadata +321 -0
@@ -0,0 +1,633 @@
1
+ /*
2
+ * Summary: internal interfaces for XML Path Language implementation
3
+ * Description: internal interfaces for XML Path Language implementation
4
+ * used to build new modules on top of XPath like XPointer and
5
+ * XSLT
6
+ *
7
+ * Copy: See Copyright for the status of this software.
8
+ *
9
+ * Author: Daniel Veillard
10
+ */
11
+
12
+ #ifndef __XML_XPATH_INTERNALS_H__
13
+ #define __XML_XPATH_INTERNALS_H__
14
+
15
+ #include <stdio.h>
16
+ #include <libxml/xmlversion.h>
17
+ #include <libxml/xpath.h>
18
+
19
+ #ifdef LIBXML_XPATH_ENABLED
20
+
21
+ #ifdef __cplusplus
22
+ extern "C" {
23
+ #endif
24
+
25
+ /************************************************************************
26
+ * *
27
+ * Helpers *
28
+ * *
29
+ ************************************************************************/
30
+
31
+ /*
32
+ * Many of these macros may later turn into functions. They
33
+ * shouldn't be used in #ifdef's preprocessor instructions.
34
+ */
35
+ /**
36
+ * xmlXPathSetError:
37
+ * @ctxt: an XPath parser context
38
+ * @err: an xmlXPathError code
39
+ *
40
+ * Raises an error.
41
+ */
42
+ #define xmlXPathSetError(ctxt, err) \
43
+ { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
44
+ if ((ctxt) != NULL) (ctxt)->error = (err); }
45
+
46
+ /**
47
+ * xmlXPathSetArityError:
48
+ * @ctxt: an XPath parser context
49
+ *
50
+ * Raises an XPATH_INVALID_ARITY error.
51
+ */
52
+ #define xmlXPathSetArityError(ctxt) \
53
+ xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
54
+
55
+ /**
56
+ * xmlXPathSetTypeError:
57
+ * @ctxt: an XPath parser context
58
+ *
59
+ * Raises an XPATH_INVALID_TYPE error.
60
+ */
61
+ #define xmlXPathSetTypeError(ctxt) \
62
+ xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
63
+
64
+ /**
65
+ * xmlXPathGetError:
66
+ * @ctxt: an XPath parser context
67
+ *
68
+ * Get the error code of an XPath context.
69
+ *
70
+ * Returns the context error.
71
+ */
72
+ #define xmlXPathGetError(ctxt) ((ctxt)->error)
73
+
74
+ /**
75
+ * xmlXPathCheckError:
76
+ * @ctxt: an XPath parser context
77
+ *
78
+ * Check if an XPath error was raised.
79
+ *
80
+ * Returns true if an error has been raised, false otherwise.
81
+ */
82
+ #define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
83
+
84
+ /**
85
+ * xmlXPathGetDocument:
86
+ * @ctxt: an XPath parser context
87
+ *
88
+ * Get the document of an XPath context.
89
+ *
90
+ * Returns the context document.
91
+ */
92
+ #define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
93
+
94
+ /**
95
+ * xmlXPathGetContextNode:
96
+ * @ctxt: an XPath parser context
97
+ *
98
+ * Get the context node of an XPath context.
99
+ *
100
+ * Returns the context node.
101
+ */
102
+ #define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
103
+
104
+ XMLPUBFUN int
105
+ xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
106
+ XMLPUBFUN double
107
+ xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
108
+ XMLPUBFUN xmlChar *
109
+ xmlXPathPopString (xmlXPathParserContextPtr ctxt);
110
+ XMLPUBFUN xmlNodeSetPtr
111
+ xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
112
+ XMLPUBFUN void *
113
+ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
114
+
115
+ /**
116
+ * xmlXPathReturnBoolean:
117
+ * @ctxt: an XPath parser context
118
+ * @val: a boolean
119
+ *
120
+ * Pushes the boolean @val on the context stack.
121
+ */
122
+ #define xmlXPathReturnBoolean(ctxt, val) \
123
+ valuePush((ctxt), xmlXPathNewBoolean(val))
124
+
125
+ /**
126
+ * xmlXPathReturnTrue:
127
+ * @ctxt: an XPath parser context
128
+ *
129
+ * Pushes true on the context stack.
130
+ */
131
+ #define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
132
+
133
+ /**
134
+ * xmlXPathReturnFalse:
135
+ * @ctxt: an XPath parser context
136
+ *
137
+ * Pushes false on the context stack.
138
+ */
139
+ #define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
140
+
141
+ /**
142
+ * xmlXPathReturnNumber:
143
+ * @ctxt: an XPath parser context
144
+ * @val: a double
145
+ *
146
+ * Pushes the double @val on the context stack.
147
+ */
148
+ #define xmlXPathReturnNumber(ctxt, val) \
149
+ valuePush((ctxt), xmlXPathNewFloat(val))
150
+
151
+ /**
152
+ * xmlXPathReturnString:
153
+ * @ctxt: an XPath parser context
154
+ * @str: a string
155
+ *
156
+ * Pushes the string @str on the context stack.
157
+ */
158
+ #define xmlXPathReturnString(ctxt, str) \
159
+ valuePush((ctxt), xmlXPathWrapString(str))
160
+
161
+ /**
162
+ * xmlXPathReturnEmptyString:
163
+ * @ctxt: an XPath parser context
164
+ *
165
+ * Pushes an empty string on the stack.
166
+ */
167
+ #define xmlXPathReturnEmptyString(ctxt) \
168
+ valuePush((ctxt), xmlXPathNewCString(""))
169
+
170
+ /**
171
+ * xmlXPathReturnNodeSet:
172
+ * @ctxt: an XPath parser context
173
+ * @ns: a node-set
174
+ *
175
+ * Pushes the node-set @ns on the context stack.
176
+ */
177
+ #define xmlXPathReturnNodeSet(ctxt, ns) \
178
+ valuePush((ctxt), xmlXPathWrapNodeSet(ns))
179
+
180
+ /**
181
+ * xmlXPathReturnEmptyNodeSet:
182
+ * @ctxt: an XPath parser context
183
+ *
184
+ * Pushes an empty node-set on the context stack.
185
+ */
186
+ #define xmlXPathReturnEmptyNodeSet(ctxt) \
187
+ valuePush((ctxt), xmlXPathNewNodeSet(NULL))
188
+
189
+ /**
190
+ * xmlXPathReturnExternal:
191
+ * @ctxt: an XPath parser context
192
+ * @val: user data
193
+ *
194
+ * Pushes user data on the context stack.
195
+ */
196
+ #define xmlXPathReturnExternal(ctxt, val) \
197
+ valuePush((ctxt), xmlXPathWrapExternal(val))
198
+
199
+ /**
200
+ * xmlXPathStackIsNodeSet:
201
+ * @ctxt: an XPath parser context
202
+ *
203
+ * Check if the current value on the XPath stack is a node set or
204
+ * an XSLT value tree.
205
+ *
206
+ * Returns true if the current object on the stack is a node-set.
207
+ */
208
+ #define xmlXPathStackIsNodeSet(ctxt) \
209
+ (((ctxt)->value != NULL) \
210
+ && (((ctxt)->value->type == XPATH_NODESET) \
211
+ || ((ctxt)->value->type == XPATH_XSLT_TREE)))
212
+
213
+ /**
214
+ * xmlXPathStackIsExternal:
215
+ * @ctxt: an XPath parser context
216
+ *
217
+ * Checks if the current value on the XPath stack is an external
218
+ * object.
219
+ *
220
+ * Returns true if the current object on the stack is an external
221
+ * object.
222
+ */
223
+ #define xmlXPathStackIsExternal(ctxt) \
224
+ ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
225
+
226
+ /**
227
+ * xmlXPathEmptyNodeSet:
228
+ * @ns: a node-set
229
+ *
230
+ * Empties a node-set.
231
+ */
232
+ #define xmlXPathEmptyNodeSet(ns) \
233
+ { while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; }
234
+
235
+ /**
236
+ * CHECK_ERROR:
237
+ *
238
+ * Macro to return from the function if an XPath error was detected.
239
+ */
240
+ #define CHECK_ERROR \
241
+ if (ctxt->error != XPATH_EXPRESSION_OK) return
242
+
243
+ /**
244
+ * CHECK_ERROR0:
245
+ *
246
+ * Macro to return 0 from the function if an XPath error was detected.
247
+ */
248
+ #define CHECK_ERROR0 \
249
+ if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
250
+
251
+ /**
252
+ * XP_ERROR:
253
+ * @X: the error code
254
+ *
255
+ * Macro to raise an XPath error and return.
256
+ */
257
+ #define XP_ERROR(X) \
258
+ { xmlXPathErr(ctxt, X); return; }
259
+
260
+ /**
261
+ * XP_ERROR0:
262
+ * @X: the error code
263
+ *
264
+ * Macro to raise an XPath error and return 0.
265
+ */
266
+ #define XP_ERROR0(X) \
267
+ { xmlXPathErr(ctxt, X); return(0); }
268
+
269
+ /**
270
+ * CHECK_TYPE:
271
+ * @typeval: the XPath type
272
+ *
273
+ * Macro to check that the value on top of the XPath stack is of a given
274
+ * type.
275
+ */
276
+ #define CHECK_TYPE(typeval) \
277
+ if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
278
+ XP_ERROR(XPATH_INVALID_TYPE)
279
+
280
+ /**
281
+ * CHECK_TYPE0:
282
+ * @typeval: the XPath type
283
+ *
284
+ * Macro to check that the value on top of the XPath stack is of a given
285
+ * type. Return(0) in case of failure
286
+ */
287
+ #define CHECK_TYPE0(typeval) \
288
+ if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
289
+ XP_ERROR0(XPATH_INVALID_TYPE)
290
+
291
+ /**
292
+ * CHECK_ARITY:
293
+ * @x: the number of expected args
294
+ *
295
+ * Macro to check that the number of args passed to an XPath function matches.
296
+ */
297
+ #define CHECK_ARITY(x) \
298
+ if (ctxt == NULL) return; \
299
+ if (nargs != (x)) \
300
+ XP_ERROR(XPATH_INVALID_ARITY); \
301
+ if (ctxt->valueNr < (x)) \
302
+ XP_ERROR(XPATH_STACK_ERROR);
303
+
304
+ /**
305
+ * CAST_TO_STRING:
306
+ *
307
+ * Macro to try to cast the value on the top of the XPath stack to a string.
308
+ */
309
+ #define CAST_TO_STRING \
310
+ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
311
+ xmlXPathStringFunction(ctxt, 1);
312
+
313
+ /**
314
+ * CAST_TO_NUMBER:
315
+ *
316
+ * Macro to try to cast the value on the top of the XPath stack to a number.
317
+ */
318
+ #define CAST_TO_NUMBER \
319
+ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
320
+ xmlXPathNumberFunction(ctxt, 1);
321
+
322
+ /**
323
+ * CAST_TO_BOOLEAN:
324
+ *
325
+ * Macro to try to cast the value on the top of the XPath stack to a boolean.
326
+ */
327
+ #define CAST_TO_BOOLEAN \
328
+ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
329
+ xmlXPathBooleanFunction(ctxt, 1);
330
+
331
+ /*
332
+ * Variable Lookup forwarding.
333
+ */
334
+
335
+ XMLPUBFUN void
336
+ xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
337
+ xmlXPathVariableLookupFunc f,
338
+ void *data);
339
+
340
+ /*
341
+ * Function Lookup forwarding.
342
+ */
343
+
344
+ XMLPUBFUN void
345
+ xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
346
+ xmlXPathFuncLookupFunc f,
347
+ void *funcCtxt);
348
+
349
+ /*
350
+ * Error reporting.
351
+ */
352
+ XMLPUBFUN void
353
+ xmlXPatherror (xmlXPathParserContextPtr ctxt,
354
+ const char *file,
355
+ int line,
356
+ int no);
357
+
358
+ XMLPUBFUN void
359
+ xmlXPathErr (xmlXPathParserContextPtr ctxt,
360
+ int error);
361
+
362
+ #ifdef LIBXML_DEBUG_ENABLED
363
+ XMLPUBFUN void
364
+ xmlXPathDebugDumpObject (FILE *output,
365
+ xmlXPathObjectPtr cur,
366
+ int depth);
367
+ XMLPUBFUN void
368
+ xmlXPathDebugDumpCompExpr(FILE *output,
369
+ xmlXPathCompExprPtr comp,
370
+ int depth);
371
+ #endif
372
+ /**
373
+ * NodeSet handling.
374
+ */
375
+ XMLPUBFUN int
376
+ xmlXPathNodeSetContains (xmlNodeSetPtr cur,
377
+ xmlNodePtr val);
378
+ XMLPUBFUN xmlNodeSetPtr
379
+ xmlXPathDifference (xmlNodeSetPtr nodes1,
380
+ xmlNodeSetPtr nodes2);
381
+ XMLPUBFUN xmlNodeSetPtr
382
+ xmlXPathIntersection (xmlNodeSetPtr nodes1,
383
+ xmlNodeSetPtr nodes2);
384
+
385
+ XMLPUBFUN xmlNodeSetPtr
386
+ xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
387
+ XMLPUBFUN xmlNodeSetPtr
388
+ xmlXPathDistinct (xmlNodeSetPtr nodes);
389
+
390
+ XMLPUBFUN int
391
+ xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
392
+ xmlNodeSetPtr nodes2);
393
+
394
+ XMLPUBFUN xmlNodeSetPtr
395
+ xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
396
+ xmlNodePtr node);
397
+ XMLPUBFUN xmlNodeSetPtr
398
+ xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
399
+ xmlNodeSetPtr nodes2);
400
+ XMLPUBFUN xmlNodeSetPtr
401
+ xmlXPathNodeLeading (xmlNodeSetPtr nodes,
402
+ xmlNodePtr node);
403
+ XMLPUBFUN xmlNodeSetPtr
404
+ xmlXPathLeading (xmlNodeSetPtr nodes1,
405
+ xmlNodeSetPtr nodes2);
406
+
407
+ XMLPUBFUN xmlNodeSetPtr
408
+ xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
409
+ xmlNodePtr node);
410
+ XMLPUBFUN xmlNodeSetPtr
411
+ xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
412
+ xmlNodeSetPtr nodes2);
413
+ XMLPUBFUN xmlNodeSetPtr
414
+ xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
415
+ xmlNodePtr node);
416
+ XMLPUBFUN xmlNodeSetPtr
417
+ xmlXPathTrailing (xmlNodeSetPtr nodes1,
418
+ xmlNodeSetPtr nodes2);
419
+
420
+
421
+ /**
422
+ * Extending a context.
423
+ */
424
+
425
+ XMLPUBFUN int
426
+ xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
427
+ const xmlChar *prefix,
428
+ const xmlChar *ns_uri);
429
+ XMLPUBFUN const xmlChar *
430
+ xmlXPathNsLookup (xmlXPathContextPtr ctxt,
431
+ const xmlChar *prefix);
432
+ XMLPUBFUN void
433
+ xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
434
+
435
+ XMLPUBFUN int
436
+ xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
437
+ const xmlChar *name,
438
+ xmlXPathFunction f);
439
+ XMLPUBFUN int
440
+ xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
441
+ const xmlChar *name,
442
+ const xmlChar *ns_uri,
443
+ xmlXPathFunction f);
444
+ XMLPUBFUN int
445
+ xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
446
+ const xmlChar *name,
447
+ xmlXPathObjectPtr value);
448
+ XMLPUBFUN int
449
+ xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
450
+ const xmlChar *name,
451
+ const xmlChar *ns_uri,
452
+ xmlXPathObjectPtr value);
453
+ XMLPUBFUN xmlXPathFunction
454
+ xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
455
+ const xmlChar *name);
456
+ XMLPUBFUN xmlXPathFunction
457
+ xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
458
+ const xmlChar *name,
459
+ const xmlChar *ns_uri);
460
+ XMLPUBFUN void
461
+ xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt);
462
+ XMLPUBFUN xmlXPathObjectPtr
463
+ xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
464
+ const xmlChar *name);
465
+ XMLPUBFUN xmlXPathObjectPtr
466
+ xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
467
+ const xmlChar *name,
468
+ const xmlChar *ns_uri);
469
+ XMLPUBFUN void
470
+ xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
471
+
472
+ /**
473
+ * Utilities to extend XPath.
474
+ */
475
+ XMLPUBFUN xmlXPathParserContextPtr
476
+ xmlXPathNewParserContext (const xmlChar *str,
477
+ xmlXPathContextPtr ctxt);
478
+ XMLPUBFUN void
479
+ xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
480
+
481
+ /* TODO: remap to xmlXPathValuePop and Push. */
482
+ XMLPUBFUN xmlXPathObjectPtr
483
+ valuePop (xmlXPathParserContextPtr ctxt);
484
+ XMLPUBFUN int
485
+ valuePush (xmlXPathParserContextPtr ctxt,
486
+ xmlXPathObjectPtr value);
487
+
488
+ XMLPUBFUN xmlXPathObjectPtr
489
+ xmlXPathNewString (const xmlChar *val);
490
+ XMLPUBFUN xmlXPathObjectPtr
491
+ xmlXPathNewCString (const char *val);
492
+ XMLPUBFUN xmlXPathObjectPtr
493
+ xmlXPathWrapString (xmlChar *val);
494
+ XMLPUBFUN xmlXPathObjectPtr
495
+ xmlXPathWrapCString (char * val);
496
+ XMLPUBFUN xmlXPathObjectPtr
497
+ xmlXPathNewFloat (double val);
498
+ XMLPUBFUN xmlXPathObjectPtr
499
+ xmlXPathNewBoolean (int val);
500
+ XMLPUBFUN xmlXPathObjectPtr
501
+ xmlXPathNewNodeSet (xmlNodePtr val);
502
+ XMLPUBFUN xmlXPathObjectPtr
503
+ xmlXPathNewValueTree (xmlNodePtr val);
504
+ XMLPUBFUN int
505
+ xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
506
+ xmlNodePtr val);
507
+ XMLPUBFUN int
508
+ xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
509
+ xmlNodePtr val);
510
+ XMLPUBFUN int
511
+ xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
512
+ xmlNodePtr node,
513
+ xmlNsPtr ns);
514
+ XMLPUBFUN void
515
+ xmlXPathNodeSetSort (xmlNodeSetPtr set);
516
+
517
+ XMLPUBFUN void
518
+ xmlXPathRoot (xmlXPathParserContextPtr ctxt);
519
+ XMLPUBFUN void
520
+ xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
521
+ XMLPUBFUN xmlChar *
522
+ xmlXPathParseName (xmlXPathParserContextPtr ctxt);
523
+ XMLPUBFUN xmlChar *
524
+ xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
525
+
526
+ /*
527
+ * Existing functions.
528
+ */
529
+ XMLPUBFUN double
530
+ xmlXPathStringEvalNumber (const xmlChar *str);
531
+ XMLPUBFUN int
532
+ xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
533
+ xmlXPathObjectPtr res);
534
+ XMLPUBFUN void
535
+ xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt);
536
+ XMLPUBFUN xmlNodeSetPtr
537
+ xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
538
+ xmlNodeSetPtr val2);
539
+ XMLPUBFUN void
540
+ xmlXPathNodeSetDel (xmlNodeSetPtr cur,
541
+ xmlNodePtr val);
542
+ XMLPUBFUN void
543
+ xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
544
+ int val);
545
+ XMLPUBFUN xmlXPathObjectPtr
546
+ xmlXPathNewNodeSetList (xmlNodeSetPtr val);
547
+ XMLPUBFUN xmlXPathObjectPtr
548
+ xmlXPathWrapNodeSet (xmlNodeSetPtr val);
549
+ XMLPUBFUN xmlXPathObjectPtr
550
+ xmlXPathWrapExternal (void *val);
551
+
552
+ XMLPUBFUN int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
553
+ XMLPUBFUN int xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
554
+ XMLPUBFUN int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
555
+ XMLPUBFUN void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
556
+ XMLPUBFUN void xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
557
+ XMLPUBFUN void xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
558
+ XMLPUBFUN void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
559
+ XMLPUBFUN void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
560
+ XMLPUBFUN void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
561
+
562
+ XMLPUBFUN int xmlXPathIsNodeType(const xmlChar *name);
563
+
564
+ /*
565
+ * Some of the axis navigation routines.
566
+ */
567
+ XMLPUBFUN xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
568
+ xmlNodePtr cur);
569
+ XMLPUBFUN xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
570
+ xmlNodePtr cur);
571
+ XMLPUBFUN xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
572
+ xmlNodePtr cur);
573
+ XMLPUBFUN xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
574
+ xmlNodePtr cur);
575
+ XMLPUBFUN xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
576
+ xmlNodePtr cur);
577
+ XMLPUBFUN xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
578
+ xmlNodePtr cur);
579
+ XMLPUBFUN xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
580
+ xmlNodePtr cur);
581
+ XMLPUBFUN xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
582
+ xmlNodePtr cur);
583
+ XMLPUBFUN xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
584
+ xmlNodePtr cur);
585
+ XMLPUBFUN xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
586
+ xmlNodePtr cur);
587
+ XMLPUBFUN xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
588
+ xmlNodePtr cur);
589
+ XMLPUBFUN xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
590
+ xmlNodePtr cur);
591
+ XMLPUBFUN xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
592
+ xmlNodePtr cur);
593
+ /*
594
+ * The official core of XPath functions.
595
+ */
596
+ XMLPUBFUN void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
597
+ XMLPUBFUN void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
598
+ XMLPUBFUN void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
599
+ XMLPUBFUN void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
600
+ XMLPUBFUN void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
601
+ XMLPUBFUN void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
602
+ XMLPUBFUN void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
603
+ XMLPUBFUN void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
604
+ XMLPUBFUN void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
605
+ XMLPUBFUN void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
606
+ XMLPUBFUN void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
607
+ XMLPUBFUN void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
608
+ XMLPUBFUN void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
609
+ XMLPUBFUN void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
610
+ XMLPUBFUN void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
611
+ XMLPUBFUN void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
612
+ XMLPUBFUN void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
613
+ XMLPUBFUN void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
614
+ XMLPUBFUN void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
615
+ XMLPUBFUN void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
616
+ XMLPUBFUN void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
617
+ XMLPUBFUN void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
618
+ XMLPUBFUN void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
619
+ XMLPUBFUN void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
620
+ XMLPUBFUN void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
621
+ XMLPUBFUN void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
622
+
623
+ /**
624
+ * Really internal functions
625
+ */
626
+ XMLPUBFUN void xmlXPathNodeSetFreeNs(xmlNsPtr ns);
627
+
628
+ #ifdef __cplusplus
629
+ }
630
+ #endif
631
+
632
+ #endif /* LIBXML_XPATH_ENABLED */
633
+ #endif /* ! __XML_XPATH_INTERNALS_H__ */