Lines Matching defs:comp
649 * @comp: an XPATH comp
651 * Free up the memory allocated by @comp
654 xmlXPathFreeCompExpr(xmlXPathCompExprPtr comp)
659 if (comp == NULL)
661 if (comp->dict == NULL) {
662 for (i = 0; i < comp->nbStep; i++) {
663 op = &comp->steps[i];
674 for (i = 0; i < comp->nbStep; i++) {
675 op = &comp->steps[i];
681 xmlDictFree(comp->dict);
683 if (comp->steps != NULL) {
684 xmlFree(comp->steps);
687 if (comp->string != NULL) {
688 xmlFree(comp->string);
692 if (comp->stream != NULL) {
693 xmlFreePatternList(comp->stream);
696 if (comp->expr != NULL) {
697 xmlFree(comp->expr);
700 xmlFree(comp);
705 * @comp: the compiled expression
720 xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2,
723 if (comp->nbStep >= comp->maxStep) {
726 comp->maxStep *= 2;
727 real = (xmlXPathStepOp *) xmlRealloc(comp->steps,
728 comp->maxStep * sizeof(xmlXPathStepOp));
730 comp->maxStep /= 2;
734 comp->steps = real;
736 comp->last = comp->nbStep;
737 comp->steps[comp->nbStep].rewriteType = 0;
738 comp->steps[comp->nbStep].ch1 = ch1;
739 comp->steps[comp->nbStep].ch2 = ch2;
740 comp->steps[comp->nbStep].op = op;
741 comp->steps[comp->nbStep].value = value;
742 comp->steps[comp->nbStep].value2 = value2;
743 comp->steps[comp->nbStep].value3 = value3;
744 if ((comp->dict != NULL) &&
748 comp->steps[comp->nbStep].value4 = (xmlChar *)
749 (void *)xmlDictLookup(comp->dict, value4, -1);
752 comp->steps[comp->nbStep].value4 = NULL;
754 comp->steps[comp->nbStep].value5 = (xmlChar *)
755 (void *)xmlDictLookup(comp->dict, value5, -1);
758 comp->steps[comp->nbStep].value5 = NULL;
760 comp->steps[comp->nbStep].value4 = value4;
761 comp->steps[comp->nbStep].value5 = value5;
763 comp->steps[comp->nbStep].cache = NULL;
764 return(comp->nbStep++);
769 * @comp: the compiled expression
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), \
1106 xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
1277 xmlXPathDebugDumpStepOp(output, comp, &comp->steps[op->ch1], depth + 1);
1279 xmlXPathDebugDumpStepOp(output, comp, &comp->steps[op->ch2], depth + 1);
1285 * @comp: the precompiled XPath expression
1291 xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
1296 if ((output == NULL) || (comp == NULL)) return;
1305 comp->nbStep);
1306 i = comp->last;
1307 xmlXPathDebugDumpStepOp(output, comp, &comp->steps[i], depth + 1);
6137 ret->comp = xmlXPathNewCompExpr();
6138 if (ret->comp == NULL) {
6144 ret->comp->dict = ctxt->dict;
6145 xmlDictReference(ret->comp->dict);
6153 * @comp: the XPath compiled expression
6161 xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
6185 ret->comp = comp;
6201 if (ctxt->comp != NULL) {
6203 if (ctxt->comp->stream != NULL) {
6204 xmlFreePatternList(ctxt->comp->stream);
6205 ctxt->comp->stream = NULL;
6208 xmlXPathFreeCompExpr(ctxt->comp);
10256 ctxt->comp->last = -1;
10339 ctxt->comp->last = -1;
10342 int op1 = ctxt->comp->last;
10343 ctxt->comp->last = -1;
10346 PUSH_BINARY_EXPR(XPATH_OP_ARG, op1, ctxt->comp->last, 0, 0);
10625 PUSH_UNARY_EXPR(XPATH_OP_RESET, ctxt->comp->last, 1, 0);
10651 int op1 = ctxt->comp->last;
10658 PUSH_BINARY_EXPR(XPATH_OP_UNION, op1, ctxt->comp->last, 0, 0);
10691 PUSH_UNARY_EXPR(XPATH_OP_PLUS, ctxt->comp->last, 2, 0);
10693 PUSH_UNARY_EXPR(XPATH_OP_PLUS, ctxt->comp->last, 3, 0);
10719 int op1 = ctxt->comp->last;
10734 PUSH_BINARY_EXPR(XPATH_OP_MULT, op1, ctxt->comp->last, op, 0);
10758 int op1 = ctxt->comp->last;
10766 PUSH_BINARY_EXPR(XPATH_OP_PLUS, op1, ctxt->comp->last, plus, 0);
10799 int op1 = ctxt->comp->last;
10810 PUSH_BINARY_EXPR(XPATH_OP_CMP, op1, ctxt->comp->last, inf, strict);
10838 int op1 = ctxt->comp->last;
10847 PUSH_BINARY_EXPR(XPATH_OP_EQUAL, op1, ctxt->comp->last, eq, 0);
10868 int op1 = ctxt->comp->last;
10873 PUSH_BINARY_EXPR(XPATH_OP_AND, op1, ctxt->comp->last, 0, 0);
10894 int op1 = ctxt->comp->last;
10899 PUSH_BINARY_EXPR(XPATH_OP_OR, op1, ctxt->comp->last, 0, 0);
10900 op1 = ctxt->comp->nbStep;
10903 if ((sort) && (ctxt->comp->steps[ctxt->comp->last].op != XPATH_OP_VALUE)) {
10910 PUSH_UNARY_EXPR(XPATH_OP_SORT, ctxt->comp->last , 0, 0);
10926 int op1 = ctxt->comp->last;
10935 ctxt->comp->last = -1;
10956 PUSH_BINARY_EXPR(XPATH_OP_FILTER, op1, ctxt->comp->last, 0, 0);
10958 PUSH_BINARY_EXPR(XPATH_OP_PREDICATE, op1, ctxt->comp->last, 0, 0);
11231 op2 = ctxt->comp->last;
11241 /* PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, ctxt->comp->last, 0, 0); */
11312 op1 = ctxt->comp->last;
11313 ctxt->comp->last = -1;
11325 PUSH_FULL_EXPR(XPATH_OP_COLLECT, op1, ctxt->comp->last, axis,
11534 xmlXPathCompExprPtr comp = ctxt->comp;
11538 if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) {
11544 &comp->steps[op->ch1], set, contextSize, hasNsNodes);
11592 exprOp = &ctxt->comp->steps[op->ch2];
11688 xmlXPathCompExprPtr comp = ctxt->comp;
11689 if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) {
11695 &comp->steps[op->ch1], set, contextSize, hasNsNodes);
11738 exprOp = &ctxt->comp->steps[op->ch2];
11899 exprOp = &ctxt->comp->steps[op->ch2];
12144 predOp = &ctxt->comp->steps[op->ch2];
12150 predOp = &ctxt->comp->steps[predOp->ch1];
12597 xmlXPathCompExprPtr comp;
12601 comp = ctxt->comp;
12607 xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch1],
12629 xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch2],
12651 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
12654 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
12661 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
12664 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
12672 total = xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
12686 xmlXPathCompOpEvalFirst(ctxt, &comp->steps[op->ch1],
12721 xmlXPathCompExprPtr comp;
12729 comp = ctxt->comp;
12739 xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], last);
12760 xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch2], last);
12786 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
12789 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
12796 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
12799 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
12807 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
12821 xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1],
12841 xmlXPathCompExprPtr comp;
12850 comp = ctxt->comp;
12855 (comp->steps[op->ch1].op == XPATH_OP_SORT) &&
12856 (comp->steps[op->ch2].op == XPATH_OP_SORT)) {
12857 int f = comp->steps[op->ch2].ch1;
12860 (comp->steps[f].op == XPATH_OP_FUNCTION) &&
12861 (comp->steps[f].value5 == NULL) &&
12862 (comp->steps[f].value == 0) &&
12863 (comp->steps[f].value4 != NULL) &&
12865 (comp->steps[f].value4, BAD_CAST "last"))) {
12870 &comp->steps[op->ch1],
12896 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
12927 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
12955 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13031 &comp->steps[op->ch2]);
13070 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13141 xmlXPathCompExprPtr comp;
13149 comp = ctxt->comp;
13158 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13168 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13184 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13194 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13210 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13216 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13229 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13235 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13245 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13252 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13271 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13277 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13291 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13297 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13321 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13324 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13331 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13334 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13342 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13358 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13396 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13459 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13466 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);
13496 ((comp->steps[op->ch1].op == XPATH_OP_SORT) || /* 18 */
13497 (comp->steps[op->ch1].op == XPATH_OP_FILTER)) && /* 17 */
13499 (comp->steps[op->ch1].op == XPATH_OP_SORT) &&
13501 (comp->steps[op->ch2].op == XPATH_OP_VALUE)) { /* 12 */
13504 val = comp->steps[op->ch2].value4;
13511 &comp->steps[op->ch1],
13530 (comp->steps[op->ch1].op == XPATH_OP_SORT) &&
13531 (comp->steps[op->ch2].op == XPATH_OP_SORT)) {
13532 int f = comp->steps[op->ch2].ch1;
13535 (comp->steps[f].op == XPATH_OP_FUNCTION) &&
13536 (comp->steps[f].value5 == NULL) &&
13537 (comp->steps[f].value == 0) &&
13538 (comp->steps[f].value4 != NULL) &&
13540 (comp->steps[f].value4, BAD_CAST "last"))) {
13545 &comp->steps[op->ch1],
13581 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13614 &comp->steps[op->ch2]);
13640 &comp->steps[op->ch2]);
13704 &comp->steps[op->ch2]);
13774 &comp->steps[op->ch2]);
13831 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13853 xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
13871 total += xmlXPathCompOpEval(ctxt,&comp->steps[op->ch2]);
13897 &comp->steps[op->ch2]);
13963 &comp->steps[op->ch2]);
14027 /* comp = ctxt->comp; */
14041 op = &ctxt->comp->steps[op->ch1];
14049 xmlXPathCompOpEval(ctxt, &ctxt->comp->steps[op->ch1]);
14108 xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp,
14120 if ((ctxt == NULL) || (comp == NULL))
14122 max_depth = xmlPatternMaxDepth(comp);
14127 min_depth = xmlPatternMinDepth(comp);
14130 from_root = xmlPatternFromRoot(comp);
14203 patstream = xmlPatternGetStreamCtxt(comp);
14339 xmlXPathCompExprPtr comp;
14341 if ((ctxt == NULL) || (ctxt->comp == NULL))
14358 if (ctxt->comp->stream) {
14366 ctxt->comp->stream, NULL, 1);
14376 ctxt->comp->stream, &resObj, 0);
14391 comp = ctxt->comp;
14392 if (comp->last < 0) {
14399 &comp->steps[comp->last], 0));
14401 xmlXPathCompOpEval(ctxt, &comp->steps[comp->last]);
14518 xmlXPathCompExprPtr comp;
14566 comp = xmlXPathNewCompExpr();
14567 if (comp == NULL) {
14571 comp->stream = stream;
14572 comp->dict = dict;
14573 if (comp->dict)
14574 xmlDictReference(comp->dict);
14575 return(comp);
14595 xmlXPathRewriteDOSExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
14610 xmlXPathStepOpPtr prevop = &comp->steps[op->ch1];
14619 (comp->steps[prevop->ch1].op == XPATH_OP_ROOT))
14630 xmlXPathRewriteDOSExpression(comp, &comp->steps[op->ch1]);
14633 xmlXPathRewriteDOSExpression(comp, &comp->steps[op->ch2]);
14649 xmlXPathCompExprPtr comp;
14652 comp = xmlXPathTryStreamCompile(ctxt, str);
14653 if (comp != NULL)
14654 return(comp);
14678 comp = NULL;
14680 comp = pctxt->comp;
14681 pctxt->comp = NULL;
14685 if (comp != NULL) {
14686 comp->expr = xmlStrdup(str);
14688 comp->string = xmlStrdup(str);
14689 comp->nb = 0;
14691 if ((comp->expr != NULL) &&
14692 (comp->nbStep > 2) &&
14693 (comp->last >= 0) &&
14694 (xmlXPathCanRewriteDosExpression(comp->expr) == 1))
14696 xmlXPathRewriteDOSExpression(comp, &comp->steps[comp->last]);
14699 return(comp);
14718 * @comp: the compiled XPath expression
14730 xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp,
14743 if (comp == NULL)
14754 comp->nb++;
14755 if ((comp->string != NULL) && (comp->nb > 100)) {
14756 fprintf(stderr, "100 x %s\n", comp->string);
14757 comp->nb = 0;
14760 pctxt = xmlXPathCompParserContext(comp, ctxt);
14800 pctxt->comp = NULL;
14811 * @comp: the compiled XPath expression
14820 xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx)
14824 xmlXPathCompiledEvalInternal(comp, ctx, &res, 0);
14830 * @comp: the compiled XPath expression
14840 xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
14843 return(xmlXPathCompiledEvalInternal(comp, ctxt, NULL, 1));
14856 xmlXPathCompExprPtr comp;
14862 comp = xmlXPathTryStreamCompile(ctxt->context, ctxt->base);
14863 if (comp != NULL) {
14864 if (ctxt->comp != NULL)
14865 xmlXPathFreeCompExpr(ctxt->comp);
14866 ctxt->comp = comp;
14877 (ctxt->comp != NULL) &&
14879 (ctxt->comp->nbStep > 2) &&
14880 (ctxt->comp->last >= 0) &&
14883 xmlXPathRewriteDOSExpression(ctxt->comp,
14884 &ctxt->comp->steps[ctxt->comp->last]);
14920 } else if ((*ctxt->cur != 0) && (ctxt->comp != NULL)
14922 && (ctxt->comp->stream == NULL)