Lines Matching refs:comp
83 if ((c)->comp->dict) \
84 r = (xmlChar *) xmlDictLookup((c)->comp->dict, BAD_CAST nsname, -1); \
87 #define XML_PAT_FREE_STRING(c, r) if ((c)->comp->dict == NULL) xmlFree(r);
110 xmlStreamCompPtr comp; /* the compiled stream */ member
119 static void xmlFreeStreamComp(xmlStreamCompPtr comp);
183 xmlPatternPtr comp; /* the result */ member
231 xmlFreePattern(xmlPatternPtr comp) { in xmlFreePattern() argument
232 xmlFreePatternList(comp); in xmlFreePattern()
236 xmlFreePatternInternal(xmlPatternPtr comp) { in xmlFreePatternInternal() argument
240 if (comp == NULL) in xmlFreePatternInternal()
242 if (comp->stream != NULL) in xmlFreePatternInternal()
243 xmlFreeStreamComp(comp->stream); in xmlFreePatternInternal()
244 if (comp->pattern != NULL) in xmlFreePatternInternal()
245 xmlFree((xmlChar *)comp->pattern); in xmlFreePatternInternal()
246 if (comp->steps != NULL) { in xmlFreePatternInternal()
247 if (comp->dict == NULL) { in xmlFreePatternInternal()
248 for (i = 0;i < comp->nbStep;i++) { in xmlFreePatternInternal()
249 op = &comp->steps[i]; in xmlFreePatternInternal()
256 xmlFree(comp->steps); in xmlFreePatternInternal()
258 if (comp->dict != NULL) in xmlFreePatternInternal()
259 xmlDictFree(comp->dict); in xmlFreePatternInternal()
261 memset(comp, -1, sizeof(xmlPattern)); in xmlFreePatternInternal()
262 xmlFree(comp); in xmlFreePatternInternal()
272 xmlFreePatternList(xmlPatternPtr comp) { in xmlFreePatternList() argument
275 while (comp != NULL) { in xmlFreePatternList()
276 cur = comp; in xmlFreePatternList()
277 comp = comp->next; in xmlFreePatternList()
351 xmlPatternPtr comp, in xmlPatternAdd() argument
354 if (comp->nbStep >= comp->maxStep) { in xmlPatternAdd()
356 temp = (xmlStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 * in xmlPatternAdd()
363 comp->steps = temp; in xmlPatternAdd()
364 comp->maxStep *= 2; in xmlPatternAdd()
366 comp->steps[comp->nbStep].op = op; in xmlPatternAdd()
367 comp->steps[comp->nbStep].value = value; in xmlPatternAdd()
368 comp->steps[comp->nbStep].value2 = value2; in xmlPatternAdd()
369 comp->nbStep++; in xmlPatternAdd()
381 xsltSwapTopPattern(xmlPatternPtr comp) {
383 int j = comp->nbStep - 1;
389 tmp = comp->steps[i].value;
390 comp->steps[i].value = comp->steps[j].value;
391 comp->steps[j].value = tmp;
392 tmp = comp->steps[i].value2;
393 comp->steps[i].value2 = comp->steps[j].value2;
394 comp->steps[j].value2 = tmp;
395 op = comp->steps[i].op;
396 comp->steps[i].op = comp->steps[j].op;
397 comp->steps[j].op = op;
411 xmlReversePattern(xmlPatternPtr comp) { in xmlReversePattern() argument
417 if ((comp->nbStep > 0) && (comp->steps[0].op == XML_OP_ANCESTOR)) { in xmlReversePattern()
418 for (i = 0, j = 1;j < comp->nbStep;i++,j++) { in xmlReversePattern()
419 comp->steps[i].value = comp->steps[j].value; in xmlReversePattern()
420 comp->steps[i].value2 = comp->steps[j].value2; in xmlReversePattern()
421 comp->steps[i].op = comp->steps[j].op; in xmlReversePattern()
423 comp->nbStep--; in xmlReversePattern()
425 if (comp->nbStep >= comp->maxStep) { in xmlReversePattern()
427 temp = (xmlStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 * in xmlReversePattern()
434 comp->steps = temp; in xmlReversePattern()
435 comp->maxStep *= 2; in xmlReversePattern()
438 j = comp->nbStep - 1; in xmlReversePattern()
442 tmp = comp->steps[i].value; in xmlReversePattern()
443 comp->steps[i].value = comp->steps[j].value; in xmlReversePattern()
444 comp->steps[j].value = tmp; in xmlReversePattern()
445 tmp = comp->steps[i].value2; in xmlReversePattern()
446 comp->steps[i].value2 = comp->steps[j].value2; in xmlReversePattern()
447 comp->steps[j].value2 = tmp; in xmlReversePattern()
448 op = comp->steps[i].op; in xmlReversePattern()
449 comp->steps[i].op = comp->steps[j].op; in xmlReversePattern()
450 comp->steps[j].op = op; in xmlReversePattern()
454 comp->steps[comp->nbStep].value = NULL; in xmlReversePattern()
455 comp->steps[comp->nbStep].value2 = NULL; in xmlReversePattern()
456 comp->steps[comp->nbStep++].op = XML_OP_END; in xmlReversePattern()
501 xmlPatMatch(xmlPatternPtr comp, xmlNodePtr node) { in xmlPatMatch() argument
506 if ((comp == NULL) || (node == NULL)) return(-1); in xmlPatMatch()
509 for (;i < comp->nbStep;i++) { in xmlPatMatch()
510 step = &comp->steps[i]; in xmlPatMatch()
622 step = &comp->steps[i]; in xmlPatMatch()
733 if (xmlPatternAdd(ctxt, ctxt->comp, (op), (val), (val2))) goto error;
1036 if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) { in xmlCompileStepPattern()
1189 if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) { in xmlCompileStepPattern()
1239 ctxt->comp->flags |= PAT_FROM_ROOT; in xmlCompilePathPattern()
1240 } else if ((CUR == '.') || (ctxt->comp->flags & XML_PATTERN_NOTPATTERN)) { in xmlCompilePathPattern()
1241 ctxt->comp->flags |= PAT_FROM_CUR; in xmlCompilePathPattern()
1341 ctxt->comp->flags |= PAT_FROM_CUR; in xmlCompileIDCXPathPath()
1477 if (ctxt->comp->steps[ctxt->states[2 * i]].flags & in xmlDebugStreamCtxt()
1527 xmlFreeStreamComp(xmlStreamCompPtr comp) { in xmlFreeStreamComp() argument
1528 if (comp != NULL) { in xmlFreeStreamComp()
1529 if (comp->steps != NULL) in xmlFreeStreamComp()
1530 xmlFree(comp->steps); in xmlFreeStreamComp()
1531 if (comp->dict != NULL) in xmlFreeStreamComp()
1532 xmlDictFree(comp->dict); in xmlFreeStreamComp()
1533 xmlFree(comp); in xmlFreeStreamComp()
1549 xmlStreamCompAddStep(xmlStreamCompPtr comp, const xmlChar *name, in xmlStreamCompAddStep() argument
1553 if (comp->nbStep >= comp->maxStep) { in xmlStreamCompAddStep()
1554 cur = (xmlStreamStepPtr) xmlRealloc(comp->steps, in xmlStreamCompAddStep()
1555 comp->maxStep * 2 * sizeof(xmlStreamStep)); in xmlStreamCompAddStep()
1561 comp->steps = cur; in xmlStreamCompAddStep()
1562 comp->maxStep *= 2; in xmlStreamCompAddStep()
1564 cur = &comp->steps[comp->nbStep++]; in xmlStreamCompAddStep()
1569 return(comp->nbStep - 1); in xmlStreamCompAddStep()
1581 xmlStreamCompile(xmlPatternPtr comp) { in xmlStreamCompile() argument
1586 if ((comp == NULL) || (comp->steps == NULL)) in xmlStreamCompile()
1591 if ((comp->nbStep == 1) && in xmlStreamCompile()
1592 (comp->steps[0].op == XML_OP_ELEM) && in xmlStreamCompile()
1593 (comp->steps[0].value == NULL) && in xmlStreamCompile()
1594 (comp->steps[0].value2 == NULL)) { in xmlStreamCompile()
1600 comp->stream = stream; in xmlStreamCompile()
1604 stream = xmlNewStreamComp((comp->nbStep / 2) + 1); in xmlStreamCompile()
1607 if (comp->dict != NULL) { in xmlStreamCompile()
1608 stream->dict = comp->dict; in xmlStreamCompile()
1613 if (comp->flags & PAT_FROM_ROOT) in xmlStreamCompile()
1616 for (;i < comp->nbStep;i++) { in xmlStreamCompile()
1617 step = comp->steps[i]; in xmlStreamCompile()
1653 if ((comp->nbStep == i + 1) && in xmlStreamCompile()
1659 if (comp->nbStep == i + 1) { in xmlStreamCompile()
1725 if ((! root) && (comp->flags & XML_PATTERN_NOTPATTERN) == 0) { in xmlStreamCompile()
1747 comp->stream = stream; in xmlStreamCompile()
1783 cur->comp = stream; in xmlNewStreamCtxt()
1817 xmlStreamCtxtAddState(xmlStreamCtxtPtr comp, int idx, int level) { in xmlStreamCtxtAddState() argument
1819 for (i = 0;i < comp->nbState;i++) { in xmlStreamCtxtAddState()
1820 if (comp->states[2 * i] < 0) { in xmlStreamCtxtAddState()
1821 comp->states[2 * i] = idx; in xmlStreamCtxtAddState()
1822 comp->states[2 * i + 1] = level; in xmlStreamCtxtAddState()
1826 if (comp->nbState >= comp->maxState) { in xmlStreamCtxtAddState()
1829 cur = (int *) xmlRealloc(comp->states, in xmlStreamCtxtAddState()
1830 comp->maxState * 4 * sizeof(int)); in xmlStreamCtxtAddState()
1836 comp->states = cur; in xmlStreamCtxtAddState()
1837 comp->maxState *= 2; in xmlStreamCtxtAddState()
1839 comp->states[2 * comp->nbState] = idx; in xmlStreamCtxtAddState()
1840 comp->states[2 * comp->nbState++ + 1] = level; in xmlStreamCtxtAddState()
1841 return(comp->nbState - 1); in xmlStreamCtxtAddState()
1865 xmlStreamCompPtr comp; in xmlStreamPushInternal() local
1875 comp = stream->comp; in xmlStreamPushInternal()
1883 if (comp->flags & XML_STREAM_FROM_ROOT) { in xmlStreamPushInternal()
1884 if (comp->nbStep == 0) { in xmlStreamPushInternal()
1888 if ((comp->nbStep == 1) && in xmlStreamPushInternal()
1889 (comp->steps[0].nodeType == XML_STREAM_ANY_NODE) && in xmlStreamPushInternal()
1890 (comp->steps[0].flags & XML_STREAM_STEP_DESC)) in xmlStreamPushInternal()
1897 } else if (comp->steps[0].flags & XML_STREAM_STEP_ROOT) { in xmlStreamPushInternal()
1912 if (comp->nbStep == 0) { in xmlStreamPushInternal()
1944 ((comp->flags & XML_STREAM_FINAL_IS_ANY_NODE) == 0)) { in xmlStreamPushInternal()
1960 if ((comp->flags & XML_STREAM_DESC) == 0) { in xmlStreamPushInternal()
1995 desc = comp->steps[stepNr].flags & XML_STREAM_STEP_DESC; in xmlStreamPushInternal()
2002 step = comp->steps[stepNr]; in xmlStreamPushInternal()
2008 if ((comp->flags & XML_STREAM_DESC) == 0) in xmlStreamPushInternal()
2042 } else if (comp->dict) { in xmlStreamPushInternal()
2078 if (((comp->flags & XML_STREAM_DESC) == 0) && in xmlStreamPushInternal()
2098 step = comp->steps[0]; in xmlStreamPushInternal()
2182 if (((comp->flags & XML_STREAM_DESC) == 0) && in xmlStreamPushInternal()
2337 if (streamCtxt->comp->flags & XML_STREAM_FINAL_IS_ANY_NODE) in xmlStreamWantsAnyNode()
2405 ctxt->comp = cur; in xmlPatterncompile()
2467 xmlPatternMatch(xmlPatternPtr comp, xmlNodePtr node) in xmlPatternMatch() argument
2471 if ((comp == NULL) || (node == NULL)) in xmlPatternMatch()
2474 while (comp != NULL) { in xmlPatternMatch()
2475 ret = xmlPatMatch(comp, node); in xmlPatternMatch()
2478 comp = comp->next; in xmlPatternMatch()
2493 xmlPatternGetStreamCtxt(xmlPatternPtr comp) in xmlPatternGetStreamCtxt() argument
2497 if ((comp == NULL) || (comp->stream == NULL)) in xmlPatternGetStreamCtxt()
2500 while (comp != NULL) { in xmlPatternGetStreamCtxt()
2501 if (comp->stream == NULL) in xmlPatternGetStreamCtxt()
2503 cur = xmlNewStreamCtxt(comp->stream); in xmlPatternGetStreamCtxt()
2512 cur->flags = comp->flags; in xmlPatternGetStreamCtxt()
2513 comp = comp->next; in xmlPatternGetStreamCtxt()
2531 xmlPatternStreamable(xmlPatternPtr comp) { in xmlPatternStreamable() argument
2532 if (comp == NULL) in xmlPatternStreamable()
2534 while (comp != NULL) { in xmlPatternStreamable()
2535 if (comp->stream == NULL) in xmlPatternStreamable()
2537 comp = comp->next; in xmlPatternStreamable()
2552 xmlPatternMaxDepth(xmlPatternPtr comp) { in xmlPatternMaxDepth() argument
2554 if (comp == NULL) in xmlPatternMaxDepth()
2556 while (comp != NULL) { in xmlPatternMaxDepth()
2557 if (comp->stream == NULL) in xmlPatternMaxDepth()
2559 for (i = 0;i < comp->stream->nbStep;i++) in xmlPatternMaxDepth()
2560 if (comp->stream->steps[i].flags & XML_STREAM_STEP_DESC) in xmlPatternMaxDepth()
2562 if (comp->stream->nbStep > ret) in xmlPatternMaxDepth()
2563 ret = comp->stream->nbStep; in xmlPatternMaxDepth()
2564 comp = comp->next; in xmlPatternMaxDepth()
2580 xmlPatternMinDepth(xmlPatternPtr comp) { in xmlPatternMinDepth() argument
2582 if (comp == NULL) in xmlPatternMinDepth()
2584 while (comp != NULL) { in xmlPatternMinDepth()
2585 if (comp->stream == NULL) in xmlPatternMinDepth()
2587 if (comp->stream->nbStep < ret) in xmlPatternMinDepth()
2588 ret = comp->stream->nbStep; in xmlPatternMinDepth()
2591 comp = comp->next; in xmlPatternMinDepth()
2605 xmlPatternFromRoot(xmlPatternPtr comp) { in xmlPatternFromRoot() argument
2606 if (comp == NULL) in xmlPatternFromRoot()
2608 while (comp != NULL) { in xmlPatternFromRoot()
2609 if (comp->stream == NULL) in xmlPatternFromRoot()
2611 if (comp->flags & PAT_FROM_ROOT) in xmlPatternFromRoot()
2613 comp = comp->next; in xmlPatternFromRoot()