Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 1 | /* |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 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 |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 6 | * |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 7 | * Copy: See Copyright for the status of this software. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 8 | * |
Daniel Veillard | be58697 | 2003-11-18 20:56:51 +0000 | [diff] [blame] | 9 | * Author: Daniel Veillard |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef __XML_XPATH_INTERNALS_H__ |
| 13 | #define __XML_XPATH_INTERNALS_H__ |
| 14 | |
Daniel Veillard | 017b108 | 2001-06-21 11:20:21 +0000 | [diff] [blame] | 15 | #include <libxml/xmlversion.h> |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 16 | #include <libxml/xpath.h> |
| 17 | |
| 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
| 22 | /************************************************************************ |
| 23 | * * |
| 24 | * Helpers * |
| 25 | * * |
| 26 | ************************************************************************/ |
| 27 | |
William M. Brack | 60f394e | 2003-11-16 06:25:42 +0000 | [diff] [blame] | 28 | /* |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 29 | * Many of these macros may later turn into functions. They |
| 30 | * shouldn't be used in #ifdef's preprocessor instructions. |
| 31 | */ |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 32 | /** |
| 33 | * xmlXPathSetError: |
| 34 | * @ctxt: an XPath parser context |
| 35 | * @err: an xmlXPathError code |
| 36 | * |
| 37 | * Raises an error. |
| 38 | */ |
| 39 | #define xmlXPathSetError(ctxt, err) \ |
| 40 | { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ |
| 41 | (ctxt)->error = (err); } |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 42 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 43 | /** |
| 44 | * xmlXPathSetArityError: |
| 45 | * @ctxt: an XPath parser context |
| 46 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 47 | * Raises an XPATH_INVALID_ARITY error. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 48 | */ |
| 49 | #define xmlXPathSetArityError(ctxt) \ |
| 50 | xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 51 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 52 | /** |
| 53 | * xmlXPathSetTypeError: |
| 54 | * @ctxt: an XPath parser context |
| 55 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 56 | * Raises an XPATH_INVALID_TYPE error. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 57 | */ |
| 58 | #define xmlXPathSetTypeError(ctxt) \ |
| 59 | xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 60 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 61 | /** |
| 62 | * xmlXPathGetError: |
| 63 | * @ctxt: an XPath parser context |
| 64 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 65 | * Get the error code of an XPath context. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 66 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 67 | * Returns the context error. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 68 | */ |
| 69 | #define xmlXPathGetError(ctxt) ((ctxt)->error) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 70 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 71 | /** |
| 72 | * xmlXPathCheckError: |
| 73 | * @ctxt: an XPath parser context |
| 74 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 75 | * Check if an XPath error was raised. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 76 | * |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 77 | * Returns true if an error has been raised, false otherwise. |
| 78 | */ |
| 79 | #define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) |
| 80 | |
| 81 | /** |
| 82 | * xmlXPathGetDocument: |
| 83 | * @ctxt: an XPath parser context |
| 84 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 85 | * Get the document of an XPath context. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 86 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 87 | * Returns the context document. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 88 | */ |
| 89 | #define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 90 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 91 | /** |
| 92 | * xmlXPathGetContextNode: |
| 93 | * @ctxt: an XPath parser context |
| 94 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 95 | * Get the context node of an XPath context. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 96 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 97 | * Returns the context node. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 98 | */ |
| 99 | #define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) |
| 100 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 101 | XMLPUBFUN int XMLCALL |
| 102 | xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); |
| 103 | XMLPUBFUN double XMLCALL |
| 104 | xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); |
| 105 | XMLPUBFUN xmlChar * XMLCALL |
| 106 | xmlXPathPopString (xmlXPathParserContextPtr ctxt); |
| 107 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 108 | xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); |
| 109 | XMLPUBFUN void * XMLCALL |
| 110 | xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 111 | |
| 112 | /** |
| 113 | * xmlXPathReturnBoolean: |
| 114 | * @ctxt: an XPath parser context |
| 115 | * @val: a boolean |
| 116 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 117 | * Pushes the boolean @val on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 118 | */ |
| 119 | #define xmlXPathReturnBoolean(ctxt, val) \ |
| 120 | valuePush((ctxt), xmlXPathNewBoolean(val)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 121 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 122 | /** |
| 123 | * xmlXPathReturnTrue: |
| 124 | * @ctxt: an XPath parser context |
| 125 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 126 | * Pushes true on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 127 | */ |
| 128 | #define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 129 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 130 | /** |
| 131 | * xmlXPathReturnFalse: |
| 132 | * @ctxt: an XPath parser context |
| 133 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 134 | * Pushes false on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 135 | */ |
| 136 | #define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 137 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 138 | /** |
| 139 | * xmlXPathReturnNumber: |
| 140 | * @ctxt: an XPath parser context |
| 141 | * @val: a double |
| 142 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 143 | * Pushes the double @val on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 144 | */ |
| 145 | #define xmlXPathReturnNumber(ctxt, val) \ |
| 146 | valuePush((ctxt), xmlXPathNewFloat(val)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 147 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 148 | /** |
| 149 | * xmlXPathReturnString: |
| 150 | * @ctxt: an XPath parser context |
| 151 | * @str: a string |
| 152 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 153 | * Pushes the string @str on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 154 | */ |
| 155 | #define xmlXPathReturnString(ctxt, str) \ |
William M. Brack | 09428a3 | 2003-12-20 09:20:39 +0000 | [diff] [blame^] | 156 | valuePush((ctxt), xmlXPathWrapString(str)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 157 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 158 | /** |
| 159 | * xmlXPathReturnEmptyString: |
| 160 | * @ctxt: an XPath parser context |
| 161 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 162 | * Pushes an empty string on the stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 163 | */ |
| 164 | #define xmlXPathReturnEmptyString(ctxt) \ |
| 165 | valuePush((ctxt), xmlXPathNewCString("")) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 166 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 167 | /** |
| 168 | * xmlXPathReturnNodeSet: |
| 169 | * @ctxt: an XPath parser context |
| 170 | * @ns: a node-set |
| 171 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 172 | * Pushes the node-set @ns on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 173 | */ |
| 174 | #define xmlXPathReturnNodeSet(ctxt, ns) \ |
| 175 | valuePush((ctxt), xmlXPathWrapNodeSet(ns)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 176 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 177 | /** |
| 178 | * xmlXPathReturnEmptyNodeSet: |
| 179 | * @ctxt: an XPath parser context |
| 180 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 181 | * Pushes an empty node-set on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 182 | */ |
Daniel Veillard | 5344c60 | 2001-12-31 16:37:34 +0000 | [diff] [blame] | 183 | #define xmlXPathReturnEmptyNodeSet(ctxt) \ |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 184 | valuePush((ctxt), xmlXPathNewNodeSet(NULL)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 185 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 186 | /** |
| 187 | * xmlXPathReturnExternal: |
| 188 | * @ctxt: an XPath parser context |
| 189 | * @val: user data |
| 190 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 191 | * Pushes user data on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 192 | */ |
| 193 | #define xmlXPathReturnExternal(ctxt, val) \ |
| 194 | valuePush((ctxt), xmlXPathWrapExternal(val)) |
| 195 | |
| 196 | /** |
| 197 | * xmlXPathStackIsNodeSet: |
| 198 | * @ctxt: an XPath parser context |
| 199 | * |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 200 | * Check if the current value on the XPath stack is a node set or |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 201 | * an XSLT value tree. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 202 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 203 | * Returns true if the current object on the stack is a node-set. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 204 | */ |
| 205 | #define xmlXPathStackIsNodeSet(ctxt) \ |
| 206 | (((ctxt)->value != NULL) \ |
| 207 | && (((ctxt)->value->type == XPATH_NODESET) \ |
| 208 | || ((ctxt)->value->type == XPATH_XSLT_TREE))) |
| 209 | |
| 210 | /** |
Thomas Broyer | 47334c0 | 2001-10-07 16:41:52 +0000 | [diff] [blame] | 211 | * xmlXPathStackIsExternal: |
| 212 | * @ctxt: an XPath parser context |
| 213 | * |
| 214 | * Checks if the current value on the XPath stack is an external |
| 215 | * object. |
| 216 | * |
| 217 | * Returns true if the current object on the stack is an external |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 218 | * object. |
Thomas Broyer | 47334c0 | 2001-10-07 16:41:52 +0000 | [diff] [blame] | 219 | */ |
| 220 | #define xmlXPathStackIsExternal(ctxt) \ |
| 221 | ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) |
| 222 | |
| 223 | /** |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 224 | * xmlXPathEmptyNodeSet: |
| 225 | * @ns: a node-set |
| 226 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 227 | * Empties a node-set. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 228 | */ |
| 229 | #define xmlXPathEmptyNodeSet(ns) \ |
| 230 | { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } |
| 231 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 232 | /** |
| 233 | * CHECK_ERROR: |
| 234 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 235 | * Macro to return from the function if an XPath error was detected. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 236 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 237 | #define CHECK_ERROR \ |
| 238 | if (ctxt->error != XPATH_EXPRESSION_OK) return |
| 239 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 240 | /** |
| 241 | * CHECK_ERROR0: |
| 242 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 243 | * Macro to return 0 from the function if an XPath error was detected. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 244 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 245 | #define CHECK_ERROR0 \ |
| 246 | if (ctxt->error != XPATH_EXPRESSION_OK) return(0) |
| 247 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 248 | /** |
| 249 | * XP_ERROR: |
| 250 | * @X: the error code |
| 251 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 252 | * Macro to raise an XPath error and return. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 253 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 254 | #define XP_ERROR(X) \ |
Daniel Veillard | d96f6d3 | 2003-10-07 21:25:12 +0000 | [diff] [blame] | 255 | { xmlXPathErr(ctxt, X); return; } |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 256 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 257 | /** |
| 258 | * XP_ERROR0: |
| 259 | * @X: the error code |
| 260 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 261 | * Macro to raise an XPath error and return 0. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 262 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 263 | #define XP_ERROR0(X) \ |
Daniel Veillard | d96f6d3 | 2003-10-07 21:25:12 +0000 | [diff] [blame] | 264 | { xmlXPathErr(ctxt, X); return(0); } |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 265 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 266 | /** |
| 267 | * CHECK_TYPE: |
| 268 | * @typeval: the XPath type |
| 269 | * |
| 270 | * Macro to check that the value on top of the XPath stack is of a given |
| 271 | * type. |
| 272 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 273 | #define CHECK_TYPE(typeval) \ |
| 274 | if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ |
| 275 | XP_ERROR(XPATH_INVALID_TYPE) |
| 276 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 277 | /** |
Daniel Veillard | f06307e | 2001-07-03 10:35:50 +0000 | [diff] [blame] | 278 | * CHECK_TYPE0: |
| 279 | * @typeval: the XPath type |
| 280 | * |
| 281 | * Macro to check that the value on top of the XPath stack is of a given |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 282 | * type. Return(0) in case of failure |
Daniel Veillard | f06307e | 2001-07-03 10:35:50 +0000 | [diff] [blame] | 283 | */ |
| 284 | #define CHECK_TYPE0(typeval) \ |
| 285 | if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ |
| 286 | XP_ERROR0(XPATH_INVALID_TYPE) |
| 287 | |
| 288 | /** |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 289 | * CHECK_ARITY: |
| 290 | * @x: the number of expected args |
| 291 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 292 | * Macro to check that the number of args passed to an XPath function matches. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 293 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 294 | #define CHECK_ARITY(x) \ |
| 295 | if (nargs != (x)) \ |
| 296 | XP_ERROR(XPATH_INVALID_ARITY); |
| 297 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 298 | /** |
| 299 | * CAST_TO_STRING: |
| 300 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 301 | * Macro to try to cast the value on the top of the XPath stack to a string. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 302 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 303 | #define CAST_TO_STRING \ |
| 304 | if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ |
| 305 | xmlXPathStringFunction(ctxt, 1); |
| 306 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 307 | /** |
| 308 | * CAST_TO_NUMBER: |
| 309 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 310 | * Macro to try to cast the value on the top of the XPath stack to a number. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 311 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 312 | #define CAST_TO_NUMBER \ |
| 313 | if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ |
| 314 | xmlXPathNumberFunction(ctxt, 1); |
| 315 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 316 | /** |
| 317 | * CAST_TO_BOOLEAN: |
| 318 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 319 | * Macro to try to cast the value on the top of the XPath stack to a boolean. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 320 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 321 | #define CAST_TO_BOOLEAN \ |
| 322 | if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ |
| 323 | xmlXPathBooleanFunction(ctxt, 1); |
| 324 | |
| 325 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 326 | * Variable Lookup forwarding. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 327 | */ |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 328 | /** |
| 329 | * xmlXPathVariableLookupFunc: |
| 330 | * @ctxt: an XPath context |
| 331 | * @name: name of the variable |
| 332 | * @ns_uri: the namespace name hosting this variable |
| 333 | * |
| 334 | * Prototype for callbacks used to plug variable lookup in the XPath |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 335 | * engine. |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 336 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 337 | * Returns the XPath object value or NULL if not found. |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 338 | */ |
| 339 | typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 340 | const xmlChar *name, |
| 341 | const xmlChar *ns_uri); |
| 342 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 343 | XMLPUBFUN void XMLCALL |
| 344 | xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 345 | xmlXPathVariableLookupFunc f, |
Daniel Veillard | cbaf399 | 2001-12-31 16:16:02 +0000 | [diff] [blame] | 346 | void *data); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 347 | |
| 348 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 349 | * Function Lookup forwarding. |
Thomas Broyer | ba4ad32 | 2001-07-26 16:55:21 +0000 | [diff] [blame] | 350 | */ |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 351 | /** |
| 352 | * xmlXPathFuncLookupFunc: |
| 353 | * @ctxt: an XPath context |
| 354 | * @name: name of the function |
| 355 | * @ns_uri: the namespace name hosting this function |
| 356 | * |
| 357 | * Prototype for callbacks used to plug function lookup in the XPath |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 358 | * engine. |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 359 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 360 | * Returns the XPath function or NULL if not found. |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 361 | */ |
Daniel Veillard | 99e55eb | 2002-01-21 08:56:29 +0000 | [diff] [blame] | 362 | typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, |
Thomas Broyer | ba4ad32 | 2001-07-26 16:55:21 +0000 | [diff] [blame] | 363 | const xmlChar *name, |
| 364 | const xmlChar *ns_uri); |
| 365 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 366 | XMLPUBFUN void XMLCALL |
| 367 | xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, |
Thomas Broyer | ba4ad32 | 2001-07-26 16:55:21 +0000 | [diff] [blame] | 368 | xmlXPathFuncLookupFunc f, |
| 369 | void *funcCtxt); |
| 370 | |
| 371 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 372 | * Error reporting. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 373 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 374 | XMLPUBFUN void XMLCALL |
| 375 | xmlXPatherror (xmlXPathParserContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 376 | const char *file, |
| 377 | int line, |
| 378 | int no); |
| 379 | |
Daniel Veillard | d96f6d3 | 2003-10-07 21:25:12 +0000 | [diff] [blame] | 380 | XMLPUBFUN void XMLCALL |
| 381 | xmlXPathErr (xmlXPathParserContextPtr ctxt, |
| 382 | int error); |
| 383 | |
Daniel Veillard | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame] | 384 | #ifdef LIBXML_DEBUG_ENABLED |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 385 | XMLPUBFUN void XMLCALL |
| 386 | xmlXPathDebugDumpObject (FILE *output, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 387 | xmlXPathObjectPtr cur, |
| 388 | int depth); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 389 | XMLPUBFUN void XMLCALL |
| 390 | xmlXPathDebugDumpCompExpr(FILE *output, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 391 | xmlXPathCompExprPtr comp, |
| 392 | int depth); |
Daniel Veillard | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame] | 393 | #endif |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 394 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 395 | * NodeSet handling. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 396 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 397 | XMLPUBFUN int XMLCALL |
| 398 | xmlXPathNodeSetContains (xmlNodeSetPtr cur, |
Thomas Broyer | f186c82 | 2001-07-31 23:30:37 +0000 | [diff] [blame] | 399 | xmlNodePtr val); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 400 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 401 | xmlXPathDifference (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 402 | xmlNodeSetPtr nodes2); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 403 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 404 | xmlXPathIntersection (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 405 | xmlNodeSetPtr nodes2); |
| 406 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 407 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 408 | xmlXPathDistinctSorted (xmlNodeSetPtr nodes); |
| 409 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 410 | xmlXPathDistinct (xmlNodeSetPtr nodes); |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 411 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 412 | XMLPUBFUN int XMLCALL |
| 413 | xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 414 | xmlNodeSetPtr nodes2); |
| 415 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 416 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 417 | xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 418 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 419 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 420 | xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 421 | xmlNodeSetPtr nodes2); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 422 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 423 | xmlXPathNodeLeading (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 424 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 425 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 426 | xmlXPathLeading (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 427 | xmlNodeSetPtr nodes2); |
| 428 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 429 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 430 | xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 431 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 432 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 433 | xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 434 | xmlNodeSetPtr nodes2); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 435 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 436 | xmlXPathNodeTrailing (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 437 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 438 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 439 | xmlXPathTrailing (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 440 | xmlNodeSetPtr nodes2); |
| 441 | |
| 442 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 443 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 444 | * Extending a context. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 445 | */ |
| 446 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 447 | XMLPUBFUN int XMLCALL |
| 448 | xmlXPathRegisterNs (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 449 | const xmlChar *prefix, |
| 450 | const xmlChar *ns_uri); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 451 | XMLPUBFUN const xmlChar * XMLCALL |
| 452 | xmlXPathNsLookup (xmlXPathContextPtr ctxt, |
Daniel Veillard | cbaf399 | 2001-12-31 16:16:02 +0000 | [diff] [blame] | 453 | const xmlChar *prefix); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 454 | XMLPUBFUN void XMLCALL |
| 455 | xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 456 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 457 | XMLPUBFUN int XMLCALL |
| 458 | xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 459 | const xmlChar *name, |
| 460 | xmlXPathFunction f); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 461 | XMLPUBFUN int XMLCALL |
| 462 | xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 463 | const xmlChar *name, |
| 464 | const xmlChar *ns_uri, |
| 465 | xmlXPathFunction f); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 466 | XMLPUBFUN int XMLCALL |
| 467 | xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 468 | const xmlChar *name, |
| 469 | xmlXPathObjectPtr value); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 470 | XMLPUBFUN int XMLCALL |
| 471 | xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 472 | const xmlChar *name, |
| 473 | const xmlChar *ns_uri, |
| 474 | xmlXPathObjectPtr value); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 475 | XMLPUBFUN xmlXPathFunction XMLCALL |
| 476 | xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 477 | const xmlChar *name); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 478 | XMLPUBFUN xmlXPathFunction XMLCALL |
| 479 | xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 480 | const xmlChar *name, |
| 481 | const xmlChar *ns_uri); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 482 | XMLPUBFUN void XMLCALL |
| 483 | xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); |
| 484 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 485 | xmlXPathVariableLookup (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 486 | const xmlChar *name); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 487 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 488 | xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 489 | const xmlChar *name, |
| 490 | const xmlChar *ns_uri); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 491 | XMLPUBFUN void XMLCALL |
| 492 | xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 493 | |
| 494 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 495 | * Utilities to extend XPath. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 496 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 497 | XMLPUBFUN xmlXPathParserContextPtr XMLCALL |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 498 | xmlXPathNewParserContext (const xmlChar *str, |
| 499 | xmlXPathContextPtr ctxt); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 500 | XMLPUBFUN void XMLCALL |
| 501 | xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 502 | |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 503 | /* TODO: remap to xmlXPathValuePop and Push. */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 504 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 505 | valuePop (xmlXPathParserContextPtr ctxt); |
| 506 | XMLPUBFUN int XMLCALL |
| 507 | valuePush (xmlXPathParserContextPtr ctxt, |
| 508 | xmlXPathObjectPtr value); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 509 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 510 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 511 | xmlXPathNewString (const xmlChar *val); |
| 512 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 513 | xmlXPathNewCString (const char *val); |
| 514 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 515 | xmlXPathWrapString (xmlChar *val); |
| 516 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 517 | xmlXPathWrapCString (char * val); |
| 518 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 519 | xmlXPathNewFloat (double val); |
| 520 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 521 | xmlXPathNewBoolean (int val); |
| 522 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 523 | xmlXPathNewNodeSet (xmlNodePtr val); |
| 524 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 525 | xmlXPathNewValueTree (xmlNodePtr val); |
| 526 | XMLPUBFUN void XMLCALL |
| 527 | xmlXPathNodeSetAdd (xmlNodeSetPtr cur, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 528 | xmlNodePtr val); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 529 | XMLPUBFUN void XMLCALL |
| 530 | xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 531 | xmlNodePtr val); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 532 | XMLPUBFUN void XMLCALL |
| 533 | xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, |
Aleksey Sanin | 79376ba | 2002-05-14 06:41:32 +0000 | [diff] [blame] | 534 | xmlNodePtr node, |
| 535 | xmlNsPtr ns); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 536 | XMLPUBFUN void XMLCALL |
| 537 | xmlXPathNodeSetSort (xmlNodeSetPtr set); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 538 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 539 | XMLPUBFUN void XMLCALL |
| 540 | xmlXPathRoot (xmlXPathParserContextPtr ctxt); |
| 541 | XMLPUBFUN void XMLCALL |
| 542 | xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); |
| 543 | XMLPUBFUN xmlChar * XMLCALL |
| 544 | xmlXPathParseName (xmlXPathParserContextPtr ctxt); |
| 545 | XMLPUBFUN xmlChar * XMLCALL |
| 546 | xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 547 | |
| 548 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 549 | * Existing functions. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 550 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 551 | XMLPUBFUN double XMLCALL |
| 552 | xmlXPathStringEvalNumber (const xmlChar *str); |
| 553 | XMLPUBFUN int XMLCALL |
| 554 | xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, |
| 555 | xmlXPathObjectPtr res); |
| 556 | XMLPUBFUN void XMLCALL |
| 557 | xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); |
| 558 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 559 | xmlXPathNodeSetMerge (xmlNodeSetPtr val1, |
| 560 | xmlNodeSetPtr val2); |
| 561 | XMLPUBFUN void XMLCALL |
| 562 | xmlXPathNodeSetDel (xmlNodeSetPtr cur, |
| 563 | xmlNodePtr val); |
| 564 | XMLPUBFUN void XMLCALL |
| 565 | xmlXPathNodeSetRemove (xmlNodeSetPtr cur, |
| 566 | int val); |
| 567 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 568 | xmlXPathNewNodeSetList (xmlNodeSetPtr val); |
| 569 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 570 | xmlXPathWrapNodeSet (xmlNodeSetPtr val); |
| 571 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 572 | xmlXPathWrapExternal (void *val); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 573 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 574 | XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); |
| 575 | XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); |
| 576 | XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); |
| 577 | XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); |
| 578 | XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); |
| 579 | XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); |
| 580 | XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); |
| 581 | XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); |
| 582 | XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 583 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 584 | XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 585 | |
| 586 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 587 | * Some of the axis navigation routines. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 588 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 589 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 590 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 591 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 592 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 593 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 594 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 595 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 596 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 597 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 598 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 599 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 600 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 601 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 602 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 603 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 604 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 605 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 606 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 607 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 608 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 609 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 610 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 611 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 612 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 613 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 614 | xmlNodePtr cur); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 615 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 616 | * The official core of XPath functions. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 617 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 618 | XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 619 | XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 620 | XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 621 | XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 622 | XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 623 | XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 624 | XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 625 | XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 626 | XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 627 | XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 628 | XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 629 | XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 630 | XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 631 | XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 632 | XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 633 | XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 634 | XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 635 | XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 636 | XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 637 | XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 638 | XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 639 | XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 640 | XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 641 | XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 642 | XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 643 | XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); |
Aleksey Sanin | f8cb6dd | 2002-06-04 04:27:06 +0000 | [diff] [blame] | 644 | |
| 645 | /** |
| 646 | * Really internal functions |
| 647 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 648 | XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); |
Aleksey Sanin | f8cb6dd | 2002-06-04 04:27:06 +0000 | [diff] [blame] | 649 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 650 | #ifdef __cplusplus |
| 651 | } |
| 652 | #endif |
| 653 | #endif /* ! __XML_XPATH_INTERNALS_H__ */ |