Lines Matching refs:ctxt
226 { xmlXPathErr(ctxt, X); return(NULL); }
268 xmlXPathErrMemory(xmlXPathContextPtr ctxt, const char *extra) in xmlXPathErrMemory() argument
270 if (ctxt != NULL) { in xmlXPathErrMemory()
277 ctxt->lastError.message = (char *) xmlStrdup(buf); in xmlXPathErrMemory()
279 ctxt->lastError.message = (char *) in xmlXPathErrMemory()
282 ctxt->lastError.domain = XML_FROM_XPATH; in xmlXPathErrMemory()
283 ctxt->lastError.code = XML_ERR_NO_MEMORY; in xmlXPathErrMemory()
284 if (ctxt->error != NULL) in xmlXPathErrMemory()
285 ctxt->error(ctxt->userData, &ctxt->lastError); in xmlXPathErrMemory()
310 xmlXPathPErrMemory(xmlXPathParserContextPtr ctxt, const char *extra) in xmlXPathPErrMemory() argument
312 if (ctxt == NULL) in xmlXPathPErrMemory()
315 ctxt->error = XPATH_MEMORY_ERROR; in xmlXPathPErrMemory()
316 xmlXPathErrMemory(ctxt->context, extra); in xmlXPathPErrMemory()
328 xmlXPathErr(xmlXPathParserContextPtr ctxt, int error) in xmlXPathErr() argument
332 if (ctxt == NULL) { in xmlXPathErr()
341 ctxt->error = error; in xmlXPathErr()
342 if (ctxt->context == NULL) { in xmlXPathErr()
347 (const char *) ctxt->base, NULL, NULL, in xmlXPathErr()
348 ctxt->cur - ctxt->base, 0, in xmlXPathErr()
354 xmlResetError(&ctxt->context->lastError); in xmlXPathErr()
356 ctxt->context->lastError.domain = XML_FROM_XPATH; in xmlXPathErr()
357 ctxt->context->lastError.code = error + XML_XPATH_EXPRESSION_OK - in xmlXPathErr()
359 ctxt->context->lastError.level = XML_ERR_ERROR; in xmlXPathErr()
360 ctxt->context->lastError.str1 = (char *) xmlStrdup(ctxt->base); in xmlXPathErr()
361 ctxt->context->lastError.int1 = ctxt->cur - ctxt->base; in xmlXPathErr()
362 ctxt->context->lastError.node = ctxt->context->debugNode; in xmlXPathErr()
363 if (ctxt->context->error != NULL) { in xmlXPathErr()
364 ctxt->context->error(ctxt->context->userData, in xmlXPathErr()
365 &ctxt->context->lastError); in xmlXPathErr()
368 NULL, ctxt->context->debugNode, XML_FROM_XPATH, in xmlXPathErr()
371 (const char *) ctxt->base, NULL, NULL, in xmlXPathErr()
372 ctxt->cur - ctxt->base, 0, in xmlXPathErr()
388 xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file ATTRIBUTE_UNUSED, in xmlXPatherror() argument
390 xmlXPathErr(ctxt, no); in xmlXPatherror()
598 xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj);
600 xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt,
603 xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt,
794 xmlXPathCompExprAdd(ctxt->comp, (op1), (op2), \
797 xmlXPathCompExprAdd(ctxt->comp, ctxt->comp->last, -1, \
801 xmlXPathCompExprAdd(ctxt->comp, -1, -1, (op), (val), (val2), 0 ,NULL ,NULL)
804 xmlXPathCompExprAdd(ctxt->comp, (ch), -1, (op), (val), (val2), 0 ,NULL ,NULL)
807 xmlXPathCompExprAdd(ctxt->comp, (ch1), (ch2), (op), \
1353 xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) in xmlXPathDebugObjUsageReset() argument
1355 if (ctxt != NULL) { in xmlXPathDebugObjUsageReset()
1356 if (ctxt->cache != NULL) { in xmlXPathDebugObjUsageReset()
1358 (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathDebugObjUsageReset()
1425 xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, in xmlXPathDebugObjUsageRequested() argument
1430 if (ctxt != NULL) { in xmlXPathDebugObjUsageRequested()
1431 if (ctxt->cache != NULL) { in xmlXPathDebugObjUsageRequested()
1433 (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathDebugObjUsageRequested()
1579 xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, in xmlXPathDebugObjUsageReleased() argument
1584 if (ctxt != NULL) { in xmlXPathDebugObjUsageReleased()
1585 if (ctxt->cache != NULL) { in xmlXPathDebugObjUsageReleased()
1587 (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathDebugObjUsageReleased()
1668 xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) in xmlXPathDebugObjUsageDisplay() argument
1688 if (ctxt != NULL) { in xmlXPathDebugObjUsageDisplay()
1689 if (ctxt->cache != NULL) { in xmlXPathDebugObjUsageDisplay()
1691 (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathDebugObjUsageDisplay()
1879 xmlXPathContextSetCache(xmlXPathContextPtr ctxt, in xmlXPathContextSetCache() argument
1884 if (ctxt == NULL) in xmlXPathContextSetCache()
1889 if (ctxt->cache == NULL) { in xmlXPathContextSetCache()
1890 ctxt->cache = xmlXPathNewCache(); in xmlXPathContextSetCache()
1891 if (ctxt->cache == NULL) in xmlXPathContextSetCache()
1894 cache = (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathContextSetCache()
1904 } else if (ctxt->cache != NULL) { in xmlXPathContextSetCache()
1905 xmlXPathFreeCache((xmlXPathContextCachePtr) ctxt->cache); in xmlXPathContextSetCache()
1906 ctxt->cache = NULL; in xmlXPathContextSetCache()
1922 xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) in xmlXPathCacheWrapNodeSet() argument
1924 if ((ctxt != NULL) && (ctxt->cache != NULL)) { in xmlXPathCacheWrapNodeSet()
1926 (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathCacheWrapNodeSet()
1938 xmlXPathDebugObjUsageRequested(ctxt, XPATH_NODESET); in xmlXPathCacheWrapNodeSet()
1959 xmlXPathCacheWrapString(xmlXPathContextPtr ctxt, xmlChar *val) in xmlXPathCacheWrapString() argument
1961 if ((ctxt != NULL) && (ctxt->cache != NULL)) { in xmlXPathCacheWrapString()
1962 xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathCacheWrapString()
1975 xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); in xmlXPathCacheWrapString()
1991 xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); in xmlXPathCacheWrapString()
2011 xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val) in xmlXPathCacheNewNodeSet() argument
2013 if ((ctxt != NULL) && (ctxt->cache)) { in xmlXPathCacheNewNodeSet()
2014 xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathCacheNewNodeSet()
2038 xmlXPathDebugObjUsageRequested(ctxt, XPATH_NODESET); in xmlXPathCacheNewNodeSet()
2056 xmlXPathDebugObjUsageRequested(ctxt, XPATH_NODESET); in xmlXPathCacheNewNodeSet()
2075 xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val) in xmlXPathCacheNewCString() argument
2077 if ((ctxt != NULL) && (ctxt->cache)) { in xmlXPathCacheNewCString()
2078 xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathCacheNewCString()
2091 xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); in xmlXPathCacheNewCString()
2105 xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); in xmlXPathCacheNewCString()
2124 xmlXPathCacheNewString(xmlXPathContextPtr ctxt, const xmlChar *val) in xmlXPathCacheNewString() argument
2126 if ((ctxt != NULL) && (ctxt->cache)) { in xmlXPathCacheNewString()
2127 xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathCacheNewString()
2142 xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); in xmlXPathCacheNewString()
2159 xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); in xmlXPathCacheNewString()
2178 xmlXPathCacheNewBoolean(xmlXPathContextPtr ctxt, int val) in xmlXPathCacheNewBoolean() argument
2180 if ((ctxt != NULL) && (ctxt->cache)) { in xmlXPathCacheNewBoolean()
2181 xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathCacheNewBoolean()
2193 xmlXPathDebugObjUsageRequested(ctxt, XPATH_BOOLEAN); in xmlXPathCacheNewBoolean()
2207 xmlXPathDebugObjUsageRequested(ctxt, XPATH_BOOLEAN); in xmlXPathCacheNewBoolean()
2226 xmlXPathCacheNewFloat(xmlXPathContextPtr ctxt, double val) in xmlXPathCacheNewFloat() argument
2228 if ((ctxt != NULL) && (ctxt->cache)) { in xmlXPathCacheNewFloat()
2229 xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathCacheNewFloat()
2241 xmlXPathDebugObjUsageRequested(ctxt, XPATH_NUMBER); in xmlXPathCacheNewFloat()
2255 xmlXPathDebugObjUsageRequested(ctxt, XPATH_NUMBER); in xmlXPathCacheNewFloat()
2276 xmlXPathCacheConvertString(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { in xmlXPathCacheConvertString() argument
2280 return(xmlXPathCacheNewCString(ctxt, "")); in xmlXPathCacheConvertString()
2307 xmlXPathReleaseObject(ctxt, val); in xmlXPathCacheConvertString()
2309 return(xmlXPathCacheNewCString(ctxt, "")); in xmlXPathCacheConvertString()
2310 return(xmlXPathCacheWrapString(ctxt, res)); in xmlXPathCacheConvertString()
2324 xmlXPathCacheObjectCopy(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) in xmlXPathCacheObjectCopy() argument
2329 if (XP_HAS_CACHE(ctxt)) { in xmlXPathCacheObjectCopy()
2332 return(xmlXPathCacheWrapNodeSet(ctxt, in xmlXPathCacheObjectCopy()
2335 return(xmlXPathCacheNewString(ctxt, val->stringval)); in xmlXPathCacheObjectCopy()
2337 return(xmlXPathCacheNewBoolean(ctxt, val->boolval)); in xmlXPathCacheObjectCopy()
2339 return(xmlXPathCacheNewFloat(ctxt, val->floatval)); in xmlXPathCacheObjectCopy()
2359 xmlXPathCacheConvertBoolean(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { in xmlXPathCacheConvertBoolean() argument
2363 return(xmlXPathCacheNewBoolean(ctxt, 0)); in xmlXPathCacheConvertBoolean()
2366 ret = xmlXPathCacheNewBoolean(ctxt, xmlXPathCastToBoolean(val)); in xmlXPathCacheConvertBoolean()
2367 xmlXPathReleaseObject(ctxt, val); in xmlXPathCacheConvertBoolean()
2383 xmlXPathCacheConvertNumber(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { in xmlXPathCacheConvertNumber() argument
2387 return(xmlXPathCacheNewFloat(ctxt, 0.0)); in xmlXPathCacheConvertNumber()
2390 ret = xmlXPathCacheNewFloat(ctxt, xmlXPathCastToNumber(val)); in xmlXPathCacheConvertNumber()
2391 xmlXPathReleaseObject(ctxt, val); in xmlXPathCacheConvertNumber()
2410 xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) { in xmlXPathSetFrame() argument
2413 if (ctxt == NULL) in xmlXPathSetFrame()
2415 ret = ctxt->valueFrame; in xmlXPathSetFrame()
2416 ctxt->valueFrame = ctxt->valueNr; in xmlXPathSetFrame()
2428 xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) { in xmlXPathPopFrame() argument
2429 if (ctxt == NULL) in xmlXPathPopFrame()
2431 if (ctxt->valueNr < ctxt->valueFrame) { in xmlXPathPopFrame()
2432 xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR); in xmlXPathPopFrame()
2434 ctxt->valueFrame = frame; in xmlXPathPopFrame()
2446 valuePop(xmlXPathParserContextPtr ctxt) in valuePop() argument
2450 if ((ctxt == NULL) || (ctxt->valueNr <= 0)) in valuePop()
2453 if (ctxt->valueNr <= ctxt->valueFrame) { in valuePop()
2454 xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR); in valuePop()
2458 ctxt->valueNr--; in valuePop()
2459 if (ctxt->valueNr > 0) in valuePop()
2460 ctxt->value = ctxt->valueTab[ctxt->valueNr - 1]; in valuePop()
2462 ctxt->value = NULL; in valuePop()
2463 ret = ctxt->valueTab[ctxt->valueNr]; in valuePop()
2464 ctxt->valueTab[ctxt->valueNr] = NULL; in valuePop()
2477 valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value) in valuePush() argument
2479 if ((ctxt == NULL) || (value == NULL)) return(-1); in valuePush()
2480 if (ctxt->valueNr >= ctxt->valueMax) { in valuePush()
2483 tmp = (xmlXPathObjectPtr *) xmlRealloc(ctxt->valueTab, in valuePush()
2484 2 * ctxt->valueMax * in valuePush()
2485 sizeof(ctxt->valueTab[0])); in valuePush()
2488 ctxt->error = XPATH_MEMORY_ERROR; in valuePush()
2491 ctxt->valueMax *= 2; in valuePush()
2492 ctxt->valueTab = tmp; in valuePush()
2494 ctxt->valueTab[ctxt->valueNr] = value; in valuePush()
2495 ctxt->value = value; in valuePush()
2496 return (ctxt->valueNr++); in valuePush()
2509 xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt) { in xmlXPathPopBoolean() argument
2513 obj = valuePop(ctxt); in xmlXPathPopBoolean()
2515 xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); in xmlXPathPopBoolean()
2522 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathPopBoolean()
2536 xmlXPathPopNumber (xmlXPathParserContextPtr ctxt) { in xmlXPathPopNumber() argument
2540 obj = valuePop(ctxt); in xmlXPathPopNumber()
2542 xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); in xmlXPathPopNumber()
2549 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathPopNumber()
2563 xmlXPathPopString (xmlXPathParserContextPtr ctxt) { in xmlXPathPopString() argument
2567 obj = valuePop(ctxt); in xmlXPathPopString()
2569 xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); in xmlXPathPopString()
2576 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathPopString()
2590 xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt) { in xmlXPathPopNodeSet() argument
2594 if (ctxt == NULL) return(NULL); in xmlXPathPopNodeSet()
2595 if (ctxt->value == NULL) { in xmlXPathPopNodeSet()
2596 xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); in xmlXPathPopNodeSet()
2599 if (!xmlXPathStackIsNodeSet(ctxt)) { in xmlXPathPopNodeSet()
2600 xmlXPathSetTypeError(ctxt); in xmlXPathPopNodeSet()
2603 obj = valuePop(ctxt); in xmlXPathPopNodeSet()
2611 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathPopNodeSet()
2625 xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { in xmlXPathPopExternal() argument
2629 if ((ctxt == NULL) || (ctxt->value == NULL)) { in xmlXPathPopExternal()
2630 xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); in xmlXPathPopExternal()
2633 if (ctxt->value->type != XPATH_USERS) { in xmlXPathPopExternal()
2634 xmlXPathSetTypeError(ctxt); in xmlXPathPopExternal()
2637 obj = valuePop(ctxt); in xmlXPathPopExternal()
2640 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathPopExternal()
2667 #define CUR (*ctxt->cur)
2668 #define SKIP(val) ctxt->cur += (val)
2669 #define NXT(val) ctxt->cur[(val)]
2670 #define CUR_PTR ctxt->cur
2671 #define CUR_CHAR(l) xmlXPathCurrentChar(ctxt, &l)
2677 #define NEXTL(l) ctxt->cur += l
2680 while (IS_BLANK_CH(*(ctxt->cur))) NEXT
2682 #define CURRENT (*ctxt->cur)
2683 #define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur)
4770 xmlXPathRegisterFunc(xmlXPathContextPtr ctxt, const xmlChar *name, in xmlXPathRegisterFunc() argument
4772 return(xmlXPathRegisterFuncNS(ctxt, name, NULL, f)); in xmlXPathRegisterFunc()
4787 xmlXPathRegisterFuncNS(xmlXPathContextPtr ctxt, const xmlChar *name, in xmlXPathRegisterFuncNS() argument
4789 if (ctxt == NULL) in xmlXPathRegisterFuncNS()
4794 if (ctxt->funcHash == NULL) in xmlXPathRegisterFuncNS()
4795 ctxt->funcHash = xmlHashCreate(0); in xmlXPathRegisterFuncNS()
4796 if (ctxt->funcHash == NULL) in xmlXPathRegisterFuncNS()
4799 return(xmlHashRemoveEntry2(ctxt->funcHash, name, ns_uri, NULL)); in xmlXPathRegisterFuncNS()
4800 return(xmlHashAddEntry2(ctxt->funcHash, name, ns_uri, XML_CAST_FPTR(f))); in xmlXPathRegisterFuncNS()
4812 xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, in xmlXPathRegisterFuncLookup() argument
4815 if (ctxt == NULL) in xmlXPathRegisterFuncLookup()
4817 ctxt->funcLookupFunc = f; in xmlXPathRegisterFuncLookup()
4818 ctxt->funcLookupData = funcCtxt; in xmlXPathRegisterFuncLookup()
4832 xmlXPathFunctionLookup(xmlXPathContextPtr ctxt, const xmlChar *name) { in xmlXPathFunctionLookup() argument
4833 if (ctxt == NULL) in xmlXPathFunctionLookup()
4836 if (ctxt->funcLookupFunc != NULL) { in xmlXPathFunctionLookup()
4840 f = ctxt->funcLookupFunc; in xmlXPathFunctionLookup()
4841 ret = f(ctxt->funcLookupData, name, NULL); in xmlXPathFunctionLookup()
4845 return(xmlXPathFunctionLookupNS(ctxt, name, NULL)); in xmlXPathFunctionLookup()
4860 xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name, in xmlXPathFunctionLookupNS() argument
4864 if (ctxt == NULL) in xmlXPathFunctionLookupNS()
4869 if (ctxt->funcLookupFunc != NULL) { in xmlXPathFunctionLookupNS()
4872 f = ctxt->funcLookupFunc; in xmlXPathFunctionLookupNS()
4873 ret = f(ctxt->funcLookupData, name, ns_uri); in xmlXPathFunctionLookupNS()
4878 if (ctxt->funcHash == NULL) in xmlXPathFunctionLookupNS()
4881 XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->funcHash, name, ns_uri); in xmlXPathFunctionLookupNS()
4892 xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt) { in xmlXPathRegisteredFuncsCleanup() argument
4893 if (ctxt == NULL) in xmlXPathRegisteredFuncsCleanup()
4896 xmlHashFree(ctxt->funcHash, NULL); in xmlXPathRegisteredFuncsCleanup()
4897 ctxt->funcHash = NULL; in xmlXPathRegisteredFuncsCleanup()
4918 xmlXPathRegisterVariable(xmlXPathContextPtr ctxt, const xmlChar *name, in xmlXPathRegisterVariable() argument
4920 return(xmlXPathRegisterVariableNS(ctxt, name, NULL, value)); in xmlXPathRegisterVariable()
4936 xmlXPathRegisterVariableNS(xmlXPathContextPtr ctxt, const xmlChar *name, in xmlXPathRegisterVariableNS() argument
4939 if (ctxt == NULL) in xmlXPathRegisterVariableNS()
4944 if (ctxt->varHash == NULL) in xmlXPathRegisterVariableNS()
4945 ctxt->varHash = xmlHashCreate(0); in xmlXPathRegisterVariableNS()
4946 if (ctxt->varHash == NULL) in xmlXPathRegisterVariableNS()
4949 return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri, in xmlXPathRegisterVariableNS()
4951 return(xmlHashUpdateEntry2(ctxt->varHash, name, ns_uri, in xmlXPathRegisterVariableNS()
4965 xmlXPathRegisterVariableLookup(xmlXPathContextPtr ctxt, in xmlXPathRegisterVariableLookup() argument
4967 if (ctxt == NULL) in xmlXPathRegisterVariableLookup()
4969 ctxt->varLookupFunc = f; in xmlXPathRegisterVariableLookup()
4970 ctxt->varLookupData = data; in xmlXPathRegisterVariableLookup()
4984 xmlXPathVariableLookup(xmlXPathContextPtr ctxt, const xmlChar *name) { in xmlXPathVariableLookup() argument
4985 if (ctxt == NULL) in xmlXPathVariableLookup()
4988 if (ctxt->varLookupFunc != NULL) { in xmlXPathVariableLookup()
4991 ret = ((xmlXPathVariableLookupFunc)ctxt->varLookupFunc) in xmlXPathVariableLookup()
4992 (ctxt->varLookupData, name, NULL); in xmlXPathVariableLookup()
4995 return(xmlXPathVariableLookupNS(ctxt, name, NULL)); in xmlXPathVariableLookup()
5010 xmlXPathVariableLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name, in xmlXPathVariableLookupNS() argument
5012 if (ctxt == NULL) in xmlXPathVariableLookupNS()
5015 if (ctxt->varLookupFunc != NULL) { in xmlXPathVariableLookupNS()
5018 ret = ((xmlXPathVariableLookupFunc)ctxt->varLookupFunc) in xmlXPathVariableLookupNS()
5019 (ctxt->varLookupData, name, ns_uri); in xmlXPathVariableLookupNS()
5023 if (ctxt->varHash == NULL) in xmlXPathVariableLookupNS()
5028 return(xmlXPathCacheObjectCopy(ctxt, (xmlXPathObjectPtr) in xmlXPathVariableLookupNS()
5029 xmlHashLookup2(ctxt->varHash, name, ns_uri))); in xmlXPathVariableLookupNS()
5039 xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) { in xmlXPathRegisteredVariablesCleanup() argument
5040 if (ctxt == NULL) in xmlXPathRegisteredVariablesCleanup()
5043 xmlHashFree(ctxt->varHash, (xmlHashDeallocator)xmlXPathFreeObject); in xmlXPathRegisteredVariablesCleanup()
5044 ctxt->varHash = NULL; in xmlXPathRegisteredVariablesCleanup()
5059 xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix, in xmlXPathRegisterNs() argument
5061 if (ctxt == NULL) in xmlXPathRegisterNs()
5068 if (ctxt->nsHash == NULL) in xmlXPathRegisterNs()
5069 ctxt->nsHash = xmlHashCreate(10); in xmlXPathRegisterNs()
5070 if (ctxt->nsHash == NULL) in xmlXPathRegisterNs()
5073 return(xmlHashRemoveEntry(ctxt->nsHash, prefix, in xmlXPathRegisterNs()
5075 return(xmlHashUpdateEntry(ctxt->nsHash, prefix, (void *) xmlStrdup(ns_uri), in xmlXPathRegisterNs()
5090 xmlXPathNsLookup(xmlXPathContextPtr ctxt, const xmlChar *prefix) { in xmlXPathNsLookup() argument
5091 if (ctxt == NULL) in xmlXPathNsLookup()
5101 if (ctxt->namespaces != NULL) { in xmlXPathNsLookup()
5104 for (i = 0;i < ctxt->nsNr;i++) { in xmlXPathNsLookup()
5105 if ((ctxt->namespaces[i] != NULL) && in xmlXPathNsLookup()
5106 (xmlStrEqual(ctxt->namespaces[i]->prefix, prefix))) in xmlXPathNsLookup()
5107 return(ctxt->namespaces[i]->href); in xmlXPathNsLookup()
5111 return((const xmlChar *) xmlHashLookup(ctxt->nsHash, prefix)); in xmlXPathNsLookup()
5121 xmlXPathRegisteredNsCleanup(xmlXPathContextPtr ctxt) { in xmlXPathRegisteredNsCleanup() argument
5122 if (ctxt == NULL) in xmlXPathRegisteredNsCleanup()
5125 xmlHashFree(ctxt->nsHash, (xmlHashDeallocator)xmlFree); in xmlXPathRegisteredNsCleanup()
5126 ctxt->nsHash = NULL; in xmlXPathRegisteredNsCleanup()
5447 xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) in xmlXPathReleaseObject() argument
5457 if ((ctxt == NULL) || (ctxt->cache == NULL)) { in xmlXPathReleaseObject()
5461 (xmlXPathContextCachePtr) ctxt->cache; in xmlXPathReleaseObject()
5531 xmlXPathDebugObjUsageReleased(ctxt, obj->type); in xmlXPathReleaseObject()
6085 xmlXPathFreeContext(xmlXPathContextPtr ctxt) { in xmlXPathFreeContext() argument
6086 if (ctxt == NULL) return; in xmlXPathFreeContext()
6088 if (ctxt->cache != NULL) in xmlXPathFreeContext()
6089 xmlXPathFreeCache((xmlXPathContextCachePtr) ctxt->cache); in xmlXPathFreeContext()
6090 xmlXPathRegisteredNsCleanup(ctxt); in xmlXPathFreeContext()
6091 xmlXPathRegisteredFuncsCleanup(ctxt); in xmlXPathFreeContext()
6092 xmlXPathRegisteredVariablesCleanup(ctxt); in xmlXPathFreeContext()
6093 xmlResetError(&ctxt->lastError); in xmlXPathFreeContext()
6094 xmlFree(ctxt); in xmlXPathFreeContext()
6103 #define CHECK_CTXT(ctxt) \ argument
6104 if (ctxt == NULL) { \
6114 #define CHECK_CTXT_NEG(ctxt) \ argument
6115 if (ctxt == NULL) { \
6126 #define CHECK_CONTEXT(ctxt) \ argument
6127 if ((ctxt == NULL) || (ctxt->doc == NULL) || \
6128 (ctxt->doc->children == NULL)) { \
6129 xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_INVALID_CTXT); \
6144 xmlXPathNewParserContext(const xmlChar *str, xmlXPathContextPtr ctxt) { in xmlXPathNewParserContext() argument
6149 xmlXPathErrMemory(ctxt, "creating parser context\n"); in xmlXPathNewParserContext()
6154 ret->context = ctxt; in xmlXPathNewParserContext()
6162 if ((ctxt != NULL) && (ctxt->dict != NULL)) { in xmlXPathNewParserContext()
6163 ret->comp->dict = ctxt->dict; in xmlXPathNewParserContext()
6180 xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) { in xmlXPathCompParserContext() argument
6185 xmlXPathErrMemory(ctxt, "creating evaluation context\n"); in xmlXPathCompParserContext()
6195 xmlXPathErrMemory(ctxt, "creating evaluation context\n"); in xmlXPathCompParserContext()
6203 ret->context = ctxt; in xmlXPathCompParserContext()
6216 xmlXPathFreeParserContext(xmlXPathParserContextPtr ctxt) { in xmlXPathFreeParserContext() argument
6217 if (ctxt->valueTab != NULL) { in xmlXPathFreeParserContext()
6218 xmlFree(ctxt->valueTab); in xmlXPathFreeParserContext()
6220 if (ctxt->comp != NULL) { in xmlXPathFreeParserContext()
6222 if (ctxt->comp->stream != NULL) { in xmlXPathFreeParserContext()
6223 xmlFreePatternList(ctxt->comp->stream); in xmlXPathFreeParserContext()
6224 ctxt->comp->stream = NULL; in xmlXPathFreeParserContext()
6227 xmlXPathFreeCompExpr(ctxt->comp); in xmlXPathFreeParserContext()
6229 xmlFree(ctxt); in xmlXPathFreeParserContext()
6399 xmlXPathCompareNodeSetFloat(xmlXPathParserContextPtr ctxt, int inf, int strict, in xmlXPathCompareNodeSetFloat() argument
6407 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathCompareNodeSetFloat()
6408 xmlXPathReleaseObject(ctxt->context, f); in xmlXPathCompareNodeSetFloat()
6416 valuePush(ctxt, in xmlXPathCompareNodeSetFloat()
6417 xmlXPathCacheNewString(ctxt->context, str2)); in xmlXPathCompareNodeSetFloat()
6419 xmlXPathNumberFunction(ctxt, 1); in xmlXPathCompareNodeSetFloat()
6420 valuePush(ctxt, xmlXPathCacheObjectCopy(ctxt->context, f)); in xmlXPathCompareNodeSetFloat()
6421 ret = xmlXPathCompareValues(ctxt, inf, strict); in xmlXPathCompareNodeSetFloat()
6427 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathCompareNodeSetFloat()
6428 xmlXPathReleaseObject(ctxt->context, f); in xmlXPathCompareNodeSetFloat()
6454 xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict, in xmlXPathCompareNodeSetString() argument
6462 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathCompareNodeSetString()
6463 xmlXPathReleaseObject(ctxt->context, s); in xmlXPathCompareNodeSetString()
6471 valuePush(ctxt, in xmlXPathCompareNodeSetString()
6472 xmlXPathCacheNewString(ctxt->context, str2)); in xmlXPathCompareNodeSetString()
6474 valuePush(ctxt, xmlXPathCacheObjectCopy(ctxt->context, s)); in xmlXPathCompareNodeSetString()
6475 ret = xmlXPathCompareValues(ctxt, inf, strict); in xmlXPathCompareNodeSetString()
6481 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathCompareNodeSetString()
6482 xmlXPathReleaseObject(ctxt->context, s); in xmlXPathCompareNodeSetString()
6610 xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict, in xmlXPathCompareNodeSetValue() argument
6618 return(xmlXPathCompareNodeSetFloat(ctxt, inf, strict, arg, val)); in xmlXPathCompareNodeSetValue()
6623 return(xmlXPathCompareNodeSetString(ctxt, inf, strict, arg, val)); in xmlXPathCompareNodeSetValue()
6625 valuePush(ctxt, arg); in xmlXPathCompareNodeSetValue()
6626 xmlXPathBooleanFunction(ctxt, 1); in xmlXPathCompareNodeSetValue()
6627 valuePush(ctxt, val); in xmlXPathCompareNodeSetValue()
6628 return(xmlXPathCompareValues(ctxt, inf, strict)); in xmlXPathCompareNodeSetValue()
6709 xmlXPathEqualNodeSetFloat(xmlXPathParserContextPtr ctxt, in xmlXPathEqualNodeSetFloat() argument
6726 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, str2)); in xmlXPathEqualNodeSetFloat()
6728 xmlXPathNumberFunction(ctxt, 1); in xmlXPathEqualNodeSetFloat()
6729 val = valuePop(ctxt); in xmlXPathEqualNodeSetFloat()
6731 xmlXPathReleaseObject(ctxt->context, val); in xmlXPathEqualNodeSetFloat()
6870 xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, in xmlXPathEqualValuesCommon() argument
6935 valuePush(ctxt, arg2); in xmlXPathEqualValuesCommon()
6936 xmlXPathNumberFunction(ctxt, 1); in xmlXPathEqualValuesCommon()
6937 arg2 = valuePop(ctxt); in xmlXPathEqualValuesCommon()
6998 valuePush(ctxt, arg1); in xmlXPathEqualValuesCommon()
6999 xmlXPathNumberFunction(ctxt, 1); in xmlXPathEqualValuesCommon()
7000 arg1 = valuePop(ctxt); in xmlXPathEqualValuesCommon()
7050 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathEqualValuesCommon()
7051 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathEqualValuesCommon()
7064 xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) { in xmlXPathEqualValues() argument
7068 if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); in xmlXPathEqualValues()
7069 arg2 = valuePop(ctxt); in xmlXPathEqualValues()
7070 arg1 = valuePop(ctxt); in xmlXPathEqualValues()
7073 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathEqualValues()
7075 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathEqualValues()
7120 ret = xmlXPathEqualNodeSetFloat(ctxt, arg1, arg2->floatval, 0); in xmlXPathEqualValues()
7132 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathEqualValues()
7133 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathEqualValues()
7137 return (xmlXPathEqualValuesCommon(ctxt, arg1, arg2)); in xmlXPathEqualValues()
7149 xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { in xmlXPathNotEqualValues() argument
7153 if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); in xmlXPathNotEqualValues()
7154 arg2 = valuePop(ctxt); in xmlXPathNotEqualValues()
7155 arg1 = valuePop(ctxt); in xmlXPathNotEqualValues()
7158 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathNotEqualValues()
7160 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathNotEqualValues()
7169 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathNotEqualValues()
7205 ret = xmlXPathEqualNodeSetFloat(ctxt, arg1, arg2->floatval, 1); in xmlXPathNotEqualValues()
7217 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathNotEqualValues()
7218 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathNotEqualValues()
7222 return (!xmlXPathEqualValuesCommon(ctxt, arg1, arg2)); in xmlXPathNotEqualValues()
7250 xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) { in xmlXPathCompareValues() argument
7254 if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); in xmlXPathCompareValues()
7255 arg2 = valuePop(ctxt); in xmlXPathCompareValues()
7256 arg1 = valuePop(ctxt); in xmlXPathCompareValues()
7259 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathCompareValues()
7261 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompareValues()
7277 ret = xmlXPathCompareNodeSetValue(ctxt, inf, strict, in xmlXPathCompareValues()
7280 ret = xmlXPathCompareNodeSetValue(ctxt, !inf, strict, in xmlXPathCompareValues()
7288 valuePush(ctxt, arg1); in xmlXPathCompareValues()
7289 xmlXPathNumberFunction(ctxt, 1); in xmlXPathCompareValues()
7290 arg1 = valuePop(ctxt); in xmlXPathCompareValues()
7298 valuePush(ctxt, arg2); in xmlXPathCompareValues()
7299 xmlXPathNumberFunction(ctxt, 1); in xmlXPathCompareValues()
7300 arg2 = valuePop(ctxt); in xmlXPathCompareValues()
7303 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathCompareValues()
7304 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompareValues()
7356 xmlXPathReleaseObject(ctxt->context, arg1); in xmlXPathCompareValues()
7357 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompareValues()
7370 xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) { in xmlXPathValueFlipSign() argument
7371 if ((ctxt == NULL) || (ctxt->context == NULL)) return; in xmlXPathValueFlipSign()
7374 if (xmlXPathIsNaN(ctxt->value->floatval)) in xmlXPathValueFlipSign()
7375 ctxt->value->floatval=xmlXPathNAN; in xmlXPathValueFlipSign()
7376 else if (xmlXPathIsInf(ctxt->value->floatval) == 1) in xmlXPathValueFlipSign()
7377 ctxt->value->floatval=xmlXPathNINF; in xmlXPathValueFlipSign()
7378 else if (xmlXPathIsInf(ctxt->value->floatval) == -1) in xmlXPathValueFlipSign()
7379 ctxt->value->floatval=xmlXPathPINF; in xmlXPathValueFlipSign()
7380 else if (ctxt->value->floatval == 0) { in xmlXPathValueFlipSign()
7381 if (xmlXPathGetSign(ctxt->value->floatval) == 0) in xmlXPathValueFlipSign()
7382 ctxt->value->floatval = xmlXPathNZERO; in xmlXPathValueFlipSign()
7384 ctxt->value->floatval = 0; in xmlXPathValueFlipSign()
7387 ctxt->value->floatval = - ctxt->value->floatval; in xmlXPathValueFlipSign()
7399 xmlXPathAddValues(xmlXPathParserContextPtr ctxt) { in xmlXPathAddValues() argument
7403 arg = valuePop(ctxt); in xmlXPathAddValues()
7407 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathAddValues()
7410 ctxt->value->floatval += val; in xmlXPathAddValues()
7422 xmlXPathSubValues(xmlXPathParserContextPtr ctxt) { in xmlXPathSubValues() argument
7426 arg = valuePop(ctxt); in xmlXPathSubValues()
7430 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathSubValues()
7433 ctxt->value->floatval -= val; in xmlXPathSubValues()
7445 xmlXPathMultValues(xmlXPathParserContextPtr ctxt) { in xmlXPathMultValues() argument
7449 arg = valuePop(ctxt); in xmlXPathMultValues()
7453 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathMultValues()
7456 ctxt->value->floatval *= val; in xmlXPathMultValues()
7468 xmlXPathDivValues(xmlXPathParserContextPtr ctxt) { in xmlXPathDivValues() argument
7472 arg = valuePop(ctxt); in xmlXPathDivValues()
7476 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathDivValues()
7479 if (xmlXPathIsNaN(val) || xmlXPathIsNaN(ctxt->value->floatval)) in xmlXPathDivValues()
7480 ctxt->value->floatval = xmlXPathNAN; in xmlXPathDivValues()
7482 if (ctxt->value->floatval == 0) in xmlXPathDivValues()
7483 ctxt->value->floatval = xmlXPathNAN; in xmlXPathDivValues()
7484 else if (ctxt->value->floatval > 0) in xmlXPathDivValues()
7485 ctxt->value->floatval = xmlXPathNINF; in xmlXPathDivValues()
7486 else if (ctxt->value->floatval < 0) in xmlXPathDivValues()
7487 ctxt->value->floatval = xmlXPathPINF; in xmlXPathDivValues()
7490 if (ctxt->value->floatval == 0) in xmlXPathDivValues()
7491 ctxt->value->floatval = xmlXPathNAN; in xmlXPathDivValues()
7492 else if (ctxt->value->floatval > 0) in xmlXPathDivValues()
7493 ctxt->value->floatval = xmlXPathPINF; in xmlXPathDivValues()
7494 else if (ctxt->value->floatval < 0) in xmlXPathDivValues()
7495 ctxt->value->floatval = xmlXPathNINF; in xmlXPathDivValues()
7497 ctxt->value->floatval /= val; in xmlXPathDivValues()
7509 xmlXPathModValues(xmlXPathParserContextPtr ctxt) { in xmlXPathModValues() argument
7513 arg = valuePop(ctxt); in xmlXPathModValues()
7517 xmlXPathReleaseObject(ctxt->context, arg); in xmlXPathModValues()
7520 arg1 = ctxt->value->floatval; in xmlXPathModValues()
7522 ctxt->value->floatval = xmlXPathNAN; in xmlXPathModValues()
7524 ctxt->value->floatval = fmod(arg1, arg2); in xmlXPathModValues()
7540 (xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
7571 xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextSelf() argument
7572 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextSelf()
7574 return(ctxt->context->node); in xmlXPathNextSelf()
7589 xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextChild() argument
7590 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextChild()
7592 if (ctxt->context->node == NULL) return(NULL); in xmlXPathNextChild()
7593 switch (ctxt->context->node->type) { in xmlXPathNextChild()
7603 return(ctxt->context->node->children); in xmlXPathNextChild()
7611 return(((xmlDocPtr) ctxt->context->node)->children); in xmlXPathNextChild()
7640 xmlXPathNextChildElement(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextChildElement() argument
7641 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextChildElement()
7643 cur = ctxt->context->node; in xmlXPathNextChildElement()
7792 xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextDescendant() argument
7793 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextDescendant()
7795 if (ctxt->context->node == NULL) in xmlXPathNextDescendant()
7797 if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || in xmlXPathNextDescendant()
7798 (ctxt->context->node->type == XML_NAMESPACE_DECL)) in xmlXPathNextDescendant()
7801 if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc) in xmlXPathNextDescendant()
7802 return(ctxt->context->doc->children); in xmlXPathNextDescendant()
7803 return(ctxt->context->node->children); in xmlXPathNextDescendant()
7820 if (cur == ctxt->context->node) return(NULL); in xmlXPathNextDescendant()
7832 if (cur == ctxt->context->node) return(NULL); in xmlXPathNextDescendant()
7855 xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextDescendantOrSelf() argument
7856 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextDescendantOrSelf()
7858 if (ctxt->context->node == NULL) in xmlXPathNextDescendantOrSelf()
7860 if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || in xmlXPathNextDescendantOrSelf()
7861 (ctxt->context->node->type == XML_NAMESPACE_DECL)) in xmlXPathNextDescendantOrSelf()
7863 return(ctxt->context->node); in xmlXPathNextDescendantOrSelf()
7866 return(xmlXPathNextDescendant(ctxt, cur)); in xmlXPathNextDescendantOrSelf()
7880 xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextParent() argument
7881 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextParent()
7888 if (ctxt->context->node == NULL) return(NULL); in xmlXPathNextParent()
7889 switch (ctxt->context->node->type) { in xmlXPathNextParent()
7904 if (ctxt->context->node->parent == NULL) in xmlXPathNextParent()
7905 return((xmlNodePtr) ctxt->context->doc); in xmlXPathNextParent()
7906 if ((ctxt->context->node->parent->type == XML_ELEMENT_NODE) && in xmlXPathNextParent()
7907 ((ctxt->context->node->parent->name[0] == ' ') || in xmlXPathNextParent()
7908 (xmlStrEqual(ctxt->context->node->parent->name, in xmlXPathNextParent()
7911 return(ctxt->context->node->parent); in xmlXPathNextParent()
7913 xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node; in xmlXPathNextParent()
7926 xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; in xmlXPathNextParent()
7953 xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextAncestor() argument
7954 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextAncestor()
7961 if (ctxt->context->node == NULL) return(NULL); in xmlXPathNextAncestor()
7962 switch (ctxt->context->node->type) { in xmlXPathNextAncestor()
7977 if (ctxt->context->node->parent == NULL) in xmlXPathNextAncestor()
7978 return((xmlNodePtr) ctxt->context->doc); in xmlXPathNextAncestor()
7979 if ((ctxt->context->node->parent->type == XML_ELEMENT_NODE) && in xmlXPathNextAncestor()
7980 ((ctxt->context->node->parent->name[0] == ' ') || in xmlXPathNextAncestor()
7981 (xmlStrEqual(ctxt->context->node->parent->name, in xmlXPathNextAncestor()
7984 return(ctxt->context->node->parent); in xmlXPathNextAncestor()
7986 xmlAttrPtr tmp = (xmlAttrPtr) ctxt->context->node; in xmlXPathNextAncestor()
7999 xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; in xmlXPathNextAncestor()
8010 if (cur == ctxt->context->doc->children) in xmlXPathNextAncestor()
8011 return((xmlNodePtr) ctxt->context->doc); in xmlXPathNextAncestor()
8012 if (cur == (xmlNodePtr) ctxt->context->doc) in xmlXPathNextAncestor()
8038 xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node; in xmlXPathNextAncestor()
8043 xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; in xmlXPathNextAncestor()
8077 xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextAncestorOrSelf() argument
8078 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextAncestorOrSelf()
8080 return(ctxt->context->node); in xmlXPathNextAncestorOrSelf()
8081 return(xmlXPathNextAncestor(ctxt, cur)); in xmlXPathNextAncestorOrSelf()
8096 xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextFollowingSibling() argument
8097 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextFollowingSibling()
8098 if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || in xmlXPathNextFollowingSibling()
8099 (ctxt->context->node->type == XML_NAMESPACE_DECL)) in xmlXPathNextFollowingSibling()
8101 if (cur == (xmlNodePtr) ctxt->context->doc) in xmlXPathNextFollowingSibling()
8104 return(ctxt->context->node->next); in xmlXPathNextFollowingSibling()
8121 xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextPrecedingSibling() argument
8122 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextPrecedingSibling()
8123 if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || in xmlXPathNextPrecedingSibling()
8124 (ctxt->context->node->type == XML_NAMESPACE_DECL)) in xmlXPathNextPrecedingSibling()
8126 if (cur == (xmlNodePtr) ctxt->context->doc) in xmlXPathNextPrecedingSibling()
8129 return(ctxt->context->node->prev); in xmlXPathNextPrecedingSibling()
8133 return(ctxt->context->node->prev); in xmlXPathNextPrecedingSibling()
8152 xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextFollowing() argument
8153 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextFollowing()
8159 cur = ctxt->context->node; in xmlXPathNextFollowing()
8170 if (cur == (xmlNodePtr) ctxt->context->doc) return(NULL); in xmlXPathNextFollowing()
8215 xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) in xmlXPathNextPreceding() argument
8217 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextPreceding()
8219 cur = ctxt->context->node; in xmlXPathNextPreceding()
8238 if (cur == ctxt->context->doc->children) in xmlXPathNextPreceding()
8240 } while (xmlXPathIsAncestor(cur, ctxt->context->node)); in xmlXPathNextPreceding()
8260 xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt, in xmlXPathNextPrecedingInternal() argument
8263 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextPrecedingInternal()
8265 cur = ctxt->context->node; in xmlXPathNextPrecedingInternal()
8270 ctxt->ancestor = cur->parent; in xmlXPathNextPrecedingInternal()
8278 if (cur == ctxt->context->doc->children) in xmlXPathNextPrecedingInternal()
8280 if (cur != ctxt->ancestor) in xmlXPathNextPrecedingInternal()
8282 ctxt->ancestor = cur->parent; in xmlXPathNextPrecedingInternal()
8305 xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextNamespace() argument
8306 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextNamespace()
8307 if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL); in xmlXPathNextNamespace()
8308 if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) { in xmlXPathNextNamespace()
8309 if (ctxt->context->tmpNsList != NULL) in xmlXPathNextNamespace()
8310 xmlFree(ctxt->context->tmpNsList); in xmlXPathNextNamespace()
8311 ctxt->context->tmpNsList = in xmlXPathNextNamespace()
8312 xmlGetNsList(ctxt->context->doc, ctxt->context->node); in xmlXPathNextNamespace()
8313 ctxt->context->tmpNsNr = 0; in xmlXPathNextNamespace()
8314 if (ctxt->context->tmpNsList != NULL) { in xmlXPathNextNamespace()
8315 while (ctxt->context->tmpNsList[ctxt->context->tmpNsNr] != NULL) { in xmlXPathNextNamespace()
8316 ctxt->context->tmpNsNr++; in xmlXPathNextNamespace()
8321 if (ctxt->context->tmpNsNr > 0) { in xmlXPathNextNamespace()
8322 return (xmlNodePtr)ctxt->context->tmpNsList[--ctxt->context->tmpNsNr]; in xmlXPathNextNamespace()
8324 if (ctxt->context->tmpNsList != NULL) in xmlXPathNextNamespace()
8325 xmlFree(ctxt->context->tmpNsList); in xmlXPathNextNamespace()
8326 ctxt->context->tmpNsList = NULL; in xmlXPathNextNamespace()
8342 xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { in xmlXPathNextAttribute() argument
8343 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); in xmlXPathNextAttribute()
8344 if (ctxt->context->node == NULL) in xmlXPathNextAttribute()
8346 if (ctxt->context->node->type != XML_ELEMENT_NODE) in xmlXPathNextAttribute()
8349 if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc) in xmlXPathNextAttribute()
8351 return((xmlNodePtr)ctxt->context->node->properties); in xmlXPathNextAttribute()
8378 xmlXPathRoot(xmlXPathParserContextPtr ctxt) { in xmlXPathRoot() argument
8379 if ((ctxt == NULL) || (ctxt->context == NULL)) in xmlXPathRoot()
8381 ctxt->context->node = (xmlNodePtr) ctxt->context->doc; in xmlXPathRoot()
8382 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathRoot()
8383 ctxt->context->node)); in xmlXPathRoot()
8404 xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathLastFunction() argument
8406 if (ctxt->context->contextSize >= 0) { in xmlXPathLastFunction()
8407 valuePush(ctxt, in xmlXPathLastFunction()
8408 xmlXPathCacheNewFloat(ctxt->context, in xmlXPathLastFunction()
8409 (double) ctxt->context->contextSize)); in xmlXPathLastFunction()
8412 "last() : %d\n", ctxt->context->contextSize); in xmlXPathLastFunction()
8431 xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathPositionFunction() argument
8433 if (ctxt->context->proximityPosition >= 0) { in xmlXPathPositionFunction()
8434 valuePush(ctxt, in xmlXPathPositionFunction()
8435 xmlXPathCacheNewFloat(ctxt->context, in xmlXPathPositionFunction()
8436 (double) ctxt->context->proximityPosition)); in xmlXPathPositionFunction()
8439 ctxt->context->proximityPosition); in xmlXPathPositionFunction()
8455 xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathCountFunction() argument
8459 if ((ctxt->value == NULL) || in xmlXPathCountFunction()
8460 ((ctxt->value->type != XPATH_NODESET) && in xmlXPathCountFunction()
8461 (ctxt->value->type != XPATH_XSLT_TREE))) in xmlXPathCountFunction()
8463 cur = valuePop(ctxt); in xmlXPathCountFunction()
8466 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); in xmlXPathCountFunction()
8468 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, in xmlXPathCountFunction()
8473 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); in xmlXPathCountFunction()
8486 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) i)); in xmlXPathCountFunction()
8489 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathCountFunction()
8568 xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathIdFunction() argument
8574 obj = valuePop(ctxt); in xmlXPathIdFunction()
8591 ns = xmlXPathGetElementsByIds(ctxt->context->doc, tokens); in xmlXPathIdFunction()
8598 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathIdFunction()
8599 valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, ret)); in xmlXPathIdFunction()
8602 obj = xmlXPathCacheConvertString(ctxt->context, obj); in xmlXPathIdFunction()
8603 ret = xmlXPathGetElementsByIds(ctxt->context->doc, obj->stringval); in xmlXPathIdFunction()
8604 valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, ret)); in xmlXPathIdFunction()
8605 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathIdFunction()
8623 xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathLocalNameFunction() argument
8626 if (ctxt == NULL) return; in xmlXPathLocalNameFunction()
8629 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathLocalNameFunction()
8630 ctxt->context->node)); in xmlXPathLocalNameFunction()
8635 if ((ctxt->value == NULL) || in xmlXPathLocalNameFunction()
8636 ((ctxt->value->type != XPATH_NODESET) && in xmlXPathLocalNameFunction()
8637 (ctxt->value->type != XPATH_XSLT_TREE))) in xmlXPathLocalNameFunction()
8639 cur = valuePop(ctxt); in xmlXPathLocalNameFunction()
8642 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathLocalNameFunction()
8650 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathLocalNameFunction()
8652 valuePush(ctxt, in xmlXPathLocalNameFunction()
8653 xmlXPathCacheNewString(ctxt->context, in xmlXPathLocalNameFunction()
8657 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, in xmlXPathLocalNameFunction()
8661 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathLocalNameFunction()
8664 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathLocalNameFunction()
8682 xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathNamespaceURIFunction() argument
8685 if (ctxt == NULL) return; in xmlXPathNamespaceURIFunction()
8688 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathNamespaceURIFunction()
8689 ctxt->context->node)); in xmlXPathNamespaceURIFunction()
8693 if ((ctxt->value == NULL) || in xmlXPathNamespaceURIFunction()
8694 ((ctxt->value->type != XPATH_NODESET) && in xmlXPathNamespaceURIFunction()
8695 (ctxt->value->type != XPATH_XSLT_TREE))) in xmlXPathNamespaceURIFunction()
8697 cur = valuePop(ctxt); in xmlXPathNamespaceURIFunction()
8700 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathNamespaceURIFunction()
8707 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathNamespaceURIFunction()
8709 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, in xmlXPathNamespaceURIFunction()
8713 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathNamespaceURIFunction()
8716 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathNamespaceURIFunction()
8742 xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) in xmlXPathNameFunction() argument
8747 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathNameFunction()
8748 ctxt->context->node)); in xmlXPathNameFunction()
8753 if ((ctxt->value == NULL) || in xmlXPathNameFunction()
8754 ((ctxt->value->type != XPATH_NODESET) && in xmlXPathNameFunction()
8755 (ctxt->value->type != XPATH_XSLT_TREE))) in xmlXPathNameFunction()
8757 cur = valuePop(ctxt); in xmlXPathNameFunction()
8760 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathNameFunction()
8768 valuePush(ctxt, in xmlXPathNameFunction()
8769 xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathNameFunction()
8772 valuePush(ctxt, in xmlXPathNameFunction()
8773 xmlXPathCacheNewString(ctxt->context, in xmlXPathNameFunction()
8786 valuePush(ctxt, xmlXPathCacheWrapString( in xmlXPathNameFunction()
8787 ctxt->context, fullname)); in xmlXPathNameFunction()
8791 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathNameFunction()
8793 xmlXPathLocalNameFunction(ctxt, 1); in xmlXPathNameFunction()
8796 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathNameFunction()
8837 xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathStringFunction() argument
8840 if (ctxt == NULL) return; in xmlXPathStringFunction()
8842 valuePush(ctxt, in xmlXPathStringFunction()
8843 xmlXPathCacheWrapString(ctxt->context, in xmlXPathStringFunction()
8844 xmlXPathCastNodeToString(ctxt->context->node))); in xmlXPathStringFunction()
8849 cur = valuePop(ctxt); in xmlXPathStringFunction()
8851 valuePush(ctxt, xmlXPathCacheConvertString(ctxt->context, cur)); in xmlXPathStringFunction()
8867 xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathStringLengthFunction() argument
8871 if ((ctxt == NULL) || (ctxt->context == NULL)) in xmlXPathStringLengthFunction()
8873 if (ctxt->context->node == NULL) { in xmlXPathStringLengthFunction()
8874 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, 0)); in xmlXPathStringLengthFunction()
8878 content = xmlXPathCastNodeToString(ctxt->context->node); in xmlXPathStringLengthFunction()
8879 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, in xmlXPathStringLengthFunction()
8888 cur = valuePop(ctxt); in xmlXPathStringLengthFunction()
8889 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, in xmlXPathStringLengthFunction()
8891 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathStringLengthFunction()
8904 xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathConcatFunction() argument
8908 if (ctxt == NULL) return; in xmlXPathConcatFunction()
8914 cur = valuePop(ctxt); in xmlXPathConcatFunction()
8916 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathConcatFunction()
8923 newobj = valuePop(ctxt); in xmlXPathConcatFunction()
8925 xmlXPathReleaseObject(ctxt->context, newobj); in xmlXPathConcatFunction()
8926 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathConcatFunction()
8932 xmlXPathReleaseObject(ctxt->context, newobj); in xmlXPathConcatFunction()
8935 valuePush(ctxt, cur); in xmlXPathConcatFunction()
8949 xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathContainsFunction() argument
8955 needle = valuePop(ctxt); in xmlXPathContainsFunction()
8957 hay = valuePop(ctxt); in xmlXPathContainsFunction()
8960 xmlXPathReleaseObject(ctxt->context, hay); in xmlXPathContainsFunction()
8961 xmlXPathReleaseObject(ctxt->context, needle); in xmlXPathContainsFunction()
8965 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, 1)); in xmlXPathContainsFunction()
8967 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, 0)); in xmlXPathContainsFunction()
8968 xmlXPathReleaseObject(ctxt->context, hay); in xmlXPathContainsFunction()
8969 xmlXPathReleaseObject(ctxt->context, needle); in xmlXPathContainsFunction()
8983 xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathStartsWithFunction() argument
8990 needle = valuePop(ctxt); in xmlXPathStartsWithFunction()
8992 hay = valuePop(ctxt); in xmlXPathStartsWithFunction()
8995 xmlXPathReleaseObject(ctxt->context, hay); in xmlXPathStartsWithFunction()
8996 xmlXPathReleaseObject(ctxt->context, needle); in xmlXPathStartsWithFunction()
9001 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, 0)); in xmlXPathStartsWithFunction()
9003 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, 1)); in xmlXPathStartsWithFunction()
9004 xmlXPathReleaseObject(ctxt->context, hay); in xmlXPathStartsWithFunction()
9005 xmlXPathReleaseObject(ctxt->context, needle); in xmlXPathStartsWithFunction()
9037 xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathSubstringFunction() argument
9055 len = valuePop(ctxt); in xmlXPathSubstringFunction()
9057 xmlXPathReleaseObject(ctxt->context, len); in xmlXPathSubstringFunction()
9062 start = valuePop(ctxt); in xmlXPathSubstringFunction()
9064 xmlXPathReleaseObject(ctxt->context, start); in xmlXPathSubstringFunction()
9067 str = valuePop(ctxt); in xmlXPathSubstringFunction()
9124 valuePush(ctxt, xmlXPathCacheNewCString(ctxt->context, "")); in xmlXPathSubstringFunction()
9126 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, ret)); in xmlXPathSubstringFunction()
9129 xmlXPathReleaseObject(ctxt->context, str); in xmlXPathSubstringFunction()
9146 xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathSubstringBeforeFunction() argument
9155 find = valuePop(ctxt); in xmlXPathSubstringBeforeFunction()
9157 str = valuePop(ctxt); in xmlXPathSubstringBeforeFunction()
9166 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, in xmlXPathSubstringBeforeFunction()
9170 xmlXPathReleaseObject(ctxt->context, str); in xmlXPathSubstringBeforeFunction()
9171 xmlXPathReleaseObject(ctxt->context, find); in xmlXPathSubstringBeforeFunction()
9189 xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathSubstringAfterFunction() argument
9198 find = valuePop(ctxt); in xmlXPathSubstringAfterFunction()
9200 str = valuePop(ctxt); in xmlXPathSubstringAfterFunction()
9210 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, in xmlXPathSubstringAfterFunction()
9214 xmlXPathReleaseObject(ctxt->context, str); in xmlXPathSubstringAfterFunction()
9215 xmlXPathReleaseObject(ctxt->context, find); in xmlXPathSubstringAfterFunction()
9233 xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathNormalizeFunction() argument
9239 if (ctxt == NULL) return; in xmlXPathNormalizeFunction()
9242 valuePush(ctxt, in xmlXPathNormalizeFunction()
9243 xmlXPathCacheWrapString(ctxt->context, in xmlXPathNormalizeFunction()
9244 xmlXPathCastNodeToString(ctxt->context->node))); in xmlXPathNormalizeFunction()
9251 obj = valuePop(ctxt); in xmlXPathNormalizeFunction()
9275 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, in xmlXPathNormalizeFunction()
9279 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathNormalizeFunction()
9304 xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathTranslateFunction() argument
9317 to = valuePop(ctxt); in xmlXPathTranslateFunction()
9319 from = valuePop(ctxt); in xmlXPathTranslateFunction()
9321 str = valuePop(ctxt); in xmlXPathTranslateFunction()
9360 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, in xmlXPathTranslateFunction()
9363 xmlXPathReleaseObject(ctxt->context, str); in xmlXPathTranslateFunction()
9364 xmlXPathReleaseObject(ctxt->context, from); in xmlXPathTranslateFunction()
9365 xmlXPathReleaseObject(ctxt->context, to); in xmlXPathTranslateFunction()
9382 xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathBooleanFunction() argument
9386 cur = valuePop(ctxt); in xmlXPathBooleanFunction()
9388 cur = xmlXPathCacheConvertBoolean(ctxt->context, cur); in xmlXPathBooleanFunction()
9389 valuePush(ctxt, cur); in xmlXPathBooleanFunction()
9403 xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathNotFunction() argument
9407 ctxt->value->boolval = ! ctxt->value->boolval; in xmlXPathNotFunction()
9419 xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathTrueFunction() argument
9421 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, 1)); in xmlXPathTrueFunction()
9433 xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathFalseFunction() argument
9435 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, 0)); in xmlXPathFalseFunction()
9460 xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathLangFunction() argument
9470 val = valuePop(ctxt); in xmlXPathLangFunction()
9472 theLang = xmlNodeGetLang(ctxt->context->node); in xmlXPathLangFunction()
9484 xmlXPathReleaseObject(ctxt->context, val); in xmlXPathLangFunction()
9485 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, ret)); in xmlXPathLangFunction()
9497 xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathNumberFunction() argument
9501 if (ctxt == NULL) return; in xmlXPathNumberFunction()
9503 if (ctxt->context->node == NULL) { in xmlXPathNumberFunction()
9504 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, 0.0)); in xmlXPathNumberFunction()
9506 xmlChar* content = xmlNodeGetContent(ctxt->context->node); in xmlXPathNumberFunction()
9509 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, res)); in xmlXPathNumberFunction()
9516 cur = valuePop(ctxt); in xmlXPathNumberFunction()
9517 valuePush(ctxt, xmlXPathCacheConvertNumber(ctxt->context, cur)); in xmlXPathNumberFunction()
9531 xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathSumFunction() argument
9537 if ((ctxt->value == NULL) || in xmlXPathSumFunction()
9538 ((ctxt->value->type != XPATH_NODESET) && in xmlXPathSumFunction()
9539 (ctxt->value->type != XPATH_XSLT_TREE))) in xmlXPathSumFunction()
9541 cur = valuePop(ctxt); in xmlXPathSumFunction()
9548 valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, res)); in xmlXPathSumFunction()
9549 xmlXPathReleaseObject(ctxt->context, cur); in xmlXPathSumFunction()
9575 xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathFloorFunction() argument
9582 XTRUNC(f, ctxt->value->floatval); in xmlXPathFloorFunction()
9583 if (f != ctxt->value->floatval) { in xmlXPathFloorFunction()
9584 if (ctxt->value->floatval > 0) in xmlXPathFloorFunction()
9585 ctxt->value->floatval = f; in xmlXPathFloorFunction()
9587 ctxt->value->floatval = f - 1; in xmlXPathFloorFunction()
9602 xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathCeilingFunction() argument
9610 ctxt->value->floatval = ceil(ctxt->value->floatval); in xmlXPathCeilingFunction()
9612 XTRUNC(f, ctxt->value->floatval); in xmlXPathCeilingFunction()
9613 if (f != ctxt->value->floatval) { in xmlXPathCeilingFunction()
9614 if (ctxt->value->floatval > 0) in xmlXPathCeilingFunction()
9615 ctxt->value->floatval = f + 1; in xmlXPathCeilingFunction()
9617 if (ctxt->value->floatval < 0 && f == 0) in xmlXPathCeilingFunction()
9618 ctxt->value->floatval = xmlXPathNZERO; in xmlXPathCeilingFunction()
9620 ctxt->value->floatval = f; in xmlXPathCeilingFunction()
9639 xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathRoundFunction() argument
9646 if ((xmlXPathIsNaN(ctxt->value->floatval)) || in xmlXPathRoundFunction()
9647 (xmlXPathIsInf(ctxt->value->floatval) == 1) || in xmlXPathRoundFunction()
9648 (xmlXPathIsInf(ctxt->value->floatval) == -1) || in xmlXPathRoundFunction()
9649 (ctxt->value->floatval == 0.0)) in xmlXPathRoundFunction()
9652 XTRUNC(f, ctxt->value->floatval); in xmlXPathRoundFunction()
9653 if (ctxt->value->floatval < 0) { in xmlXPathRoundFunction()
9654 if (ctxt->value->floatval < f - 0.5) in xmlXPathRoundFunction()
9655 ctxt->value->floatval = f - 1; in xmlXPathRoundFunction()
9657 ctxt->value->floatval = f; in xmlXPathRoundFunction()
9658 if (ctxt->value->floatval == 0) in xmlXPathRoundFunction()
9659 ctxt->value->floatval = xmlXPathNZERO; in xmlXPathRoundFunction()
9661 if (ctxt->value->floatval < f + 0.5) in xmlXPathRoundFunction()
9662 ctxt->value->floatval = f; in xmlXPathRoundFunction()
9664 ctxt->value->floatval = f + 1; in xmlXPathRoundFunction()
9678 static void xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort);
9679 static void xmlXPathCompPredicate(xmlXPathParserContextPtr ctxt, int filter);
9680 static void xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt);
9681 static void xmlXPathCompRelativeLocationPath(xmlXPathParserContextPtr ctxt);
9682 static xmlChar * xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt,
9698 xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) { in xmlXPathCurrentChar() argument
9703 if (ctxt == NULL) in xmlXPathCurrentChar()
9705 cur = ctxt->cur; in xmlXPathCurrentChar()
9785 xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) { in xmlXPathParseNCName() argument
9790 if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL); in xmlXPathParseNCName()
9794 in = ctxt->cur; in xmlXPathParseNCName()
9808 count = in - ctxt->cur; in xmlXPathParseNCName()
9811 ret = xmlStrndup(ctxt->cur, count); in xmlXPathParseNCName()
9812 ctxt->cur = in; in xmlXPathParseNCName()
9816 return(xmlXPathParseNameComplex(ctxt, 0)); in xmlXPathParseNCName()
9838 xmlXPathParseQName(xmlXPathParserContextPtr ctxt, xmlChar **prefix) { in xmlXPathParseQName() argument
9842 ret = xmlXPathParseNCName(ctxt); in xmlXPathParseQName()
9846 ret = xmlXPathParseNCName(ctxt); in xmlXPathParseQName()
9866 xmlXPathParseName(xmlXPathParserContextPtr ctxt) { in xmlXPathParseName() argument
9871 if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL); in xmlXPathParseName()
9875 in = ctxt->cur; in xmlXPathParseName()
9887 count = in - ctxt->cur; in xmlXPathParseName()
9888 ret = xmlStrndup(ctxt->cur, count); in xmlXPathParseName()
9889 ctxt->cur = in; in xmlXPathParseName()
9893 return(xmlXPathParseNameComplex(ctxt, 1)); in xmlXPathParseName()
9897 xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { in xmlXPathParseNameComplex() argument
10091 xmlXPathCompNumber(xmlXPathParserContextPtr ctxt) in xmlXPathCompNumber() argument
10164 xmlXPathCacheNewFloat(ctxt->context, ret), NULL); in xmlXPathCompNumber()
10179 xmlXPathParseLiteral(xmlXPathParserContextPtr ctxt) { in xmlXPathParseLiteral() argument
10223 xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) { in xmlXPathCompLiteral() argument
10254 xmlXPathCacheNewString(ctxt->context, ret), NULL); in xmlXPathCompLiteral()
10276 xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) { in xmlXPathCompVariableReference() argument
10285 name = xmlXPathParseQName(ctxt, &prefix); in xmlXPathCompVariableReference()
10289 ctxt->comp->last = -1; in xmlXPathCompVariableReference()
10293 if ((ctxt->context != NULL) && (ctxt->context->flags & XML_XPATH_NOVAR)) { in xmlXPathCompVariableReference()
10338 xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) { in xmlXPathCompFunctionCall() argument
10344 name = xmlXPathParseQName(ctxt, &prefix); in xmlXPathCompFunctionCall()
10373 ctxt->comp->last = -1; in xmlXPathCompFunctionCall()
10376 int op1 = ctxt->comp->last; in xmlXPathCompFunctionCall()
10377 ctxt->comp->last = -1; in xmlXPathCompFunctionCall()
10378 xmlXPathCompileExpr(ctxt, sort); in xmlXPathCompFunctionCall()
10379 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompFunctionCall()
10384 PUSH_BINARY_EXPR(XPATH_OP_ARG, op1, ctxt->comp->last, 0, 0); in xmlXPathCompFunctionCall()
10413 xmlXPathCompPrimaryExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompPrimaryExpr() argument
10415 if (CUR == '$') xmlXPathCompVariableReference(ctxt); in xmlXPathCompPrimaryExpr()
10419 xmlXPathCompileExpr(ctxt, 1); in xmlXPathCompPrimaryExpr()
10427 xmlXPathCompNumber(ctxt); in xmlXPathCompPrimaryExpr()
10429 xmlXPathCompLiteral(ctxt); in xmlXPathCompPrimaryExpr()
10431 xmlXPathCompFunctionCall(ctxt); in xmlXPathCompPrimaryExpr()
10452 xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompFilterExpr() argument
10453 xmlXPathCompPrimaryExpr(ctxt); in xmlXPathCompFilterExpr()
10458 xmlXPathCompPredicate(ctxt, 1); in xmlXPathCompFilterExpr()
10483 xmlXPathScanName(xmlXPathParserContextPtr ctxt) { in xmlXPathScanName() argument
10489 cur = ctxt->cur; in xmlXPathScanName()
10508 ret = xmlStrndup(cur, ctxt->cur - cur); in xmlXPathScanName()
10509 ctxt->cur = cur; in xmlXPathScanName()
10532 xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompPathExpr() argument
10567 name = xmlXPathScanName(ctxt); in xmlXPathCompPathExpr()
10653 xmlXPathCompLocationPath(ctxt); in xmlXPathCompPathExpr()
10655 xmlXPathCompFilterExpr(ctxt); in xmlXPathCompPathExpr()
10663 PUSH_UNARY_EXPR(XPATH_OP_RESET, ctxt->comp->last, 1, 0); in xmlXPathCompPathExpr()
10665 xmlXPathCompRelativeLocationPath(ctxt); in xmlXPathCompPathExpr()
10667 xmlXPathCompRelativeLocationPath(ctxt); in xmlXPathCompPathExpr()
10684 xmlXPathCompUnionExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompUnionExpr() argument
10685 xmlXPathCompPathExpr(ctxt); in xmlXPathCompUnionExpr()
10689 int op1 = ctxt->comp->last; in xmlXPathCompUnionExpr()
10694 xmlXPathCompPathExpr(ctxt); in xmlXPathCompUnionExpr()
10696 PUSH_BINARY_EXPR(XPATH_OP_UNION, op1, ctxt->comp->last, 0, 0); in xmlXPathCompUnionExpr()
10713 xmlXPathCompUnaryExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompUnaryExpr() argument
10725 xmlXPathCompUnionExpr(ctxt); in xmlXPathCompUnaryExpr()
10729 PUSH_UNARY_EXPR(XPATH_OP_PLUS, ctxt->comp->last, 2, 0); in xmlXPathCompUnaryExpr()
10731 PUSH_UNARY_EXPR(XPATH_OP_PLUS, ctxt->comp->last, 3, 0); in xmlXPathCompUnaryExpr()
10749 xmlXPathCompMultiplicativeExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompMultiplicativeExpr() argument
10750 xmlXPathCompUnaryExpr(ctxt); in xmlXPathCompMultiplicativeExpr()
10757 int op1 = ctxt->comp->last; in xmlXPathCompMultiplicativeExpr()
10770 xmlXPathCompUnaryExpr(ctxt); in xmlXPathCompMultiplicativeExpr()
10772 PUSH_BINARY_EXPR(XPATH_OP_MULT, op1, ctxt->comp->last, op, 0); in xmlXPathCompMultiplicativeExpr()
10789 xmlXPathCompAdditiveExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompAdditiveExpr() argument
10791 xmlXPathCompMultiplicativeExpr(ctxt); in xmlXPathCompAdditiveExpr()
10796 int op1 = ctxt->comp->last; in xmlXPathCompAdditiveExpr()
10802 xmlXPathCompMultiplicativeExpr(ctxt); in xmlXPathCompAdditiveExpr()
10804 PUSH_BINARY_EXPR(XPATH_OP_PLUS, op1, ctxt->comp->last, plus, 0); in xmlXPathCompAdditiveExpr()
10828 xmlXPathCompRelationalExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompRelationalExpr() argument
10829 xmlXPathCompAdditiveExpr(ctxt); in xmlXPathCompRelationalExpr()
10837 int op1 = ctxt->comp->last; in xmlXPathCompRelationalExpr()
10846 xmlXPathCompAdditiveExpr(ctxt); in xmlXPathCompRelationalExpr()
10848 PUSH_BINARY_EXPR(XPATH_OP_CMP, op1, ctxt->comp->last, inf, strict); in xmlXPathCompRelationalExpr()
10870 xmlXPathCompEqualityExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompEqualityExpr() argument
10871 xmlXPathCompRelationalExpr(ctxt); in xmlXPathCompEqualityExpr()
10876 int op1 = ctxt->comp->last; in xmlXPathCompEqualityExpr()
10883 xmlXPathCompRelationalExpr(ctxt); in xmlXPathCompEqualityExpr()
10885 PUSH_BINARY_EXPR(XPATH_OP_EQUAL, op1, ctxt->comp->last, eq, 0); in xmlXPathCompEqualityExpr()
10901 xmlXPathCompAndExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathCompAndExpr() argument
10902 xmlXPathCompEqualityExpr(ctxt); in xmlXPathCompAndExpr()
10906 int op1 = ctxt->comp->last; in xmlXPathCompAndExpr()
10909 xmlXPathCompEqualityExpr(ctxt); in xmlXPathCompAndExpr()
10911 PUSH_BINARY_EXPR(XPATH_OP_AND, op1, ctxt->comp->last, 0, 0); in xmlXPathCompAndExpr()
10927 xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) { in xmlXPathCompileExpr() argument
10928 xmlXPathCompAndExpr(ctxt); in xmlXPathCompileExpr()
10932 int op1 = ctxt->comp->last; in xmlXPathCompileExpr()
10935 xmlXPathCompAndExpr(ctxt); in xmlXPathCompileExpr()
10937 PUSH_BINARY_EXPR(XPATH_OP_OR, op1, ctxt->comp->last, 0, 0); in xmlXPathCompileExpr()
10940 if ((sort) && (ctxt->comp->steps[ctxt->comp->last].op != XPATH_OP_VALUE)) { in xmlXPathCompileExpr()
10947 PUSH_UNARY_EXPR(XPATH_OP_SORT, ctxt->comp->last , 0, 0); in xmlXPathCompileExpr()
10962 xmlXPathCompPredicate(xmlXPathParserContextPtr ctxt, int filter) { in xmlXPathCompPredicate() argument
10963 int op1 = ctxt->comp->last; in xmlXPathCompPredicate()
10972 ctxt->comp->last = -1; in xmlXPathCompPredicate()
10983 xmlXPathCompileExpr(ctxt, 0); in xmlXPathCompPredicate()
10985 xmlXPathCompileExpr(ctxt, 1); in xmlXPathCompPredicate()
10993 PUSH_BINARY_EXPR(XPATH_OP_FILTER, op1, ctxt->comp->last, 0, 0); in xmlXPathCompPredicate()
10995 PUSH_BINARY_EXPR(XPATH_OP_PREDICATE, op1, ctxt->comp->last, 0, 0); in xmlXPathCompPredicate()
11023 xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test, in xmlXPathCompNodeTest() argument
11047 name = xmlXPathParseNCName(ctxt); in xmlXPathCompNodeTest()
11084 name = xmlXPathParseLiteral(ctxt); in xmlXPathCompNodeTest()
11110 *prefix = xmlXPathNsLookup(ctxt->context, name); in xmlXPathCompNodeTest()
11129 name = xmlXPathParseNCName(ctxt); in xmlXPathCompNodeTest()
11238 xmlXPathCompStep(xmlXPathParserContextPtr ctxt) { in xmlXPathCompStep() argument
11265 if (ctxt->xptr) { in xmlXPathCompStep()
11266 name = xmlXPathParseNCName(ctxt); in xmlXPathCompStep()
11268 op2 = ctxt->comp->last; in xmlXPathCompStep()
11277 xmlXPathCompileExpr(ctxt, 1); in xmlXPathCompStep()
11295 name = xmlXPathParseNCName(ctxt); in xmlXPathCompStep()
11319 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompStep()
11324 name = xmlXPathCompNodeTest(ctxt, &test, &type, &prefix, name); in xmlXPathCompStep()
11328 if ((prefix != NULL) && (ctxt->context != NULL) && in xmlXPathCompStep()
11329 (ctxt->context->flags & XML_XPATH_CHECKNS)) { in xmlXPathCompStep()
11330 if (xmlXPathNsLookup(ctxt->context, prefix) == NULL) { in xmlXPathCompStep()
11331 xmlXPathErr(ctxt, XPATH_UNDEF_PREFIX_ERROR); in xmlXPathCompStep()
11341 if (ctxt->value == NULL) in xmlXPathCompStep()
11343 else if (ctxt->value->nodesetval == NULL) in xmlXPathCompStep()
11346 xmlGenericErrorContextNodeSet(stdout, ctxt->value->nodesetval); in xmlXPathCompStep()
11352 op1 = ctxt->comp->last; in xmlXPathCompStep()
11353 ctxt->comp->last = -1; in xmlXPathCompStep()
11357 xmlXPathCompPredicate(ctxt, 0); in xmlXPathCompStep()
11365 PUSH_FULL_EXPR(XPATH_OP_COLLECT, op1, ctxt->comp->last, axis, in xmlXPathCompStep()
11371 if (ctxt->value == NULL) in xmlXPathCompStep()
11373 else if (ctxt->value->nodesetval == NULL) in xmlXPathCompStep()
11377 ctxt->value->nodesetval); in xmlXPathCompStep()
11394 (xmlXPathParserContextPtr ctxt) { in xmlXPathCompRelativeLocationPath() argument
11405 xmlXPathCompStep(ctxt); in xmlXPathCompRelativeLocationPath()
11414 xmlXPathCompStep(ctxt); in xmlXPathCompRelativeLocationPath()
11418 xmlXPathCompStep(ctxt); in xmlXPathCompRelativeLocationPath()
11446 xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) { in xmlXPathCompLocationPath() argument
11449 xmlXPathCompRelativeLocationPath(ctxt); in xmlXPathCompLocationPath()
11457 xmlXPathCompRelativeLocationPath(ctxt); in xmlXPathCompLocationPath()
11464 xmlXPathCompRelativeLocationPath(ctxt); in xmlXPathCompLocationPath()
11478 xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op);
11568 xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, in xmlXPathCompOpEvalPredicate() argument
11575 xmlXPathCompExprPtr comp = ctxt->comp; in xmlXPathCompOpEvalPredicate()
11584 contextSize = xmlXPathCompOpEvalPredicate(ctxt, in xmlXPathCompOpEvalPredicate()
11591 xmlXPathContextPtr xpctxt = ctxt->context; in xmlXPathCompOpEvalPredicate()
11633 exprOp = &ctxt->comp->steps[op->ch2]; in xmlXPathCompOpEvalPredicate()
11662 valuePush(ctxt, contextObj); in xmlXPathCompOpEvalPredicate()
11664 res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); in xmlXPathCompOpEvalPredicate()
11666 if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { in xmlXPathCompOpEvalPredicate()
11682 if (ctxt->value == contextObj) { in xmlXPathCompOpEvalPredicate()
11688 valuePop(ctxt); in xmlXPathCompOpEvalPredicate()
11700 if (ctxt->value == contextObj) in xmlXPathCompOpEvalPredicate()
11701 valuePop(ctxt); in xmlXPathCompOpEvalPredicate()
11706 xmlXPathReleaseObject(ctxt->context, exprRes); in xmlXPathCompOpEvalPredicate()
11720 xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, in xmlXPathCompOpEvalPositionalPredicate() argument
11729 xmlXPathCompExprPtr comp = ctxt->comp; in xmlXPathCompOpEvalPositionalPredicate()
11735 contextSize = xmlXPathCompOpEvalPredicate(ctxt, in xmlXPathCompOpEvalPositionalPredicate()
11760 xmlXPathContextPtr xpctxt = ctxt->context; in xmlXPathCompOpEvalPositionalPredicate()
11779 exprOp = &ctxt->comp->steps[op->ch2]; in xmlXPathCompOpEvalPositionalPredicate()
11810 frame = xmlXPathSetFrame(ctxt); in xmlXPathCompOpEvalPositionalPredicate()
11811 valuePush(ctxt, contextObj); in xmlXPathCompOpEvalPositionalPredicate()
11812 res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); in xmlXPathCompOpEvalPositionalPredicate()
11813 tmp = valuePop(ctxt); in xmlXPathCompOpEvalPositionalPredicate()
11814 xmlXPathPopFrame(ctxt, frame); in xmlXPathCompOpEvalPositionalPredicate()
11816 if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { in xmlXPathCompOpEvalPositionalPredicate()
11823 tmp = valuePop(ctxt); in xmlXPathCompOpEvalPositionalPredicate()
11828 valuePush(ctxt, tmp); in xmlXPathCompOpEvalPositionalPredicate()
11870 xmlXPathReleaseObject(ctxt->context, exprRes); in xmlXPathCompOpEvalPositionalPredicate()
11873 if (ctxt->value == contextObj) { in xmlXPathCompOpEvalPositionalPredicate()
11879 valuePop(ctxt); in xmlXPathCompOpEvalPositionalPredicate()
11897 if (ctxt->value == contextObj) in xmlXPathCompOpEvalPositionalPredicate()
11898 valuePop(ctxt); in xmlXPathCompOpEvalPositionalPredicate()
11902 xmlXPathReleaseObject(ctxt->context, exprRes); in xmlXPathCompOpEvalPositionalPredicate()
11916 xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, in xmlXPathIsPositionalPredicate() argument
11940 exprOp = &ctxt->comp->steps[op->ch2]; in xmlXPathIsPositionalPredicate()
11971 xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, in xmlXPathNodeCollectAndTest() argument
12037 xmlXPathContextPtr xpctxt = ctxt->context; in xmlXPathNodeCollectAndTest()
12041 obj = valuePop(ctxt); in xmlXPathNodeCollectAndTest()
12155 valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL)); in xmlXPathNodeCollectAndTest()
12184 predOp = &ctxt->comp->steps[op->ch2]; in xmlXPathNodeCollectAndTest()
12185 if (xmlXPathIsPositionalPredicate(ctxt, predOp, &maxPos)) { in xmlXPathNodeCollectAndTest()
12190 predOp = &ctxt->comp->steps[predOp->ch1]; in xmlXPathNodeCollectAndTest()
12260 cur = next(ctxt, cur); in xmlXPathNodeCollectAndTest()
12517 newSize = xmlXPathCompOpEvalPositionalPredicate(ctxt, in xmlXPathNodeCollectAndTest()
12520 newSize = xmlXPathCompOpEvalPredicate(ctxt, in xmlXPathNodeCollectAndTest()
12523 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathNodeCollectAndTest()
12579 ctxt->value->boolval = 1; in xmlXPathNodeCollectAndTest()
12580 ctxt->value->user = obj->user; in xmlXPathNodeCollectAndTest()
12603 valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, outSeq)); in xmlXPathNodeCollectAndTest()
12619 xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt,
12634 xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt, in xmlXPathCompOpEvalFirst() argument
12642 comp = ctxt->comp; in xmlXPathCompOpEvalFirst()
12648 xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch1], in xmlXPathCompOpEvalFirst()
12651 if ((ctxt->value != NULL) in xmlXPathCompOpEvalFirst()
12652 && (ctxt->value->type == XPATH_NODESET) in xmlXPathCompOpEvalFirst()
12653 && (ctxt->value->nodesetval != NULL) in xmlXPathCompOpEvalFirst()
12654 && (ctxt->value->nodesetval->nodeNr >= 1)) { in xmlXPathCompOpEvalFirst()
12665 if (ctxt->value->nodesetval->nodeNr > 1) in xmlXPathCompOpEvalFirst()
12666 xmlXPathNodeSetSort(ctxt->value->nodesetval); in xmlXPathCompOpEvalFirst()
12667 *first = ctxt->value->nodesetval->nodeTab[0]; in xmlXPathCompOpEvalFirst()
12670 xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch2], in xmlXPathCompOpEvalFirst()
12674 arg2 = valuePop(ctxt); in xmlXPathCompOpEvalFirst()
12677 arg1 = valuePop(ctxt); in xmlXPathCompOpEvalFirst()
12681 valuePush(ctxt, arg1); in xmlXPathCompOpEvalFirst()
12682 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompOpEvalFirst()
12688 xmlXPathRoot(ctxt); in xmlXPathCompOpEvalFirst()
12692 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEvalFirst()
12695 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEvalFirst()
12697 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEvalFirst()
12698 ctxt->context->node)); in xmlXPathCompOpEvalFirst()
12702 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEvalFirst()
12705 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEvalFirst()
12707 ctxt->context->node = NULL; in xmlXPathCompOpEvalFirst()
12713 total = xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEvalFirst()
12716 total += xmlXPathNodeCollectAndTest(ctxt, op, first, NULL, 0); in xmlXPathCompOpEvalFirst()
12720 valuePush(ctxt, in xmlXPathCompOpEvalFirst()
12721 xmlXPathCacheObjectCopy(ctxt->context, in xmlXPathCompOpEvalFirst()
12727 xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch1], in xmlXPathCompOpEvalFirst()
12730 if ((ctxt->value != NULL) in xmlXPathCompOpEvalFirst()
12731 && (ctxt->value->type == XPATH_NODESET) in xmlXPathCompOpEvalFirst()
12732 && (ctxt->value->nodesetval != NULL) in xmlXPathCompOpEvalFirst()
12733 && (ctxt->value->nodesetval->nodeNr > 1)) in xmlXPathCompOpEvalFirst()
12734 xmlXPathNodeSetSort(ctxt->value->nodesetval); in xmlXPathCompOpEvalFirst()
12738 total += xmlXPathCompOpEvalFilterFirst(ctxt, op, first); in xmlXPathCompOpEvalFirst()
12742 return (xmlXPathCompOpEval(ctxt, op)); in xmlXPathCompOpEvalFirst()
12758 xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op, in xmlXPathCompOpEvalLast() argument
12770 comp = ctxt->comp; in xmlXPathCompOpEvalLast()
12775 bakd = ctxt->context->doc; in xmlXPathCompOpEvalLast()
12776 bak = ctxt->context->node; in xmlXPathCompOpEvalLast()
12777 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEvalLast()
12778 cs = ctxt->context->contextSize; in xmlXPathCompOpEvalLast()
12780 xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], last); in xmlXPathCompOpEvalLast()
12782 if ((ctxt->value != NULL) in xmlXPathCompOpEvalLast()
12783 && (ctxt->value->type == XPATH_NODESET) in xmlXPathCompOpEvalLast()
12784 && (ctxt->value->nodesetval != NULL) in xmlXPathCompOpEvalLast()
12785 && (ctxt->value->nodesetval->nodeNr >= 1)) { in xmlXPathCompOpEvalLast()
12789 if (ctxt->value->nodesetval->nodeNr > 1) in xmlXPathCompOpEvalLast()
12790 xmlXPathNodeSetSort(ctxt->value->nodesetval); in xmlXPathCompOpEvalLast()
12792 ctxt->value->nodesetval->nodeTab[ctxt->value-> in xmlXPathCompOpEvalLast()
12796 ctxt->context->doc = bakd; in xmlXPathCompOpEvalLast()
12797 ctxt->context->node = bak; in xmlXPathCompOpEvalLast()
12798 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEvalLast()
12799 ctxt->context->contextSize = cs; in xmlXPathCompOpEvalLast()
12801 xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch2], last); in xmlXPathCompOpEvalLast()
12803 if ((ctxt->value != NULL) in xmlXPathCompOpEvalLast()
12804 && (ctxt->value->type == XPATH_NODESET) in xmlXPathCompOpEvalLast()
12805 && (ctxt->value->nodesetval != NULL) in xmlXPathCompOpEvalLast()
12806 && (ctxt->value->nodesetval->nodeNr >= 1)) { /* TODO: NOP ? */ in xmlXPathCompOpEvalLast()
12809 arg2 = valuePop(ctxt); in xmlXPathCompOpEvalLast()
12812 arg1 = valuePop(ctxt); in xmlXPathCompOpEvalLast()
12816 valuePush(ctxt, arg1); in xmlXPathCompOpEvalLast()
12817 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompOpEvalLast()
12823 xmlXPathRoot(ctxt); in xmlXPathCompOpEvalLast()
12827 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEvalLast()
12830 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEvalLast()
12832 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEvalLast()
12833 ctxt->context->node)); in xmlXPathCompOpEvalLast()
12837 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEvalLast()
12840 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEvalLast()
12842 ctxt->context->node = NULL; in xmlXPathCompOpEvalLast()
12848 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEvalLast()
12851 total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, last, 0); in xmlXPathCompOpEvalLast()
12855 valuePush(ctxt, in xmlXPathCompOpEvalLast()
12856 xmlXPathCacheObjectCopy(ctxt->context, in xmlXPathCompOpEvalLast()
12862 xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], in xmlXPathCompOpEvalLast()
12865 if ((ctxt->value != NULL) in xmlXPathCompOpEvalLast()
12866 && (ctxt->value->type == XPATH_NODESET) in xmlXPathCompOpEvalLast()
12867 && (ctxt->value->nodesetval != NULL) in xmlXPathCompOpEvalLast()
12868 && (ctxt->value->nodesetval->nodeNr > 1)) in xmlXPathCompOpEvalLast()
12869 xmlXPathNodeSetSort(ctxt->value->nodesetval); in xmlXPathCompOpEvalLast()
12872 return (xmlXPathCompOpEval(ctxt, op)); in xmlXPathCompOpEvalLast()
12878 xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, in xmlXPathCompOpEvalFilterFirst() argument
12891 comp = ctxt->comp; in xmlXPathCompOpEvalFilterFirst()
12910 xmlXPathCompOpEvalLast(ctxt, in xmlXPathCompOpEvalFilterFirst()
12918 if ((ctxt->value != NULL) && in xmlXPathCompOpEvalFilterFirst()
12919 (ctxt->value->type == XPATH_NODESET) && in xmlXPathCompOpEvalFilterFirst()
12920 (ctxt->value->nodesetval != NULL) && in xmlXPathCompOpEvalFilterFirst()
12921 (ctxt->value->nodesetval->nodeTab != NULL) && in xmlXPathCompOpEvalFilterFirst()
12922 (ctxt->value->nodesetval->nodeNr > 1)) { in xmlXPathCompOpEvalFilterFirst()
12923 ctxt->value->nodesetval->nodeTab[0] = in xmlXPathCompOpEvalFilterFirst()
12924 ctxt->value->nodesetval->nodeTab[ctxt-> in xmlXPathCompOpEvalFilterFirst()
12929 ctxt->value->nodesetval->nodeNr = 1; in xmlXPathCompOpEvalFilterFirst()
12930 *first = *(ctxt->value->nodesetval->nodeTab); in xmlXPathCompOpEvalFilterFirst()
12937 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEvalFilterFirst()
12941 if (ctxt->value == NULL) in xmlXPathCompOpEvalFilterFirst()
12945 oldnode = ctxt->context->node; in xmlXPathCompOpEvalFilterFirst()
12949 if (ctxt->value->type == XPATH_LOCATIONSET) { in xmlXPathCompOpEvalFilterFirst()
12960 obj = valuePop(ctxt); in xmlXPathCompOpEvalFilterFirst()
12962 ctxt->context->node = NULL; in xmlXPathCompOpEvalFilterFirst()
12965 ctxt->context->contextSize = 0; in xmlXPathCompOpEvalFilterFirst()
12966 ctxt->context->proximityPosition = 0; in xmlXPathCompOpEvalFilterFirst()
12968 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEvalFilterFirst()
12969 res = valuePop(ctxt); in xmlXPathCompOpEvalFilterFirst()
12971 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEvalFilterFirst()
12973 valuePush(ctxt, obj); in xmlXPathCompOpEvalFilterFirst()
12984 ctxt->context->node = oldlocset->locTab[i]->user; in xmlXPathCompOpEvalFilterFirst()
12985 ctxt->context->contextSize = oldlocset->locNr; in xmlXPathCompOpEvalFilterFirst()
12986 ctxt->context->proximityPosition = i + 1; in xmlXPathCompOpEvalFilterFirst()
12988 tmp = xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEvalFilterFirst()
12989 ctxt->context->node); in xmlXPathCompOpEvalFilterFirst()
12992 ctxt->context->node); in xmlXPathCompOpEvalFilterFirst()
12994 valuePush(ctxt, tmp); in xmlXPathCompOpEvalFilterFirst()
12996 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEvalFilterFirst()
12997 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompOpEvalFilterFirst()
13005 res = valuePop(ctxt); in xmlXPathCompOpEvalFilterFirst()
13006 if (xmlXPathEvaluatePredicateResult(ctxt, res)) { in xmlXPathCompOpEvalFilterFirst()
13008 xmlXPathCacheObjectCopy(ctxt->context, in xmlXPathCompOpEvalFilterFirst()
13015 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEvalFilterFirst()
13017 if (ctxt->value == tmp) { in xmlXPathCompOpEvalFilterFirst()
13018 valuePop(ctxt); in xmlXPathCompOpEvalFilterFirst()
13027 ctxt->context->node = NULL; in xmlXPathCompOpEvalFilterFirst()
13037 xmlXPathReleaseObject(ctxt->context, tmp); in xmlXPathCompOpEvalFilterFirst()
13042 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathCompOpEvalFilterFirst()
13043 ctxt->context->node = NULL; in xmlXPathCompOpEvalFilterFirst()
13044 ctxt->context->contextSize = -1; in xmlXPathCompOpEvalFilterFirst()
13045 ctxt->context->proximityPosition = -1; in xmlXPathCompOpEvalFilterFirst()
13046 valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset)); in xmlXPathCompOpEvalFilterFirst()
13047 ctxt->context->node = oldnode; in xmlXPathCompOpEvalFilterFirst()
13058 obj = valuePop(ctxt); in xmlXPathCompOpEvalFilterFirst()
13061 oldnode = ctxt->context->node; in xmlXPathCompOpEvalFilterFirst()
13062 oldDoc = ctxt->context->doc; in xmlXPathCompOpEvalFilterFirst()
13063 ctxt->context->node = NULL; in xmlXPathCompOpEvalFilterFirst()
13066 ctxt->context->contextSize = 0; in xmlXPathCompOpEvalFilterFirst()
13067 ctxt->context->proximityPosition = 0; in xmlXPathCompOpEvalFilterFirst()
13078 valuePush(ctxt, obj); in xmlXPathCompOpEvalFilterFirst()
13079 ctxt->context->node = oldnode; in xmlXPathCompOpEvalFilterFirst()
13097 ctxt->context->node = oldset->nodeTab[i]; in xmlXPathCompOpEvalFilterFirst()
13100 ctxt->context->doc = oldset->nodeTab[i]->doc; in xmlXPathCompOpEvalFilterFirst()
13102 tmp = xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEvalFilterFirst()
13103 ctxt->context->node); in xmlXPathCompOpEvalFilterFirst()
13106 ctxt->context->node); in xmlXPathCompOpEvalFilterFirst()
13108 valuePush(ctxt, tmp); in xmlXPathCompOpEvalFilterFirst()
13109 ctxt->context->contextSize = oldset->nodeNr; in xmlXPathCompOpEvalFilterFirst()
13110 ctxt->context->proximityPosition = i + 1; in xmlXPathCompOpEvalFilterFirst()
13112 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEvalFilterFirst()
13113 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompOpEvalFilterFirst()
13122 res = valuePop(ctxt); in xmlXPathCompOpEvalFilterFirst()
13123 if (xmlXPathEvaluatePredicateResult(ctxt, res)) { in xmlXPathCompOpEvalFilterFirst()
13130 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEvalFilterFirst()
13132 if (ctxt->value == tmp) { in xmlXPathCompOpEvalFilterFirst()
13133 valuePop(ctxt); in xmlXPathCompOpEvalFilterFirst()
13142 ctxt->context->node = NULL; in xmlXPathCompOpEvalFilterFirst()
13152 xmlXPathReleaseObject(ctxt->context, tmp); in xmlXPathCompOpEvalFilterFirst()
13157 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathCompOpEvalFilterFirst()
13158 ctxt->context->node = NULL; in xmlXPathCompOpEvalFilterFirst()
13159 ctxt->context->contextSize = -1; in xmlXPathCompOpEvalFilterFirst()
13160 ctxt->context->proximityPosition = -1; in xmlXPathCompOpEvalFilterFirst()
13162 ctxt->context->doc = oldDoc; in xmlXPathCompOpEvalFilterFirst()
13163 valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, newset)); in xmlXPathCompOpEvalFilterFirst()
13165 ctxt->context->node = oldnode; in xmlXPathCompOpEvalFilterFirst()
13179 xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) in xmlXPathCompOpEval() argument
13191 comp = ctxt->comp; in xmlXPathCompOpEval()
13196 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13197 bak = ctxt->context->node; in xmlXPathCompOpEval()
13198 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13199 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13200 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13202 xmlXPathBooleanFunction(ctxt, 1); in xmlXPathCompOpEval()
13203 if ((ctxt->value == NULL) || (ctxt->value->boolval == 0)) in xmlXPathCompOpEval()
13205 arg2 = valuePop(ctxt); in xmlXPathCompOpEval()
13206 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13207 ctxt->context->node = bak; in xmlXPathCompOpEval()
13208 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13209 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13210 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13211 if (ctxt->error) { in xmlXPathCompOpEval()
13215 xmlXPathBooleanFunction(ctxt, 1); in xmlXPathCompOpEval()
13216 arg1 = valuePop(ctxt); in xmlXPathCompOpEval()
13218 valuePush(ctxt, arg1); in xmlXPathCompOpEval()
13219 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompOpEval()
13222 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13223 bak = ctxt->context->node; in xmlXPathCompOpEval()
13224 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13225 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13226 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13228 xmlXPathBooleanFunction(ctxt, 1); in xmlXPathCompOpEval()
13229 if ((ctxt->value == NULL) || (ctxt->value->boolval == 1)) in xmlXPathCompOpEval()
13231 arg2 = valuePop(ctxt); in xmlXPathCompOpEval()
13232 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13233 ctxt->context->node = bak; in xmlXPathCompOpEval()
13234 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13235 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13236 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13237 if (ctxt->error) { in xmlXPathCompOpEval()
13241 xmlXPathBooleanFunction(ctxt, 1); in xmlXPathCompOpEval()
13242 arg1 = valuePop(ctxt); in xmlXPathCompOpEval()
13244 valuePush(ctxt, arg1); in xmlXPathCompOpEval()
13245 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompOpEval()
13248 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13249 bak = ctxt->context->node; in xmlXPathCompOpEval()
13250 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13251 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13252 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13254 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13255 ctxt->context->node = bak; in xmlXPathCompOpEval()
13256 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13257 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13258 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13261 equal = xmlXPathEqualValues(ctxt); in xmlXPathCompOpEval()
13263 equal = xmlXPathNotEqualValues(ctxt); in xmlXPathCompOpEval()
13264 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, equal)); in xmlXPathCompOpEval()
13267 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13268 bak = ctxt->context->node; in xmlXPathCompOpEval()
13269 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13270 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13271 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13273 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13274 ctxt->context->node = bak; in xmlXPathCompOpEval()
13275 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13276 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13277 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13279 ret = xmlXPathCompareValues(ctxt, op->value, op->value2); in xmlXPathCompOpEval()
13280 valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, ret)); in xmlXPathCompOpEval()
13283 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13284 bak = ctxt->context->node; in xmlXPathCompOpEval()
13285 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13286 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13287 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13290 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13291 ctxt->context->node = bak; in xmlXPathCompOpEval()
13292 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13293 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13294 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13298 xmlXPathSubValues(ctxt); in xmlXPathCompOpEval()
13300 xmlXPathAddValues(ctxt); in xmlXPathCompOpEval()
13302 xmlXPathValueFlipSign(ctxt); in xmlXPathCompOpEval()
13309 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13310 bak = ctxt->context->node; in xmlXPathCompOpEval()
13311 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13312 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13313 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13315 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13316 ctxt->context->node = bak; in xmlXPathCompOpEval()
13317 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13318 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13319 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13322 xmlXPathMultValues(ctxt); in xmlXPathCompOpEval()
13324 xmlXPathDivValues(ctxt); in xmlXPathCompOpEval()
13326 xmlXPathModValues(ctxt); in xmlXPathCompOpEval()
13329 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13330 bak = ctxt->context->node; in xmlXPathCompOpEval()
13331 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13332 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13333 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13335 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13336 ctxt->context->node = bak; in xmlXPathCompOpEval()
13337 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13338 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13339 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13342 arg2 = valuePop(ctxt); in xmlXPathCompOpEval()
13345 arg1 = valuePop(ctxt); in xmlXPathCompOpEval()
13355 valuePush(ctxt, arg1); in xmlXPathCompOpEval()
13356 xmlXPathReleaseObject(ctxt->context, arg2); in xmlXPathCompOpEval()
13359 xmlXPathRoot(ctxt); in xmlXPathCompOpEval()
13363 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13366 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13368 valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEval()
13369 ctxt->context->node)); in xmlXPathCompOpEval()
13373 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13376 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13378 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13384 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13387 total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, NULL, 0); in xmlXPathCompOpEval()
13391 valuePush(ctxt, in xmlXPathCompOpEval()
13392 xmlXPathCacheObjectCopy(ctxt->context, in xmlXPathCompOpEval()
13400 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13402 val = xmlXPathVariableLookup(ctxt->context, op->value4); in xmlXPathCompOpEval()
13404 ctxt->error = XPATH_UNDEF_VARIABLE_ERROR; in xmlXPathCompOpEval()
13407 valuePush(ctxt, val); in xmlXPathCompOpEval()
13411 URI = xmlXPathNsLookup(ctxt->context, op->value5); in xmlXPathCompOpEval()
13416 ctxt->error = XPATH_UNDEF_PREFIX_ERROR; in xmlXPathCompOpEval()
13419 val = xmlXPathVariableLookupNS(ctxt->context, in xmlXPathCompOpEval()
13422 ctxt->error = XPATH_UNDEF_VARIABLE_ERROR; in xmlXPathCompOpEval()
13425 valuePush(ctxt, val); in xmlXPathCompOpEval()
13435 frame = xmlXPathSetFrame(ctxt); in xmlXPathCompOpEval()
13438 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13439 if (ctxt->valueNr < op->value) { in xmlXPathCompOpEval()
13442 ctxt->error = XPATH_INVALID_OPERAND; in xmlXPathCompOpEval()
13443 xmlXPathPopFrame(ctxt, frame); in xmlXPathCompOpEval()
13447 if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) { in xmlXPathCompOpEval()
13450 ctxt->error = XPATH_INVALID_OPERAND; in xmlXPathCompOpEval()
13451 xmlXPathPopFrame(ctxt, frame); in xmlXPathCompOpEval()
13462 xmlXPathFunctionLookup(ctxt->context, in xmlXPathCompOpEval()
13465 URI = xmlXPathNsLookup(ctxt->context, op->value5); in xmlXPathCompOpEval()
13470 xmlXPathPopFrame(ctxt, frame); in xmlXPathCompOpEval()
13471 ctxt->error = XPATH_UNDEF_PREFIX_ERROR; in xmlXPathCompOpEval()
13474 func = xmlXPathFunctionLookupNS(ctxt->context, in xmlXPathCompOpEval()
13486 oldFunc = ctxt->context->function; in xmlXPathCompOpEval()
13487 oldFuncURI = ctxt->context->functionURI; in xmlXPathCompOpEval()
13488 ctxt->context->function = op->value4; in xmlXPathCompOpEval()
13489 ctxt->context->functionURI = op->cacheURI; in xmlXPathCompOpEval()
13490 func(ctxt, op->value); in xmlXPathCompOpEval()
13491 ctxt->context->function = oldFunc; in xmlXPathCompOpEval()
13492 ctxt->context->functionURI = oldFuncURI; in xmlXPathCompOpEval()
13493 xmlXPathPopFrame(ctxt, frame); in xmlXPathCompOpEval()
13497 bakd = ctxt->context->doc; in xmlXPathCompOpEval()
13498 bak = ctxt->context->node; in xmlXPathCompOpEval()
13499 pp = ctxt->context->proximityPosition; in xmlXPathCompOpEval()
13500 cs = ctxt->context->contextSize; in xmlXPathCompOpEval()
13502 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13503 ctxt->context->contextSize = cs; in xmlXPathCompOpEval()
13504 ctxt->context->proximityPosition = pp; in xmlXPathCompOpEval()
13505 ctxt->context->node = bak; in xmlXPathCompOpEval()
13506 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13509 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); in xmlXPathCompOpEval()
13510 ctxt->context->doc = bakd; in xmlXPathCompOpEval()
13511 ctxt->context->node = bak; in xmlXPathCompOpEval()
13553 xmlXPathCompOpEvalFirst(ctxt, in xmlXPathCompOpEval()
13561 if ((ctxt->value != NULL) && in xmlXPathCompOpEval()
13562 (ctxt->value->type == XPATH_NODESET) && in xmlXPathCompOpEval()
13563 (ctxt->value->nodesetval != NULL) && in xmlXPathCompOpEval()
13564 (ctxt->value->nodesetval->nodeNr > 1)) in xmlXPathCompOpEval()
13565 ctxt->value->nodesetval->nodeNr = 1; in xmlXPathCompOpEval()
13587 xmlXPathCompOpEvalLast(ctxt, in xmlXPathCompOpEval()
13595 if ((ctxt->value != NULL) && in xmlXPathCompOpEval()
13596 (ctxt->value->type == XPATH_NODESET) && in xmlXPathCompOpEval()
13597 (ctxt->value->nodesetval != NULL) && in xmlXPathCompOpEval()
13598 (ctxt->value->nodesetval->nodeTab != NULL) && in xmlXPathCompOpEval()
13599 (ctxt->value->nodesetval->nodeNr > 1)) { in xmlXPathCompOpEval()
13600 ctxt->value->nodesetval->nodeTab[0] = in xmlXPathCompOpEval()
13601 ctxt->value->nodesetval->nodeTab[ctxt-> in xmlXPathCompOpEval()
13606 ctxt->value->nodesetval->nodeNr = 1; in xmlXPathCompOpEval()
13624 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13628 if (ctxt->value == NULL) in xmlXPathCompOpEval()
13631 oldnode = ctxt->context->node; in xmlXPathCompOpEval()
13637 if (ctxt->value->type == XPATH_LOCATIONSET) { in xmlXPathCompOpEval()
13647 obj = valuePop(ctxt); in xmlXPathCompOpEval()
13649 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13652 ctxt->context->contextSize = 0; in xmlXPathCompOpEval()
13653 ctxt->context->proximityPosition = 0; in xmlXPathCompOpEval()
13656 xmlXPathCompOpEval(ctxt, in xmlXPathCompOpEval()
13658 res = valuePop(ctxt); in xmlXPathCompOpEval()
13660 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
13662 valuePush(ctxt, obj); in xmlXPathCompOpEval()
13673 ctxt->context->node = oldlocset->locTab[i]->user; in xmlXPathCompOpEval()
13674 ctxt->context->contextSize = oldlocset->locNr; in xmlXPathCompOpEval()
13675 ctxt->context->proximityPosition = i + 1; in xmlXPathCompOpEval()
13676 tmp = xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEval()
13677 ctxt->context->node); in xmlXPathCompOpEval()
13678 valuePush(ctxt, tmp); in xmlXPathCompOpEval()
13682 xmlXPathCompOpEval(ctxt, in xmlXPathCompOpEval()
13684 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompOpEval()
13693 res = valuePop(ctxt); in xmlXPathCompOpEval()
13694 if (xmlXPathEvaluatePredicateResult(ctxt, res)) { in xmlXPathCompOpEval()
13704 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
13706 if (ctxt->value == tmp) { in xmlXPathCompOpEval()
13707 res = valuePop(ctxt); in xmlXPathCompOpEval()
13708 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
13711 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13717 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathCompOpEval()
13718 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13719 ctxt->context->contextSize = -1; in xmlXPathCompOpEval()
13720 ctxt->context->proximityPosition = -1; in xmlXPathCompOpEval()
13721 valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset)); in xmlXPathCompOpEval()
13722 ctxt->context->node = oldnode; in xmlXPathCompOpEval()
13733 obj = valuePop(ctxt); in xmlXPathCompOpEval()
13736 oldnode = ctxt->context->node; in xmlXPathCompOpEval()
13737 oldDoc = ctxt->context->doc; in xmlXPathCompOpEval()
13738 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13741 ctxt->context->contextSize = 0; in xmlXPathCompOpEval()
13742 ctxt->context->proximityPosition = 0; in xmlXPathCompOpEval()
13753 valuePush(ctxt, obj); in xmlXPathCompOpEval()
13754 ctxt->context->node = oldnode; in xmlXPathCompOpEval()
13795 ctxt->context->node = oldset->nodeTab[i]; in xmlXPathCompOpEval()
13798 ctxt->context->doc = oldset->nodeTab[i]->doc; in xmlXPathCompOpEval()
13800 tmp = xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEval()
13801 ctxt->context->node); in xmlXPathCompOpEval()
13804 ctxt->context->node); in xmlXPathCompOpEval()
13806 valuePush(ctxt, tmp); in xmlXPathCompOpEval()
13807 ctxt->context->contextSize = oldset->nodeNr; in xmlXPathCompOpEval()
13808 ctxt->context->proximityPosition = i + 1; in xmlXPathCompOpEval()
13816 xmlXPathCompOpEval(ctxt, in xmlXPathCompOpEval()
13818 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompOpEval()
13832 res = valuePop(ctxt); in xmlXPathCompOpEval()
13833 if (xmlXPathEvaluatePredicateResult(ctxt, res)) { in xmlXPathCompOpEval()
13841 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
13843 if (ctxt->value == tmp) { in xmlXPathCompOpEval()
13844 valuePop(ctxt); in xmlXPathCompOpEval()
13853 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13856 xmlXPathReleaseObject(ctxt->context, tmp); in xmlXPathCompOpEval()
13860 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathCompOpEval()
13861 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13862 ctxt->context->contextSize = -1; in xmlXPathCompOpEval()
13863 ctxt->context->proximityPosition = -1; in xmlXPathCompOpEval()
13865 ctxt->context->doc = oldDoc; in xmlXPathCompOpEval()
13866 valuePush(ctxt, in xmlXPathCompOpEval()
13867 xmlXPathCacheWrapNodeSet(ctxt->context, newset)); in xmlXPathCompOpEval()
13869 ctxt->context->node = oldnode; in xmlXPathCompOpEval()
13874 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13876 if ((ctxt->value != NULL) && in xmlXPathCompOpEval()
13877 (ctxt->value->type == XPATH_NODESET) && in xmlXPathCompOpEval()
13878 (ctxt->value->nodesetval != NULL) && in xmlXPathCompOpEval()
13879 (ctxt->value->nodesetval->nodeNr > 1)) in xmlXPathCompOpEval()
13881 xmlXPathNodeSetSort(ctxt->value->nodesetval); in xmlXPathCompOpEval()
13896 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); in xmlXPathCompOpEval()
13900 if (ctxt->value->type == XPATH_LOCATIONSET) { in xmlXPathCompOpEval()
13907 obj = valuePop(ctxt); in xmlXPathCompOpEval()
13911 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13912 ctxt->context->contextSize = 0; in xmlXPathCompOpEval()
13913 ctxt->context->proximityPosition = 0; in xmlXPathCompOpEval()
13914 total += xmlXPathCompOpEval(ctxt,&comp->steps[op->ch2]); in xmlXPathCompOpEval()
13915 res = valuePop(ctxt); in xmlXPathCompOpEval()
13917 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
13919 valuePush(ctxt, obj); in xmlXPathCompOpEval()
13930 ctxt->context->node = oldlocset->locTab[i]->user; in xmlXPathCompOpEval()
13931 ctxt->context->contextSize = oldlocset->locNr; in xmlXPathCompOpEval()
13932 ctxt->context->proximityPosition = i + 1; in xmlXPathCompOpEval()
13933 tmp = xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEval()
13934 ctxt->context->node); in xmlXPathCompOpEval()
13935 valuePush(ctxt, tmp); in xmlXPathCompOpEval()
13939 xmlXPathCompOpEval(ctxt, in xmlXPathCompOpEval()
13941 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompOpEval()
13946 res = valuePop(ctxt); in xmlXPathCompOpEval()
13972 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
13974 if (ctxt->value == tmp) { in xmlXPathCompOpEval()
13975 res = valuePop(ctxt); in xmlXPathCompOpEval()
13976 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
13979 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13983 obj = valuePop(ctxt); in xmlXPathCompOpEval()
13985 ctxt->context->node = NULL; in xmlXPathCompOpEval()
13995 ctxt->context->node = oldset->nodeTab[i]; in xmlXPathCompOpEval()
13999 tmp = xmlXPathCacheNewNodeSet(ctxt->context, in xmlXPathCompOpEval()
14000 ctxt->context->node); in xmlXPathCompOpEval()
14001 valuePush(ctxt, tmp); in xmlXPathCompOpEval()
14005 xmlXPathCompOpEval(ctxt, in xmlXPathCompOpEval()
14007 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathCompOpEval()
14012 res = valuePop(ctxt); in xmlXPathCompOpEval()
14024 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
14026 if (ctxt->value == tmp) { in xmlXPathCompOpEval()
14027 res = valuePop(ctxt); in xmlXPathCompOpEval()
14028 xmlXPathReleaseObject(ctxt->context, res); in xmlXPathCompOpEval()
14031 ctxt->context->node = NULL; in xmlXPathCompOpEval()
14039 xmlXPathReleaseObject(ctxt->context, obj); in xmlXPathCompOpEval()
14040 ctxt->context->node = NULL; in xmlXPathCompOpEval()
14041 ctxt->context->contextSize = -1; in xmlXPathCompOpEval()
14042 ctxt->context->proximityPosition = -1; in xmlXPathCompOpEval()
14043 valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset)); in xmlXPathCompOpEval()
14050 ctxt->error = XPATH_INVALID_OPERAND; in xmlXPathCompOpEval()
14063 xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt, in xmlXPathCompOpEvalToBoolean() argument
14077 return(xmlXPathEvaluatePredicateResult(ctxt, resObj)); in xmlXPathCompOpEvalToBoolean()
14084 op = &ctxt->comp->steps[op->ch1]; in xmlXPathCompOpEvalToBoolean()
14092 xmlXPathCompOpEval(ctxt, &ctxt->comp->steps[op->ch1]); in xmlXPathCompOpEvalToBoolean()
14093 if (ctxt->error != XPATH_EXPRESSION_OK) in xmlXPathCompOpEvalToBoolean()
14096 xmlXPathNodeCollectAndTest(ctxt, op, NULL, NULL, 1); in xmlXPathCompOpEvalToBoolean()
14097 if (ctxt->error != XPATH_EXPRESSION_OK) in xmlXPathCompOpEvalToBoolean()
14100 resObj = valuePop(ctxt); in xmlXPathCompOpEvalToBoolean()
14108 xmlXPathCompOpEval(ctxt, op); in xmlXPathCompOpEvalToBoolean()
14109 if (ctxt->error != XPATH_EXPRESSION_OK) in xmlXPathCompOpEvalToBoolean()
14112 resObj = valuePop(ctxt); in xmlXPathCompOpEvalToBoolean()
14132 res = xmlXPathEvaluatePredicateResult(ctxt, resObj); in xmlXPathCompOpEvalToBoolean()
14136 xmlXPathReleaseObject(ctxt->context, resObj); in xmlXPathCompOpEvalToBoolean()
14151 xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp, in xmlXPathRunStreamEval() argument
14163 if ((ctxt == NULL) || (comp == NULL)) in xmlXPathRunStreamEval()
14183 *resultSeq = xmlXPathCacheNewNodeSet(ctxt, NULL); in xmlXPathRunStreamEval()
14197 (xmlNodePtr) ctxt->doc); in xmlXPathRunStreamEval()
14202 xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, ctxt->node); in xmlXPathRunStreamEval()
14210 cur = (xmlNodePtr)ctxt->doc; in xmlXPathRunStreamEval()
14211 } else if (ctxt->node != NULL) { in xmlXPathRunStreamEval()
14212 switch (ctxt->node->type) { in xmlXPathRunStreamEval()
14220 cur = ctxt->node; in xmlXPathRunStreamEval()
14380 xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) in xmlXPathRunEval() argument
14384 if ((ctxt == NULL) || (ctxt->comp == NULL)) in xmlXPathRunEval()
14387 if (ctxt->valueTab == NULL) { in xmlXPathRunEval()
14389 ctxt->valueTab = (xmlXPathObjectPtr *) in xmlXPathRunEval()
14391 if (ctxt->valueTab == NULL) { in xmlXPathRunEval()
14392 xmlXPathPErrMemory(ctxt, "creating evaluation context\n"); in xmlXPathRunEval()
14393 xmlFree(ctxt); in xmlXPathRunEval()
14395 ctxt->valueNr = 0; in xmlXPathRunEval()
14396 ctxt->valueMax = 10; in xmlXPathRunEval()
14397 ctxt->value = NULL; in xmlXPathRunEval()
14398 ctxt->valueFrame = 0; in xmlXPathRunEval()
14401 if (ctxt->comp->stream) { in xmlXPathRunEval()
14408 res = xmlXPathRunStreamEval(ctxt->context, in xmlXPathRunEval()
14409 ctxt->comp->stream, NULL, 1); in xmlXPathRunEval()
14418 res = xmlXPathRunStreamEval(ctxt->context, in xmlXPathRunEval()
14419 ctxt->comp->stream, &resObj, 0); in xmlXPathRunEval()
14422 valuePush(ctxt, resObj); in xmlXPathRunEval()
14426 xmlXPathReleaseObject(ctxt->context, resObj); in xmlXPathRunEval()
14434 comp = ctxt->comp; in xmlXPathRunEval()
14441 return(xmlXPathCompOpEvalToBoolean(ctxt, in xmlXPathRunEval()
14444 xmlXPathCompOpEval(ctxt, &comp->steps[comp->last]); in xmlXPathRunEval()
14472 xmlXPathEvalPredicate(xmlXPathContextPtr ctxt, xmlXPathObjectPtr res) { in xmlXPathEvalPredicate() argument
14473 if ((ctxt == NULL) || (res == NULL)) return(0); in xmlXPathEvalPredicate()
14478 return(res->floatval == ctxt->proximityPosition); in xmlXPathEvalPredicate()
14510 xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, in xmlXPathEvaluatePredicateResult() argument
14512 if ((ctxt == NULL) || (res == NULL)) return(0); in xmlXPathEvaluatePredicateResult()
14518 return((res->floatval == ctxt->context->proximityPosition) && in xmlXPathEvaluatePredicateResult()
14521 return(res->floatval == ctxt->context->proximityPosition); in xmlXPathEvaluatePredicateResult()
14555 xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { in xmlXPathTryStreamCompile() argument
14582 ((ctxt == NULL) || (ctxt->nsNr == 0) || (tmp[1] == ':'))) in xmlXPathTryStreamCompile()
14585 if (ctxt != NULL) { in xmlXPathTryStreamCompile()
14586 dict = ctxt->dict; in xmlXPathTryStreamCompile()
14587 if (ctxt->nsNr > 0) { in xmlXPathTryStreamCompile()
14588 namespaces = xmlMalloc(2 * (ctxt->nsNr + 1) * sizeof(xmlChar*)); in xmlXPathTryStreamCompile()
14590 xmlXPathErrMemory(ctxt, "allocating namespaces array\n"); in xmlXPathTryStreamCompile()
14593 for (i = 0, j = 0; (j < ctxt->nsNr); j++) { in xmlXPathTryStreamCompile()
14594 ns = ctxt->namespaces[j]; in xmlXPathTryStreamCompile()
14611 xmlXPathErrMemory(ctxt, "allocating streamable expression\n"); in xmlXPathTryStreamCompile()
14690 xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { in xmlXPathCtxtCompile() argument
14695 comp = xmlXPathTryStreamCompile(ctxt, str); in xmlXPathCtxtCompile()
14702 pctxt = xmlXPathNewParserContext(str, ctxt); in xmlXPathCtxtCompile()
14774 xmlXPathContextPtr ctxt, in xmlXPathCompiledEvalInternal() argument
14784 CHECK_CTXT_NEG(ctxt) in xmlXPathCompiledEvalInternal()
14803 pctxt = xmlXPathCompParserContext(comp, ctxt); in xmlXPathCompiledEvalInternal()
14827 xmlXPathReleaseObject(ctxt, tmp); in xmlXPathCompiledEvalInternal()
14884 xmlXPathContextPtr ctxt) in xmlXPathCompiledEvalToBoolean() argument
14886 return(xmlXPathCompiledEvalInternal(comp, ctxt, NULL, 1)); in xmlXPathCompiledEvalToBoolean()
14897 xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { in xmlXPathEvalExpr() argument
14902 if (ctxt == NULL) return; in xmlXPathEvalExpr()
14905 comp = xmlXPathTryStreamCompile(ctxt->context, ctxt->base); in xmlXPathEvalExpr()
14907 if (ctxt->comp != NULL) in xmlXPathEvalExpr()
14908 xmlXPathFreeCompExpr(ctxt->comp); in xmlXPathEvalExpr()
14909 ctxt->comp = comp; in xmlXPathEvalExpr()
14910 if (ctxt->cur != NULL) in xmlXPathEvalExpr()
14911 while (*ctxt->cur != 0) ctxt->cur++; in xmlXPathEvalExpr()
14915 xmlXPathCompileExpr(ctxt, 1); in xmlXPathEvalExpr()
14919 if ((ctxt->error == XPATH_EXPRESSION_OK) && in xmlXPathEvalExpr()
14920 (ctxt->comp != NULL) && in xmlXPathEvalExpr()
14921 (ctxt->base != NULL) && in xmlXPathEvalExpr()
14922 (ctxt->comp->nbStep > 2) && in xmlXPathEvalExpr()
14923 (ctxt->comp->last >= 0) && in xmlXPathEvalExpr()
14924 (xmlXPathCanRewriteDosExpression((xmlChar *) ctxt->base) == 1)) in xmlXPathEvalExpr()
14926 xmlXPathRewriteDOSExpression(ctxt->comp, in xmlXPathEvalExpr()
14927 &ctxt->comp->steps[ctxt->comp->last]); in xmlXPathEvalExpr()
14931 xmlXPathRunEval(ctxt, 0); in xmlXPathEvalExpr()
14946 xmlXPathParserContextPtr ctxt; in xmlXPathEval() local
14954 ctxt = xmlXPathNewParserContext(str, ctx); in xmlXPathEval()
14955 if (ctxt == NULL) in xmlXPathEval()
14957 xmlXPathEvalExpr(ctxt); in xmlXPathEval()
14959 if (ctxt->value == NULL) { in xmlXPathEval()
14963 } else if ((*ctxt->cur != 0) && (ctxt->comp != NULL) in xmlXPathEval()
14965 && (ctxt->comp->stream == NULL) in xmlXPathEval()
14968 xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR); in xmlXPathEval()
14971 res = valuePop(ctxt); in xmlXPathEval()
14975 tmp = valuePop(ctxt); in xmlXPathEval()
14987 if (ctxt->error != XPATH_EXPRESSION_OK) { in xmlXPathEval()
14992 xmlXPathFreeParserContext(ctxt); in xmlXPathEval()
15007 xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) { in xmlXPathEvalExpression() argument
15012 CHECK_CTXT(ctxt) in xmlXPathEvalExpression()
15016 pctxt = xmlXPathNewParserContext(str, ctxt); in xmlXPathEvalExpression()
15030 xmlXPathReleaseObject(ctxt, tmp); in xmlXPathEvalExpression()
15097 xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) { in xmlXPathEscapeUriFunction() argument
15106 escape_reserved = xmlXPathPopBoolean(ctxt); in xmlXPathEscapeUriFunction()
15109 str = valuePop(ctxt); in xmlXPathEscapeUriFunction()
15151 valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, in xmlXPathEscapeUriFunction()
15154 xmlXPathReleaseObject(ctxt->context, str); in xmlXPathEscapeUriFunction()
15164 xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt) in xmlXPathRegisterAllFunctions() argument
15166 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"boolean", in xmlXPathRegisterAllFunctions()
15168 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"ceiling", in xmlXPathRegisterAllFunctions()
15170 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"count", in xmlXPathRegisterAllFunctions()
15172 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"concat", in xmlXPathRegisterAllFunctions()
15174 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"contains", in xmlXPathRegisterAllFunctions()
15176 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"id", in xmlXPathRegisterAllFunctions()
15178 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"false", in xmlXPathRegisterAllFunctions()
15180 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"floor", in xmlXPathRegisterAllFunctions()
15182 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"last", in xmlXPathRegisterAllFunctions()
15184 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"lang", in xmlXPathRegisterAllFunctions()
15186 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"local-name", in xmlXPathRegisterAllFunctions()
15188 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"not", in xmlXPathRegisterAllFunctions()
15190 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"name", in xmlXPathRegisterAllFunctions()
15192 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"namespace-uri", in xmlXPathRegisterAllFunctions()
15194 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"normalize-space", in xmlXPathRegisterAllFunctions()
15196 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"number", in xmlXPathRegisterAllFunctions()
15198 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"position", in xmlXPathRegisterAllFunctions()
15200 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"round", in xmlXPathRegisterAllFunctions()
15202 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string", in xmlXPathRegisterAllFunctions()
15204 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string-length", in xmlXPathRegisterAllFunctions()
15206 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"starts-with", in xmlXPathRegisterAllFunctions()
15208 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring", in xmlXPathRegisterAllFunctions()
15210 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-before", in xmlXPathRegisterAllFunctions()
15212 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-after", in xmlXPathRegisterAllFunctions()
15214 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"sum", in xmlXPathRegisterAllFunctions()
15216 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"true", in xmlXPathRegisterAllFunctions()
15218 xmlXPathRegisterFunc(ctxt, (const xmlChar *)"translate", in xmlXPathRegisterAllFunctions()
15221 xmlXPathRegisterFuncNS(ctxt, (const xmlChar *)"escape-uri", in xmlXPathRegisterAllFunctions()