Lines Matching full: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 */
119 static void xmlFreeStreamComp(xmlStreamCompPtr comp);
183 xmlPatternPtr comp; /* the result */
226 * @comp: an XSLT comp
228 * Free up the memory allocated by @comp
231 xmlFreePattern(xmlPatternPtr comp) {
235 if (comp == NULL)
237 if (comp->next != NULL)
238 xmlFreePattern(comp->next);
239 if (comp->stream != NULL)
240 xmlFreeStreamComp(comp->stream);
241 if (comp->pattern != NULL)
242 xmlFree((xmlChar *)comp->pattern);
243 if (comp->steps != NULL) {
244 if (comp->dict == NULL) {
245 for (i = 0;i < comp->nbStep;i++) {
246 op = &comp->steps[i];
253 xmlFree(comp->steps);
255 if (comp->dict != NULL)
256 xmlDictFree(comp->dict);
258 memset(comp, -1, sizeof(xmlPattern));
259 xmlFree(comp);
264 * @comp: an XSLT comp list
266 * Free up the memory allocated by all the elements of @comp
269 xmlFreePatternList(xmlPatternPtr comp) {
272 while (comp != NULL) {
273 cur = comp;
274 comp = comp->next;
337 * @comp: the compiled match expression
348 xmlPatternPtr comp,
351 if (comp->nbStep >= comp->maxStep) {
353 temp = (xmlStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 *
360 comp->steps = temp;
361 comp->maxStep *= 2;
363 comp->steps[comp->nbStep].op = op;
364 comp->steps[comp->nbStep].value = value;
365 comp->steps[comp->nbStep].value2 = value2;
366 comp->nbStep++;
373 * @comp: the compiled match expression
378 xsltSwapTopPattern(xmlPatternPtr comp) {
380 int j = comp->nbStep - 1;
386 tmp = comp->steps[i].value;
387 comp->steps[i].value = comp->steps[j].value;
388 comp->steps[j].value = tmp;
389 tmp = comp->steps[i].value2;
390 comp->steps[i].value2 = comp->steps[j].value2;
391 comp->steps[j].value2 = tmp;
392 op = comp->steps[i].op;
393 comp->steps[i].op = comp->steps[j].op;
394 comp->steps[j].op = op;
401 * @comp: the compiled match expression
408 xmlReversePattern(xmlPatternPtr comp) {
414 if ((comp->nbStep > 0) && (comp->steps[0].op == XML_OP_ANCESTOR)) {
415 for (i = 0, j = 1;j < comp->nbStep;i++,j++) {
416 comp->steps[i].value = comp->steps[j].value;
417 comp->steps[i].value2 = comp->steps[j].value2;
418 comp->steps[i].op = comp->steps[j].op;
420 comp->nbStep--;
422 if (comp->nbStep >= comp->maxStep) {
424 temp = (xmlStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 *
431 comp->steps = temp;
432 comp->maxStep *= 2;
435 j = comp->nbStep - 1;
439 tmp = comp->steps[i].value;
440 comp->steps[i].value = comp->steps[j].value;
441 comp->steps[j].value = tmp;
442 tmp = comp->steps[i].value2;
443 comp->steps[i].value2 = comp->steps[j].value2;
444 comp->steps[j].value2 = tmp;
445 op = comp->steps[i].op;
446 comp->steps[i].op = comp->steps[j].op;
447 comp->steps[j].op = op;
451 comp->steps[comp->nbStep].value = NULL;
452 comp->steps[comp->nbStep].value2 = NULL;
453 comp->steps[comp->nbStep++].op = XML_OP_END;
490 * @comp: the precompiled pattern
498 xmlPatMatch(xmlPatternPtr comp, xmlNodePtr node) {
503 if ((comp == NULL) || (node == NULL)) return(-1);
506 for (;i < comp->nbStep;i++) {
507 step = &comp->steps[i];
619 step = &comp->steps[i];
730 if (xmlPatternAdd(ctxt, ctxt->comp, (op), (val), (val2))) goto error;
1032 if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) {
1185 if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) {
1235 ctxt->comp->flags |= PAT_FROM_ROOT;
1236 } else if ((CUR == '.') || (ctxt->comp->flags & XML_PATTERN_NOTPATTERN)) {
1237 ctxt->comp->flags |= PAT_FROM_CUR;
1337 ctxt->comp->flags |= PAT_FROM_CUR;
1473 if (ctxt->comp->steps[ctxt->states[2 * i]].flags &
1518 * @comp: the compiled pattern for streaming
1523 xmlFreeStreamComp(xmlStreamCompPtr comp) {
1524 if (comp != NULL) {
1525 if (comp->steps != NULL)
1526 xmlFree(comp->steps);
1527 if (comp->dict != NULL)
1528 xmlDictFree(comp->dict);
1529 xmlFree(comp);
1535 * @comp: the compiled pattern for streaming
1545 xmlStreamCompAddStep(xmlStreamCompPtr comp, const xmlChar *name,
1549 if (comp->nbStep >= comp->maxStep) {
1550 cur = (xmlStreamStepPtr) xmlRealloc(comp->steps,
1551 comp->maxStep * 2 * sizeof(xmlStreamStep));
1557 comp->steps = cur;
1558 comp->maxStep *= 2;
1560 cur = &comp->steps[comp->nbStep++];
1565 return(comp->nbStep - 1);
1570 * @comp: the precompiled pattern
1577 xmlStreamCompile(xmlPatternPtr comp) {
1582 if ((comp == NULL) || (comp->steps == NULL))
1587 if ((comp->nbStep == 1) &&
1588 (comp->steps[0].op == XML_OP_ELEM) &&
1589 (comp->steps[0].value == NULL) &&
1590 (comp->steps[0].value2 == NULL)) {
1596 comp->stream = stream;
1600 stream = xmlNewStreamComp((comp->nbStep / 2) + 1);
1603 if (comp->dict != NULL) {
1604 stream->dict = comp->dict;
1609 if (comp->flags & PAT_FROM_ROOT)
1612 for (;i < comp->nbStep;i++) {
1613 step = comp->steps[i];
1649 if ((comp->nbStep == i + 1) &&
1655 if (comp->nbStep == i + 1) {
1721 if ((! root) && (comp->flags & XML_PATTERN_NOTPATTERN) == 0) {
1743 comp->stream = stream;
1779 cur->comp = stream;
1805 * @comp: the stream context
1813 xmlStreamCtxtAddState(xmlStreamCtxtPtr comp, int idx, int level) {
1815 for (i = 0;i < comp->nbState;i++) {
1816 if (comp->states[2 * i] < 0) {
1817 comp->states[2 * i] = idx;
1818 comp->states[2 * i + 1] = level;
1822 if (comp->nbState >= comp->maxState) {
1825 cur = (int *) xmlRealloc(comp->states,
1826 comp->maxState * 4 * sizeof(int));
1832 comp->states = cur;
1833 comp->maxState *= 2;
1835 comp->states[2 * comp->nbState] = idx;
1836 comp->states[2 * comp->nbState++ + 1] = level;
1837 return(comp->nbState - 1);
1861 xmlStreamCompPtr comp;
1871 comp = stream->comp;
1879 if (comp->flags & XML_STREAM_FROM_ROOT) {
1880 if (comp->nbStep == 0) {
1884 if ((comp->nbStep == 1) &&
1885 (comp->steps[0].nodeType == XML_STREAM_ANY_NODE) &&
1886 (comp->steps[0].flags & XML_STREAM_STEP_DESC))
1893 } else if (comp->steps[0].flags & XML_STREAM_STEP_ROOT) {
1908 if (comp->nbStep == 0) {
1940 ((comp->flags & XML_STREAM_FINAL_IS_ANY_NODE) == 0)) {
1956 if ((comp->flags & XML_STREAM_DESC) == 0) {
1991 desc = comp->steps[stepNr].flags & XML_STREAM_STEP_DESC;
1998 step = comp->steps[stepNr];
2004 if ((comp->flags & XML_STREAM_DESC) == 0)
2038 } else if (comp->dict) {
2074 if (((comp->flags & XML_STREAM_DESC) == 0) &&
2094 step = comp->steps[0];
2178 if (((comp->flags & XML_STREAM_DESC) == 0) &&
2333 if (streamCtxt->comp->flags & XML_STREAM_FINAL_IS_ANY_NODE)
2401 ctxt->comp = cur;
2455 * @comp: the precompiled pattern
2463 xmlPatternMatch(xmlPatternPtr comp, xmlNodePtr node)
2467 if ((comp == NULL) || (node == NULL))
2470 while (comp != NULL) {
2471 ret = xmlPatMatch(comp, node);
2474 comp = comp->next;
2481 * @comp: the precompiled pattern
2489 xmlPatternGetStreamCtxt(xmlPatternPtr comp)
2493 if ((comp == NULL) || (comp->stream == NULL))
2496 while (comp != NULL) {
2497 if (comp->stream == NULL)
2499 cur = xmlNewStreamCtxt(comp->stream);
2508 cur->flags = comp->flags;
2509 comp = comp->next;
2519 * @comp: the precompiled pattern
2527 xmlPatternStreamable(xmlPatternPtr comp) {
2528 if (comp == NULL)
2530 while (comp != NULL) {
2531 if (comp->stream == NULL)
2533 comp = comp->next;
2540 * @comp: the precompiled pattern
2548 xmlPatternMaxDepth(xmlPatternPtr comp) {
2550 if (comp == NULL)
2552 while (comp != NULL) {
2553 if (comp->stream == NULL)
2555 for (i = 0;i < comp->stream->nbStep;i++)
2556 if (comp->stream->steps[i].flags & XML_STREAM_STEP_DESC)
2558 if (comp->stream->nbStep > ret)
2559 ret = comp->stream->nbStep;
2560 comp = comp->next;
2567 * @comp: the precompiled pattern
2576 xmlPatternMinDepth(xmlPatternPtr comp) {
2578 if (comp == NULL)
2580 while (comp != NULL) {
2581 if (comp->stream == NULL)
2583 if (comp->stream->nbStep < ret)
2584 ret = comp->stream->nbStep;
2587 comp = comp->next;
2594 * @comp: the precompiled pattern
2601 xmlPatternFromRoot(xmlPatternPtr comp) {
2602 if (comp == NULL)
2604 while (comp != NULL) {
2605 if (comp->stream == NULL)
2607 if (comp->flags & PAT_FROM_ROOT)
2609 comp = comp->next;