MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathCompOpEval

Function xmlXPathCompOpEval

ThirdParty/libxml2/vtklibxml2/xpath.c:11793–12357  ·  view source on GitHub ↗

* xmlXPathCompOpEval: * @ctxt: the XPath parser context with the compiled expression * @op: an XPath compiled operation * * Evaluate the Precompiled XPath operation * Returns the number of nodes traversed */

Source from the content-addressed store, hash-verified

11791 * Returns the number of nodes traversed
11792 */
11793static int
11794xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
11795{
11796 int total = 0;
11797 int equal, ret;
11798 xmlXPathCompExprPtr comp;
11799 xmlXPathObjectPtr arg1, arg2;
11800
11801 CHECK_ERROR0;
11802 if (OP_LIMIT_EXCEEDED(ctxt, 1))
11803 return(0);
11804 if (ctxt->context->depth >= XPATH_MAX_RECURSION_DEPTH)
11805 XP_ERROR0(XPATH_RECURSION_LIMIT_EXCEEDED);
11806 ctxt->context->depth += 1;
11807 comp = ctxt->comp;
11808 switch (op->op) {
11809 case XPATH_OP_END:
11810 break;
11811 case XPATH_OP_AND:
11812 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
11813 CHECK_ERROR0;
11814 xmlXPathBooleanFunction(ctxt, 1);
11815 if ((ctxt->value == NULL) || (ctxt->value->boolval == 0))
11816 break;
11817 arg2 = valuePop(ctxt);
11818 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
11819 if (ctxt->error) {
11820 xmlXPathFreeObject(arg2);
11821 break;
11822 }
11823 xmlXPathBooleanFunction(ctxt, 1);
11824 if (ctxt->value != NULL)
11825 ctxt->value->boolval &= arg2->boolval;
11826 xmlXPathReleaseObject(ctxt->context, arg2);
11827 break;
11828 case XPATH_OP_OR:
11829 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
11830 CHECK_ERROR0;
11831 xmlXPathBooleanFunction(ctxt, 1);
11832 if ((ctxt->value == NULL) || (ctxt->value->boolval == 1))
11833 break;
11834 arg2 = valuePop(ctxt);
11835 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
11836 if (ctxt->error) {
11837 xmlXPathFreeObject(arg2);
11838 break;
11839 }
11840 xmlXPathBooleanFunction(ctxt, 1);
11841 if (ctxt->value != NULL)
11842 ctxt->value->boolval |= arg2->boolval;
11843 xmlXPathReleaseObject(ctxt->context, arg2);
11844 break;
11845 case XPATH_OP_EQUAL:
11846 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
11847 CHECK_ERROR0;
11848 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
11849 CHECK_ERROR0;
11850 if (op->value)

Callers 5

xmlXPathCompOpEvalFirstFunction · 0.85
xmlXPathCompOpEvalLastFunction · 0.85
xmlXPathRunEvalFunction · 0.85

Calls 15

xmlXPathBooleanFunctionFunction · 0.85
valuePopFunction · 0.85
xmlXPathFreeObjectFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85
xmlXPathEqualValuesFunction · 0.85
xmlXPathNotEqualValuesFunction · 0.85
valuePushFunction · 0.85
xmlXPathCacheNewBooleanFunction · 0.85
xmlXPathCompareValuesFunction · 0.85
xmlXPathSubValuesFunction · 0.85
xmlXPathAddValuesFunction · 0.85
xmlXPathValueFlipSignFunction · 0.85

Tested by

no test coverage detected