Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 1 | /* |
Daniel Veillard | cbaf399 | 2001-12-31 16:16:02 +0000 | [diff] [blame] | 2 | * xpathInternals.c: internal interfaces for XML Path Language implementation |
| 3 | * used to build new modules on top of XPath |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 4 | * |
| 5 | * See COPYRIGHT for the status of this software |
| 6 | * |
Daniel Veillard | c5d6434 | 2001-06-24 12:13:24 +0000 | [diff] [blame] | 7 | * Author: daniel@veillard.com |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __XML_XPATH_INTERNALS_H__ |
| 11 | #define __XML_XPATH_INTERNALS_H__ |
| 12 | |
Daniel Veillard | 017b108 | 2001-06-21 11:20:21 +0000 | [diff] [blame] | 13 | #include <libxml/xmlversion.h> |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 14 | #include <libxml/xpath.h> |
| 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
| 20 | /************************************************************************ |
| 21 | * * |
| 22 | * Helpers * |
| 23 | * * |
| 24 | ************************************************************************/ |
| 25 | |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 26 | /** |
| 27 | * Many of these macros may later turn into functions. They |
| 28 | * shouldn't be used in #ifdef's preprocessor instructions. |
| 29 | */ |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 30 | /** |
| 31 | * xmlXPathSetError: |
| 32 | * @ctxt: an XPath parser context |
| 33 | * @err: an xmlXPathError code |
| 34 | * |
| 35 | * Raises an error. |
| 36 | */ |
| 37 | #define xmlXPathSetError(ctxt, err) \ |
| 38 | { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ |
| 39 | (ctxt)->error = (err); } |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 40 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 41 | /** |
| 42 | * xmlXPathSetArityError: |
| 43 | * @ctxt: an XPath parser context |
| 44 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 45 | * Raises an XPATH_INVALID_ARITY error. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 46 | */ |
| 47 | #define xmlXPathSetArityError(ctxt) \ |
| 48 | xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 49 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 50 | /** |
| 51 | * xmlXPathSetTypeError: |
| 52 | * @ctxt: an XPath parser context |
| 53 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 54 | * Raises an XPATH_INVALID_TYPE error. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 55 | */ |
| 56 | #define xmlXPathSetTypeError(ctxt) \ |
| 57 | xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 58 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 59 | /** |
| 60 | * xmlXPathGetError: |
| 61 | * @ctxt: an XPath parser context |
| 62 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 63 | * Get the error code of an XPath context. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 64 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 65 | * Returns the context error. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 66 | */ |
| 67 | #define xmlXPathGetError(ctxt) ((ctxt)->error) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 68 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 69 | /** |
| 70 | * xmlXPathCheckError: |
| 71 | * @ctxt: an XPath parser context |
| 72 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 73 | * Check if an XPath error was raised. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 74 | * |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 75 | * Returns true if an error has been raised, false otherwise. |
| 76 | */ |
| 77 | #define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) |
| 78 | |
| 79 | /** |
| 80 | * xmlXPathGetDocument: |
| 81 | * @ctxt: an XPath parser context |
| 82 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 83 | * Get the document of an XPath context. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 84 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 85 | * Returns the context document. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 86 | */ |
| 87 | #define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 88 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 89 | /** |
| 90 | * xmlXPathGetContextNode: |
| 91 | * @ctxt: an XPath parser context |
| 92 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 93 | * Get the context node of an XPath context. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 94 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 95 | * Returns the context node. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 96 | */ |
| 97 | #define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) |
| 98 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 99 | XMLPUBFUN int XMLCALL |
| 100 | xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); |
| 101 | XMLPUBFUN double XMLCALL |
| 102 | xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); |
| 103 | XMLPUBFUN xmlChar * XMLCALL |
| 104 | xmlXPathPopString (xmlXPathParserContextPtr ctxt); |
| 105 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 106 | xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); |
| 107 | XMLPUBFUN void * XMLCALL |
| 108 | xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 109 | |
| 110 | /** |
| 111 | * xmlXPathReturnBoolean: |
| 112 | * @ctxt: an XPath parser context |
| 113 | * @val: a boolean |
| 114 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 115 | * Pushes the boolean @val on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 116 | */ |
| 117 | #define xmlXPathReturnBoolean(ctxt, val) \ |
| 118 | valuePush((ctxt), xmlXPathNewBoolean(val)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 119 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 120 | /** |
| 121 | * xmlXPathReturnTrue: |
| 122 | * @ctxt: an XPath parser context |
| 123 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 124 | * Pushes true on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 125 | */ |
| 126 | #define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 127 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 128 | /** |
| 129 | * xmlXPathReturnFalse: |
| 130 | * @ctxt: an XPath parser context |
| 131 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 132 | * Pushes false on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 133 | */ |
| 134 | #define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 135 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 136 | /** |
| 137 | * xmlXPathReturnNumber: |
| 138 | * @ctxt: an XPath parser context |
| 139 | * @val: a double |
| 140 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 141 | * Pushes the double @val on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 142 | */ |
| 143 | #define xmlXPathReturnNumber(ctxt, val) \ |
| 144 | valuePush((ctxt), xmlXPathNewFloat(val)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 145 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 146 | /** |
| 147 | * xmlXPathReturnString: |
| 148 | * @ctxt: an XPath parser context |
| 149 | * @str: a string |
| 150 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 151 | * Pushes the string @str on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 152 | */ |
| 153 | #define xmlXPathReturnString(ctxt, str) \ |
| 154 | valuePush((ctxt), xmlXPathWrapString(str)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 155 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 156 | /** |
| 157 | * xmlXPathReturnEmptyString: |
| 158 | * @ctxt: an XPath parser context |
| 159 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 160 | * Pushes an empty string on the stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 161 | */ |
| 162 | #define xmlXPathReturnEmptyString(ctxt) \ |
| 163 | valuePush((ctxt), xmlXPathNewCString("")) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 164 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 165 | /** |
| 166 | * xmlXPathReturnNodeSet: |
| 167 | * @ctxt: an XPath parser context |
| 168 | * @ns: a node-set |
| 169 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 170 | * Pushes the node-set @ns on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 171 | */ |
| 172 | #define xmlXPathReturnNodeSet(ctxt, ns) \ |
| 173 | valuePush((ctxt), xmlXPathWrapNodeSet(ns)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 174 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 175 | /** |
| 176 | * xmlXPathReturnEmptyNodeSet: |
| 177 | * @ctxt: an XPath parser context |
| 178 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 179 | * Pushes an empty node-set on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 180 | */ |
Daniel Veillard | 5344c60 | 2001-12-31 16:37:34 +0000 | [diff] [blame] | 181 | #define xmlXPathReturnEmptyNodeSet(ctxt) \ |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 182 | valuePush((ctxt), xmlXPathNewNodeSet(NULL)) |
Daniel Veillard | 8fcc494 | 2001-07-17 20:07:33 +0000 | [diff] [blame] | 183 | |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 184 | /** |
| 185 | * xmlXPathReturnExternal: |
| 186 | * @ctxt: an XPath parser context |
| 187 | * @val: user data |
| 188 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 189 | * Pushes user data on the context stack. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 190 | */ |
| 191 | #define xmlXPathReturnExternal(ctxt, val) \ |
| 192 | valuePush((ctxt), xmlXPathWrapExternal(val)) |
| 193 | |
| 194 | /** |
| 195 | * xmlXPathStackIsNodeSet: |
| 196 | * @ctxt: an XPath parser context |
| 197 | * |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 198 | * 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] | 199 | * an XSLT value tree. |
Daniel Veillard | 5e2dace | 2001-07-18 19:30:27 +0000 | [diff] [blame] | 200 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 201 | * 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] | 202 | */ |
| 203 | #define xmlXPathStackIsNodeSet(ctxt) \ |
| 204 | (((ctxt)->value != NULL) \ |
| 205 | && (((ctxt)->value->type == XPATH_NODESET) \ |
| 206 | || ((ctxt)->value->type == XPATH_XSLT_TREE))) |
| 207 | |
| 208 | /** |
Thomas Broyer | 47334c0 | 2001-10-07 16:41:52 +0000 | [diff] [blame] | 209 | * xmlXPathStackIsExternal: |
| 210 | * @ctxt: an XPath parser context |
| 211 | * |
| 212 | * Checks if the current value on the XPath stack is an external |
| 213 | * object. |
| 214 | * |
| 215 | * Returns true if the current object on the stack is an external |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 216 | * object. |
Thomas Broyer | 47334c0 | 2001-10-07 16:41:52 +0000 | [diff] [blame] | 217 | */ |
| 218 | #define xmlXPathStackIsExternal(ctxt) \ |
| 219 | ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) |
| 220 | |
| 221 | /** |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 222 | * xmlXPathEmptyNodeSet: |
| 223 | * @ns: a node-set |
| 224 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 225 | * Empties a node-set. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 226 | */ |
| 227 | #define xmlXPathEmptyNodeSet(ns) \ |
| 228 | { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } |
| 229 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 230 | /** |
| 231 | * CHECK_ERROR: |
| 232 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 233 | * Macro to return from the function if an XPath error was detected. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 234 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 235 | #define CHECK_ERROR \ |
| 236 | if (ctxt->error != XPATH_EXPRESSION_OK) return |
| 237 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 238 | /** |
| 239 | * CHECK_ERROR0: |
| 240 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 241 | * 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] | 242 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 243 | #define CHECK_ERROR0 \ |
| 244 | if (ctxt->error != XPATH_EXPRESSION_OK) return(0) |
| 245 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 246 | /** |
| 247 | * XP_ERROR: |
| 248 | * @X: the error code |
| 249 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 250 | * Macro to raise an XPath error and return. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 251 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 252 | #define XP_ERROR(X) \ |
| 253 | { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \ |
| 254 | ctxt->error = (X); return; } |
| 255 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 256 | /** |
| 257 | * XP_ERROR0: |
| 258 | * @X: the error code |
| 259 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 260 | * Macro to raise an XPath error and return 0. |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 261 | */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 262 | #define XP_ERROR0(X) \ |
| 263 | { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \ |
| 264 | ctxt->error = (X); return(0); } |
| 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 | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame^] | 380 | #ifdef LIBXML_DEBUG_ENABLED |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 381 | XMLPUBFUN void XMLCALL |
| 382 | xmlXPathDebugDumpObject (FILE *output, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 383 | xmlXPathObjectPtr cur, |
| 384 | int depth); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 385 | XMLPUBFUN void XMLCALL |
| 386 | xmlXPathDebugDumpCompExpr(FILE *output, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 387 | xmlXPathCompExprPtr comp, |
| 388 | int depth); |
Daniel Veillard | a9cce9c | 2003-09-29 13:20:24 +0000 | [diff] [blame^] | 389 | #endif |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 390 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 391 | * NodeSet handling. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 392 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 393 | XMLPUBFUN int XMLCALL |
| 394 | xmlXPathNodeSetContains (xmlNodeSetPtr cur, |
Thomas Broyer | f186c82 | 2001-07-31 23:30:37 +0000 | [diff] [blame] | 395 | xmlNodePtr val); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 396 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 397 | xmlXPathDifference (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 398 | xmlNodeSetPtr nodes2); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 399 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 400 | xmlXPathIntersection (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 401 | xmlNodeSetPtr nodes2); |
| 402 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 403 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 404 | xmlXPathDistinctSorted (xmlNodeSetPtr nodes); |
| 405 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 406 | xmlXPathDistinct (xmlNodeSetPtr nodes); |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 407 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 408 | XMLPUBFUN int XMLCALL |
| 409 | xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 410 | xmlNodeSetPtr nodes2); |
| 411 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 412 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 413 | xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 414 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 415 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 416 | xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 417 | xmlNodeSetPtr nodes2); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 418 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 419 | xmlXPathNodeLeading (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 420 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 421 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 422 | xmlXPathLeading (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 423 | xmlNodeSetPtr nodes2); |
| 424 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 425 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 426 | xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 427 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 428 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 429 | xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 430 | xmlNodeSetPtr nodes2); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 431 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 432 | xmlXPathNodeTrailing (xmlNodeSetPtr nodes, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 433 | xmlNodePtr node); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 434 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 435 | xmlXPathTrailing (xmlNodeSetPtr nodes1, |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 436 | xmlNodeSetPtr nodes2); |
| 437 | |
| 438 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 439 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 440 | * Extending a context. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 441 | */ |
| 442 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 443 | XMLPUBFUN int XMLCALL |
| 444 | xmlXPathRegisterNs (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 445 | const xmlChar *prefix, |
| 446 | const xmlChar *ns_uri); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 447 | XMLPUBFUN const xmlChar * XMLCALL |
| 448 | xmlXPathNsLookup (xmlXPathContextPtr ctxt, |
Daniel Veillard | cbaf399 | 2001-12-31 16:16:02 +0000 | [diff] [blame] | 449 | const xmlChar *prefix); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 450 | XMLPUBFUN void XMLCALL |
| 451 | xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 452 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 453 | XMLPUBFUN int XMLCALL |
| 454 | xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 455 | const xmlChar *name, |
| 456 | xmlXPathFunction f); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 457 | XMLPUBFUN int XMLCALL |
| 458 | xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 459 | const xmlChar *name, |
| 460 | const xmlChar *ns_uri, |
| 461 | xmlXPathFunction f); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 462 | XMLPUBFUN int XMLCALL |
| 463 | xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 464 | const xmlChar *name, |
| 465 | xmlXPathObjectPtr value); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 466 | XMLPUBFUN int XMLCALL |
| 467 | xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 468 | const xmlChar *name, |
| 469 | const xmlChar *ns_uri, |
| 470 | xmlXPathObjectPtr value); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 471 | XMLPUBFUN xmlXPathFunction XMLCALL |
| 472 | xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 473 | const xmlChar *name); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 474 | XMLPUBFUN xmlXPathFunction XMLCALL |
| 475 | xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 476 | const xmlChar *name, |
| 477 | const xmlChar *ns_uri); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 478 | XMLPUBFUN void XMLCALL |
| 479 | xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); |
| 480 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 481 | xmlXPathVariableLookup (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 482 | const xmlChar *name); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 483 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 484 | xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 485 | const xmlChar *name, |
| 486 | const xmlChar *ns_uri); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 487 | XMLPUBFUN void XMLCALL |
| 488 | xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 489 | |
| 490 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 491 | * Utilities to extend XPath. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 492 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 493 | XMLPUBFUN xmlXPathParserContextPtr XMLCALL |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 494 | xmlXPathNewParserContext (const xmlChar *str, |
| 495 | xmlXPathContextPtr ctxt); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 496 | XMLPUBFUN void XMLCALL |
| 497 | xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 498 | |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 499 | /* TODO: remap to xmlXPathValuePop and Push. */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 500 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 501 | valuePop (xmlXPathParserContextPtr ctxt); |
| 502 | XMLPUBFUN int XMLCALL |
| 503 | valuePush (xmlXPathParserContextPtr ctxt, |
| 504 | xmlXPathObjectPtr value); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 505 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 506 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 507 | xmlXPathNewString (const xmlChar *val); |
| 508 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 509 | xmlXPathNewCString (const char *val); |
| 510 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 511 | xmlXPathWrapString (xmlChar *val); |
| 512 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 513 | xmlXPathWrapCString (char * val); |
| 514 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 515 | xmlXPathNewFloat (double val); |
| 516 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 517 | xmlXPathNewBoolean (int val); |
| 518 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 519 | xmlXPathNewNodeSet (xmlNodePtr val); |
| 520 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 521 | xmlXPathNewValueTree (xmlNodePtr val); |
| 522 | XMLPUBFUN void XMLCALL |
| 523 | xmlXPathNodeSetAdd (xmlNodeSetPtr cur, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 524 | xmlNodePtr val); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 525 | XMLPUBFUN void XMLCALL |
| 526 | xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 527 | xmlNodePtr val); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 528 | XMLPUBFUN void XMLCALL |
| 529 | xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, |
Aleksey Sanin | 79376ba | 2002-05-14 06:41:32 +0000 | [diff] [blame] | 530 | xmlNodePtr node, |
| 531 | xmlNsPtr ns); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 532 | XMLPUBFUN void XMLCALL |
| 533 | xmlXPathNodeSetSort (xmlNodeSetPtr set); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 534 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 535 | XMLPUBFUN void XMLCALL |
| 536 | xmlXPathRoot (xmlXPathParserContextPtr ctxt); |
| 537 | XMLPUBFUN void XMLCALL |
| 538 | xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); |
| 539 | XMLPUBFUN xmlChar * XMLCALL |
| 540 | xmlXPathParseName (xmlXPathParserContextPtr ctxt); |
| 541 | XMLPUBFUN xmlChar * XMLCALL |
| 542 | xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 543 | |
| 544 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 545 | * Existing functions. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 546 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 547 | XMLPUBFUN double XMLCALL |
| 548 | xmlXPathStringEvalNumber (const xmlChar *str); |
| 549 | XMLPUBFUN int XMLCALL |
| 550 | xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, |
| 551 | xmlXPathObjectPtr res); |
| 552 | XMLPUBFUN void XMLCALL |
| 553 | xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); |
| 554 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 555 | xmlXPathNodeSetMerge (xmlNodeSetPtr val1, |
| 556 | xmlNodeSetPtr val2); |
| 557 | XMLPUBFUN void XMLCALL |
| 558 | xmlXPathNodeSetDel (xmlNodeSetPtr cur, |
| 559 | xmlNodePtr val); |
| 560 | XMLPUBFUN void XMLCALL |
| 561 | xmlXPathNodeSetRemove (xmlNodeSetPtr cur, |
| 562 | int val); |
| 563 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 564 | xmlXPathNewNodeSetList (xmlNodeSetPtr val); |
| 565 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 566 | xmlXPathWrapNodeSet (xmlNodeSetPtr val); |
| 567 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 568 | xmlXPathWrapExternal (void *val); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 569 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 570 | XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); |
| 571 | XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); |
| 572 | XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); |
| 573 | XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); |
| 574 | XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); |
| 575 | XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); |
| 576 | XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); |
| 577 | XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); |
| 578 | XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 579 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 580 | XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 581 | |
| 582 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 583 | * Some of the axis navigation routines. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 584 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 585 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 586 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 587 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 588 | xmlNodePtr cur); |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 589 | XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(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 xmlXPathNextDescendantOrSelf(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 xmlXPathNextParent(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 xmlXPathNextAncestorOrSelf(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 xmlXPathNextFollowingSibling(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 xmlXPathNextFollowing(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 xmlXPathNextNamespace(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 xmlXPathNextAttribute(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 xmlXPathNextPreceding(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 xmlXPathNextAncestor(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 xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, |
Daniel Veillard | 56a4cb8 | 2001-03-24 17:00:36 +0000 | [diff] [blame] | 610 | xmlNodePtr cur); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 611 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 612 | * The official core of XPath functions. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 613 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 614 | XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 615 | XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 616 | XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 617 | XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 618 | XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 619 | XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 620 | XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 621 | XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 622 | XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 623 | XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 624 | XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 625 | XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 626 | XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 627 | XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 628 | XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 629 | XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 630 | XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 631 | XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 632 | XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 633 | XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 634 | XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 635 | XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 636 | XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 637 | XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 638 | XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); |
| 639 | XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); |
Aleksey Sanin | f8cb6dd | 2002-06-04 04:27:06 +0000 | [diff] [blame] | 640 | |
| 641 | /** |
| 642 | * Really internal functions |
| 643 | */ |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 644 | XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); |
Aleksey Sanin | f8cb6dd | 2002-06-04 04:27:06 +0000 | [diff] [blame] | 645 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 646 | #ifdef __cplusplus |
| 647 | } |
| 648 | #endif |
| 649 | #endif /* ! __XML_XPATH_INTERNALS_H__ */ |