37#ifdef LIBXML_PATTERN_ENABLED
42#define ERROR(a, b, c, d)
43#define ERROR5(a, b, c, d, e)
45#define XML_STREAM_STEP_DESC 1
46#define XML_STREAM_STEP_FINAL 2
47#define XML_STREAM_STEP_ROOT 4
48#define XML_STREAM_STEP_ATTR 8
49#define XML_STREAM_STEP_NODE 16
50#define XML_STREAM_STEP_IN_SET 32
58#define XML_STREAM_FINAL_IS_ANY_NODE 1<<14
59#define XML_STREAM_FROM_ROOT 1<<15
60#define XML_STREAM_DESC 1<<16
66#define XML_STREAM_ANY_NODE 100
68#define XML_PATTERN_NOTPATTERN (XML_PATTERN_XPATH | \
72#define XML_STREAM_XS_IDC(c) ((c)->flags & \
73 (XML_PATTERN_XSSEL | XML_PATTERN_XSFIELD))
75#define XML_STREAM_XS_IDC_SEL(c) ((c)->flags & XML_PATTERN_XSSEL)
77#define XML_STREAM_XS_IDC_FIELD(c) ((c)->flags & XML_PATTERN_XSFIELD)
79#define XML_PAT_COPY_NSNAME(c, r, nsname) \
80 if ((c)->comp->dict) \
81 r = (xmlChar *) xmlDictLookup((c)->comp->dict, BAD_CAST nsname, -1); \
82 else r = xmlStrdup(BAD_CAST nsname);
84#define XML_PAT_FREE_STRING(c, r) if ((c)->comp->dict == NULL) xmlFree(r);
86typedef struct _xmlStreamStep xmlStreamStep;
87typedef xmlStreamStep *xmlStreamStepPtr;
88struct _xmlStreamStep {
95typedef struct _xmlStreamComp xmlStreamComp;
96typedef xmlStreamComp *xmlStreamCompPtr;
97struct _xmlStreamComp {
101 xmlStreamStepPtr
steps;
105struct _xmlStreamCtxt {
106 struct _xmlStreamCtxt *
next;
107 xmlStreamCompPtr comp;
116static void xmlFreeStreamComp(xmlStreamCompPtr comp);
135typedef struct _xmlStepState xmlStepState;
136typedef xmlStepState *xmlStepStatePtr;
137struct _xmlStepState {
142typedef struct _xmlStepStates xmlStepStates;
143typedef xmlStepStates *xmlStepStatesPtr;
144struct _xmlStepStates {
147 xmlStepStatePtr states;
150typedef struct _xmlStepOp xmlStepOp;
151typedef xmlStepOp *xmlStepOpPtr;
158#define PAT_FROM_ROOT (1<<8)
159#define PAT_FROM_CUR (1<<9)
164 struct _xmlPattern *
next;
173typedef struct _xmlPatParserContext xmlPatParserContext;
174typedef xmlPatParserContext *xmlPatParserContextPtr;
175struct _xmlPatParserContext {
206 "xmlNewPattern : malloc failed\n");
211 cur->steps = (xmlStepOpPtr)
xmlMalloc(
cur->maxStep *
sizeof(xmlStepOp));
215 "xmlNewPattern : malloc failed\n");
228xmlFreePattern(xmlPatternPtr comp) {
229 xmlFreePatternList(comp);
233xmlFreePatternInternal(xmlPatternPtr comp) {
239 if (comp->stream !=
NULL)
240 xmlFreeStreamComp(comp->stream);
241 if (comp->pattern !=
NULL)
243 if (comp->steps !=
NULL) {
244 if (comp->dict ==
NULL) {
245 for (
i = 0;
i < comp->nbStep;
i++) {
246 op = &comp->steps[
i];
255 if (comp->dict !=
NULL)
258 memset(comp, -1,
sizeof(xmlPattern));
269xmlFreePatternList(xmlPatternPtr comp) {
272 while (comp !=
NULL) {
276 xmlFreePatternInternal(
cur);
291static xmlPatParserContextPtr
294 xmlPatParserContextPtr
cur;
299 cur = (xmlPatParserContextPtr)
xmlMalloc(
sizeof(xmlPatParserContext));
302 "xmlNewPatParserContext : malloc failed\n");
305 memset(
cur, 0,
sizeof(xmlPatParserContext));
309 if (namespaces !=
NULL) {
311 for (
i = 0;namespaces[2 *
i] !=
NULL;
i++)
313 cur->nb_namespaces =
i;
315 cur->nb_namespaces = 0;
317 cur->namespaces = namespaces;
328xmlFreePatParserContext(xmlPatParserContextPtr ctxt) {
331 memset(ctxt, -1,
sizeof(xmlPatParserContext));
351 if (comp->nbStep >= comp->maxStep) {
357 "xmlPatternAdd: realloc failed\n");
363 comp->steps[comp->nbStep].op =
op;
364 comp->steps[comp->nbStep].value =
value;
365 comp->steps[comp->nbStep].value2 = value2;
378xsltSwapTopPattern(xmlPatternPtr comp) {
380 int j = comp->nbStep - 1;
384 register xmlPatOp
op;
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;
408xmlReversePattern(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;
422 if (comp->nbStep >= comp->maxStep) {
428 "xmlReversePattern: realloc failed\n");
435 j = comp->nbStep - 1;
438 register xmlPatOp
op;
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;
464xmlPatPushState(xmlStepStates *states,
int step, xmlNodePtr
node) {
465 if ((states->states ==
NULL) || (states->maxstates <= 0)) {
466 states->maxstates = 4;
467 states->nbstates = 0;
468 states->states =
xmlMalloc(4 *
sizeof(xmlStepState));
470 else if (states->maxstates <= states->nbstates) {
473 tmp = (xmlStepStatePtr)
xmlRealloc(states->states,
474 2 * states->maxstates *
sizeof(xmlStepState));
477 states->states = tmp;
478 states->maxstates *= 2;
480 states->states[states->nbstates].step = step;
481 states->states[states->nbstates++].node =
node;
498xmlPatMatch(xmlPatternPtr comp, xmlNodePtr
node) {
501 xmlStepStates states = {0, 0,
NULL};
506 for (;
i < comp->nbStep;
i++) {
507 step = &comp->steps[
i];
512 if (
node->type == XML_NAMESPACE_DECL)
515 if ((
node->type == XML_DOCUMENT_NODE) ||
516 (
node->type == XML_HTML_DOCUMENT_NODE))
520 if (
node->type != XML_ELEMENT_NODE)
522 if (step->value ==
NULL)
524 if (step->value[0] !=
node->name[0])
531 if (step->value2 !=
NULL)
533 }
else if (
node->ns->href !=
NULL) {
534 if (step->value2 ==
NULL)
543 if ((
node->type != XML_ELEMENT_NODE) &&
544 (
node->type != XML_DOCUMENT_NODE) &&
545 (
node->type != XML_HTML_DOCUMENT_NODE))
548 lst =
node->children;
550 if (step->value !=
NULL) {
551 while (lst !=
NULL) {
552 if ((lst->type == XML_ELEMENT_NODE) &&
553 (step->value[0] == lst->name[0]) &&
564 if (
node->type != XML_ATTRIBUTE_NODE)
566 if (step->value !=
NULL) {
567 if (step->value[0] !=
node->name[0])
574 if (step->value2 !=
NULL)
576 }
else if (step->value2 !=
NULL) {
582 if ((
node->type == XML_DOCUMENT_NODE) ||
583 (
node->type == XML_HTML_DOCUMENT_NODE) ||
584 (
node->type == XML_NAMESPACE_DECL))
589 if (step->value ==
NULL)
591 if (step->value[0] !=
node->name[0])
597 if (step->value2 !=
NULL)
599 }
else if (
node->ns->href !=
NULL) {
600 if (step->value2 ==
NULL)
606 case XML_OP_ANCESTOR:
608 if (step->value ==
NULL) {
610 step = &comp->steps[
i];
611 if (step->op == XML_OP_ROOT)
613 if (step->op != XML_OP_ELEM)
615 if (step->value ==
NULL)
620 if ((
node->type == XML_DOCUMENT_NODE) ||
621 (
node->type == XML_HTML_DOCUMENT_NODE) ||
622 (
node->type == XML_NAMESPACE_DECL))
626 if ((
node->type == XML_ELEMENT_NODE) &&
627 (step->value[0] ==
node->name[0]) &&
631 if (step->value2 ==
NULL)
633 }
else if (
node->ns->href !=
NULL) {
634 if ((step->value2 !=
NULL) &&
647 if (step->op == XML_OP_ANCESTOR)
648 xmlPatPushState(&states,
i,
node);
650 xmlPatPushState(&states,
i - 1,
node);
653 if (
node->type != XML_ELEMENT_NODE)
656 if (step->value !=
NULL)
658 }
else if (
node->ns->href !=
NULL) {
659 if (step->value ==
NULL)
666 if (
node->type != XML_ELEMENT_NODE)
672 if (states.states !=
NULL) {
679 if (states.states ==
NULL)
681 if (states.nbstates <= 0) {
686 i = states.states[states.nbstates].step;
687 node = states.states[states.nbstates].node;
701 xmlGenericError(xmlGenericErrorContext, \
702 "Unimplemented block at %s:%d\n", \
704#define CUR (*ctxt->cur)
705#define SKIP(val) ctxt->cur += (val)
706#define NXT(val) ctxt->cur[(val)]
707#define PEEKPREV(val) ctxt->cur[-(val)]
708#define CUR_PTR ctxt->cur
711 while (IS_BLANK_CH(CUR)) NEXT
713#define CURRENT (*ctxt->cur)
714#define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur)
717#define PUSH(op, val, val2) \
718 if (xmlPatternAdd(ctxt, ctxt->comp, (op), (val), (val2))) goto error;
720#define XSLT_ERROR(X) \
721 { xsltError(ctxt, __FILE__, __LINE__, X); \
722 ctxt->error = (X); return; }
724#define XSLT_ERROR0(X) \
725 { xsltError(ctxt, __FILE__, __LINE__, X); \
726 ctxt->error = (X); return(0); }
742xmlPatScanLiteral(xmlPatParserContextPtr ctxt) {
767 }
else if (
CUR ==
'\'') {
810xmlPatScanName(xmlPatParserContextPtr ctxt) {
823 (
val ==
'.') || (
val ==
'-') ||
848xmlPatScanNCName(xmlPatParserContextPtr ctxt) {
861 (
val ==
'.') || (
val ==
'-') ||
888xmlPatScanQName(xmlPatParserContextPtr ctxt,
xmlChar **
prefix) {
892 ret = xmlPatScanNCName(ctxt);
896 ret = xmlPatScanNCName(ctxt);
909xmlCompileAttributeTest(xmlPatParserContextPtr ctxt) {
915 name = xmlPatScanNCName(ctxt);
922 "xmlCompileAttributeTest : Name expected\n");
941 token = xmlPatScanName(ctxt);
947 XML_PAT_COPY_NSNAME(ctxt, URL, XML_XML_NAMESPACE);
949 for (
i = 0;
i < ctxt->nb_namespaces;
i++) {
951 XML_PAT_COPY_NSNAME(ctxt, URL, ctxt->namespaces[2 *
i])
955 if (
i >= ctxt->nb_namespaces) {
957 "xmlCompileAttributeTest : no namespace bound to prefix %s\n",
963 XML_PAT_FREE_STRING(ctxt,
name);
971 "xmlCompileAttributeTest : Name expected\n");
984 XML_PAT_FREE_STRING(ctxt,
name);
986 XML_PAT_FREE_STRING(ctxt, URL)
988 XML_PAT_FREE_STRING(ctxt,
token);
1003xmlCompileStepPattern(xmlPatParserContextPtr ctxt) {
1022 if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) {
1024 "Unexpected attribute axis in '%s'.\n", ctxt->base);
1029 xmlCompileAttributeTest(ctxt);
1030 if (ctxt->error != 0)
1034 name = xmlPatScanNCName(ctxt);
1042 "xmlCompileStepPattern : Name expected\n");
1065 token = xmlPatScanName(ctxt);
1066 if ((
prefix[0] ==
'x') &&
1071 XML_PAT_COPY_NSNAME(ctxt, URL, XML_XML_NAMESPACE)
1073 for (
i = 0;
i < ctxt->nb_namespaces;
i++) {
1075 XML_PAT_COPY_NSNAME(ctxt, URL, ctxt->namespaces[2 *
i])
1079 if (
i >= ctxt->nb_namespaces) {
1081 "xmlCompileStepPattern : no namespace bound to prefix %s\n",
1087 XML_PAT_FREE_STRING(ctxt,
prefix);
1095 "xmlCompileStepPattern : Name expected\n");
1105 XML_PAT_FREE_STRING(ctxt,
name);
1106 name = xmlPatScanName(ctxt);
1114 "xmlCompileStepPattern : QName expected\n");
1132 token = xmlPatScanName(ctxt);
1133 if ((
prefix[0] ==
'x') &&
1138 XML_PAT_COPY_NSNAME(ctxt, URL, XML_XML_NAMESPACE)
1140 for (
i = 0;
i < ctxt->nb_namespaces;
i++) {
1142 XML_PAT_COPY_NSNAME(ctxt, URL, ctxt->namespaces[2 *
i])
1146 if (
i >= ctxt->nb_namespaces) {
1148 "xmlCompileStepPattern : no namespace bound "
1149 "to prefix %s\n",
prefix);
1154 XML_PAT_FREE_STRING(ctxt,
prefix);
1162 "xmlCompileStepPattern : Name expected\n");
1173 XML_PAT_FREE_STRING(ctxt,
name)
1175 if (XML_STREAM_XS_IDC_SEL(ctxt->comp)) {
1177 "Unexpected attribute axis in '%s'.\n", ctxt->base);
1181 xmlCompileAttributeTest(ctxt);
1182 if (ctxt->error != 0)
1187 "The 'element' or 'attribute' axis is expected.\n",
NULL);
1192 }
else if (
CUR ==
'*') {
1205 XML_PAT_FREE_STRING(ctxt, URL)
1207 XML_PAT_FREE_STRING(ctxt,
token)
1209 XML_PAT_FREE_STRING(ctxt,
name)
1222xmlCompilePathPattern(xmlPatParserContextPtr ctxt) {
1225 ctxt->comp->flags |= PAT_FROM_ROOT;
1226 }
else if ((
CUR ==
'.') || (ctxt->comp->flags & XML_PATTERN_NOTPATTERN)) {
1227 ctxt->comp->flags |= PAT_FROM_CUR;
1230 if ((
CUR ==
'/') && (
NXT(1) ==
'/')) {
1234 }
else if ((
CUR ==
'.') && (
NXT(1) ==
'/') && (
NXT(2) ==
'/')) {
1243 "Incomplete expression '%s'.\n", ctxt->base);
1250 xmlCompileAttributeTest(ctxt);
1254 xmlCompileStepPattern(ctxt);
1255 if (ctxt->error != 0)
1266 "Incomplete expression '%s'.\n", ctxt->base);
1271 xmlCompileStepPattern(ctxt);
1272 if (ctxt->error != 0)
1275 while (
CUR ==
'/') {
1276 if (
NXT(1) ==
'/') {
1281 xmlCompileStepPattern(ctxt);
1282 if (ctxt->error != 0)
1290 "Incomplete expression '%s'.\n", ctxt->base);
1294 xmlCompileStepPattern(ctxt);
1295 if (ctxt->error != 0)
1302 "Failed to compile pattern %s\n", ctxt->base);
1319xmlCompileIDCXPathPath(xmlPatParserContextPtr ctxt) {
1323 "Unexpected selection of the document root in '%s'.\n",
1327 ctxt->comp->flags |= PAT_FROM_CUR;
1343 "Unexpected token after '.' in '%s'.\n", ctxt->base);
1355 "Unexpected '/' token in '%s'.\n", ctxt->base);
1364 goto error_unfinished;
1370 xmlCompileStepPattern(ctxt);
1371 if (ctxt->error != 0)
1384 "Unexpected subsequent '//' in '%s'.\n",
1389 goto error_unfinished;
1395 "Failed to compile expression '%s'.\n", ctxt->base);
1406 "Unfinished expression '%s'.\n", ctxt->base);
1424static xmlStreamCompPtr
1425xmlNewStreamComp(
int size) {
1426 xmlStreamCompPtr
cur;
1431 cur = (xmlStreamCompPtr)
xmlMalloc(
sizeof(xmlStreamComp));
1434 "xmlNewStreamComp: malloc failed\n");
1442 "xmlNewStreamComp: malloc failed\n");
1457xmlFreeStreamComp(xmlStreamCompPtr comp) {
1459 if (comp->steps !=
NULL)
1461 if (comp->dict !=
NULL)
1479xmlStreamCompAddStep(xmlStreamCompPtr comp,
const xmlChar *
name,
1481 xmlStreamStepPtr
cur;
1483 if (comp->nbStep >= comp->maxStep) {
1485 comp->maxStep * 2 *
sizeof(xmlStreamStep));
1488 "xmlNewStreamComp: malloc failed\n");
1494 cur = &comp->steps[comp->nbStep++];
1498 cur->nodeType = nodeType;
1499 return(comp->nbStep - 1);
1511xmlStreamCompile(xmlPatternPtr comp) {
1516 if ((comp ==
NULL) || (comp->steps ==
NULL))
1521 if ((comp->nbStep == 1) &&
1522 (comp->steps[0].op == XML_OP_ELEM) &&
1523 (comp->steps[0].value ==
NULL) &&
1524 (comp->steps[0].value2 ==
NULL)) {
1525 stream = xmlNewStreamComp(0);
1529 stream->flags |= XML_STREAM_FINAL_IS_ANY_NODE;
1534 stream = xmlNewStreamComp((comp->nbStep / 2) + 1);
1537 if (comp->dict !=
NULL) {
1538 stream->dict = comp->dict;
1543 if (comp->flags & PAT_FROM_ROOT)
1544 stream->flags |= XML_STREAM_FROM_ROOT;
1546 for (;
i < comp->nbStep;
i++) {
1547 step = comp->steps[
i];
1558 XML_ELEMENT_NODE,
flags);
1565 flags |= XML_STREAM_STEP_ATTR;
1567 s = xmlStreamCompAddStep(
stream,
1568 step.value, step.value2, XML_ATTRIBUTE_NODE,
flags);
1574 if ((step.value ==
NULL) && (step.value2 ==
NULL)) {
1583 if ((comp->nbStep ==
i + 1) &&
1584 (
flags & XML_STREAM_STEP_DESC)) {
1589 if (comp->nbStep ==
i + 1) {
1590 stream->flags |= XML_STREAM_FINAL_IS_ANY_NODE;
1592 flags |= XML_STREAM_STEP_NODE;
1594 XML_STREAM_ANY_NODE,
flags);
1605 stream->steps[prevs].flags |= XML_STREAM_STEP_IN_SET;
1616 s = xmlStreamCompAddStep(
stream, step.value, step.value2,
1617 XML_ELEMENT_NODE,
flags);
1625 s = xmlStreamCompAddStep(
stream, step.value, step.value2,
1626 XML_ELEMENT_NODE,
flags);
1634 XML_ELEMENT_NODE,
flags);
1642 case XML_OP_ANCESTOR:
1644 if (
flags & XML_STREAM_STEP_DESC)
1646 flags |= XML_STREAM_STEP_DESC;
1650 if ((
stream->flags & XML_STREAM_DESC) == 0)
1651 stream->flags |= XML_STREAM_DESC;
1655 if ((!
root) && (comp->flags & XML_PATTERN_NOTPATTERN) == 0) {
1661 if ((
stream->flags & XML_STREAM_DESC) == 0)
1662 stream->flags |= XML_STREAM_DESC;
1664 if (
stream->nbStep > 0) {
1665 if ((
stream->steps[0].flags & XML_STREAM_STEP_DESC) == 0)
1666 stream->steps[0].flags |= XML_STREAM_STEP_DESC;
1671 stream->steps[
s].flags |= XML_STREAM_STEP_FINAL;
1673 stream->steps[0].flags |= XML_STREAM_STEP_ROOT;
1677 xmlFreeStreamComp(
stream);
1689static xmlStreamCtxtPtr
1690xmlNewStreamCtxt(xmlStreamCompPtr
stream) {
1691 xmlStreamCtxtPtr
cur;
1693 cur = (xmlStreamCtxtPtr)
xmlMalloc(
sizeof(xmlStreamCtxt));
1696 "xmlNewStreamCtxt: malloc failed\n");
1704 "xmlNewStreamCtxt: malloc failed\n");
1711 cur->blockLevel = -1;
1722xmlFreeStreamCtxt(xmlStreamCtxtPtr
stream) {
1723 xmlStreamCtxtPtr
next;
1744xmlStreamCtxtAddState(xmlStreamCtxtPtr comp,
int idx,
int level) {
1746 for (
i = 0;
i < comp->nbState;
i++) {
1747 if (comp->states[2 *
i] < 0) {
1748 comp->states[2 *
i] =
idx;
1749 comp->states[2 *
i + 1] =
level;
1753 if (comp->nbState >= comp->maxState) {
1757 comp->maxState * 4 *
sizeof(
int));
1760 "xmlNewStreamCtxt: malloc failed\n");
1764 comp->maxState *= 2;
1766 comp->states[2 * comp->nbState] =
idx;
1767 comp->states[2 * comp->nbState++ + 1] =
level;
1768 return(comp->nbState - 1);
1788xmlStreamPushInternal(xmlStreamCtxtPtr
stream,
1792 xmlStreamCompPtr comp;
1801 if ((nodeType == XML_ELEMENT_NODE) &&
1807 if (comp->flags & XML_STREAM_FROM_ROOT) {
1808 if (comp->nbStep == 0) {
1812 if ((comp->nbStep == 1) &&
1813 (comp->steps[0].nodeType == XML_STREAM_ANY_NODE) &&
1814 (comp->steps[0].flags & XML_STREAM_STEP_DESC))
1821 }
else if (comp->steps[0].flags & XML_STREAM_STEP_ROOT) {
1823 tmp = xmlStreamCtxtAddState(
stream, 0, 0);
1836 if (comp->nbStep == 0) {
1841 if (
stream->flags & XML_PATTERN_XPATH) {
1850 if ((nodeType != XML_ATTRIBUTE_NODE) &&
1851 (((
stream->flags & XML_PATTERN_NOTPATTERN) == 0) ||
1858 if (
stream->blockLevel != -1) {
1866 if ((nodeType != XML_ELEMENT_NODE) &&
1867 (nodeType != XML_ATTRIBUTE_NODE) &&
1868 ((comp->flags & XML_STREAM_FINAL_IS_ANY_NODE) == 0)) {
1884 if ((comp->flags & XML_STREAM_DESC) == 0) {
1906 stepNr =
stream->states[2 *
i];
1912 tmp =
stream->states[(2 *
i) + 1];
1919 desc = comp->steps[stepNr].flags & XML_STREAM_STEP_DESC;
1926 step = comp->steps[stepNr];
1927 if (step.nodeType != nodeType) {
1928 if (step.nodeType == XML_ATTRIBUTE_NODE) {
1932 if ((comp->flags & XML_STREAM_DESC) == 0)
1935 }
else if (step.nodeType != XML_STREAM_ANY_NODE)
1942 if (step.nodeType == XML_STREAM_ANY_NODE) {
1944 }
else if (step.name ==
NULL) {
1945 if (step.ns ==
NULL) {
1952 }
else if (((step.ns !=
NULL) == (
ns !=
NULL)) &&
1954 (step.name[0] ==
name[0]) &&
1966 }
else if (comp->dict) {
1967 if (step.name ==
NULL) {
1968 if (step.ns ==
NULL)
1977 final = step.flags & XML_STREAM_STEP_FINAL;
1981 xmlStreamCtxtAddState(
stream, stepNr + 1,
1984 if ((
ret != 1) && (step.flags & XML_STREAM_STEP_IN_SET)) {
1992 if (((comp->flags & XML_STREAM_DESC) == 0) &&
1993 ((!
match) ||
final)) {
2012 step = comp->steps[0];
2013 if (step.flags & XML_STREAM_STEP_ROOT)
2016 desc = step.flags & XML_STREAM_STEP_DESC;
2017 if (
stream->flags & XML_PATTERN_NOTPATTERN) {
2023 if (
stream->level == 1) {
2024 if (XML_STREAM_XS_IDC(
stream)) {
2054 if (step.nodeType != nodeType) {
2055 if (nodeType == XML_ATTRIBUTE_NODE)
2057 else if (step.nodeType != XML_STREAM_ANY_NODE)
2064 if (step.nodeType == XML_STREAM_ANY_NODE) {
2066 }
else if (step.name ==
NULL) {
2067 if (step.ns ==
NULL) {
2074 }
else if (((step.ns !=
NULL) == (
ns !=
NULL)) &&
2076 (step.name[0] ==
name[0]) &&
2082 final = step.flags & XML_STREAM_STEP_FINAL;
2088 if ((
ret != 1) && (step.flags & XML_STREAM_STEP_IN_SET)) {
2096 if (((comp->flags & XML_STREAM_DESC) == 0) &&
2097 ((!
match) ||
final)) {
2131xmlStreamPush(xmlStreamCtxtPtr
stream,
2133 return (xmlStreamPushInternal(
stream,
name,
ns, XML_ELEMENT_NODE));
2156xmlStreamPushNode(xmlStreamCtxtPtr
stream,
2181xmlStreamPushAttr(xmlStreamCtxtPtr
stream,
2183 return (xmlStreamPushInternal(
stream,
name,
ns, XML_ATTRIBUTE_NODE));
2195xmlStreamPop(xmlStreamCtxtPtr
stream) {
2217 for (
i =
stream->nbState -1;
i >= 0;
i--) {
2219 lev =
stream->states[(2 *
i) + 1];
2222 if (lev <= stream->
level)
2243xmlStreamWantsAnyNode(xmlStreamCtxtPtr streamCtxt)
2245 if (streamCtxt ==
NULL)
2247 while (streamCtxt !=
NULL) {
2248 if (streamCtxt->comp->flags & XML_STREAM_FINAL_IS_ANY_NODE)
2250 streamCtxt = streamCtxt->next;
2276 xmlPatParserContextPtr ctxt =
NULL;
2289 while ((*or != 0) && (*or !=
'|')) or++;
2291 ctxt = xmlNewPatParserContext(
start, dict, namespaces);
2295 ctxt = xmlNewPatParserContext(tmp, dict, namespaces);
2300 cur = xmlNewPattern();
2318 if (XML_STREAM_XS_IDC(
cur))
2319 xmlCompileIDCXPathPath(ctxt);
2321 xmlCompilePathPattern(ctxt);
2322 if (ctxt->error != 0)
2324 xmlFreePatParserContext(ctxt);
2330 type =
cur->flags & (PAT_FROM_ROOT | PAT_FROM_CUR);
2331 }
else if (
type == PAT_FROM_ROOT) {
2332 if (
cur->flags & PAT_FROM_CUR)
2334 }
else if (
type == PAT_FROM_CUR) {
2335 if (
cur->flags & PAT_FROM_ROOT)
2340 xmlStreamCompile(
cur);
2341 if (xmlReversePattern(
cur) < 0)
2349 if (streamable == 0) {
2353 xmlFreeStreamComp(
cur->stream);
2362 if (ctxt !=
NULL) xmlFreePatParserContext(ctxt);
2378xmlPatternMatch(xmlPatternPtr comp, xmlNodePtr
node)
2385 while (comp !=
NULL) {
2386 ret = xmlPatMatch(comp,
node);
2404xmlPatternGetStreamCtxt(xmlPatternPtr comp)
2408 if ((comp ==
NULL) || (comp->stream ==
NULL))
2411 while (comp !=
NULL) {
2412 if (comp->stream ==
NULL)
2414 cur = xmlNewStreamCtxt(comp->stream);
2423 cur->flags = comp->flags;
2428 xmlFreeStreamCtxt(
ret);
2442xmlPatternStreamable(xmlPatternPtr comp) {
2445 while (comp !=
NULL) {
2446 if (comp->stream ==
NULL)
2463xmlPatternMaxDepth(xmlPatternPtr comp) {
2467 while (comp !=
NULL) {
2468 if (comp->stream ==
NULL)
2470 for (
i = 0;
i < comp->stream->nbStep;
i++)
2471 if (comp->stream->steps[
i].flags & XML_STREAM_STEP_DESC)
2473 if (comp->stream->nbStep >
ret)
2474 ret = comp->stream->nbStep;
2491xmlPatternMinDepth(xmlPatternPtr comp) {
2495 while (comp !=
NULL) {
2496 if (comp->stream ==
NULL)
2498 if (comp->stream->nbStep <
ret)
2499 ret = comp->stream->nbStep;
2516xmlPatternFromRoot(xmlPatternPtr comp) {
2519 while (comp !=
NULL) {
2520 if (comp->stream ==
NULL)
2522 if (comp->flags & PAT_FROM_ROOT)
void restart(int argc, const char *argv[])
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
#define PUSH(op, val, val2, novar)
int WINAPIV fprintf(FILE *file, const char *format,...)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble GLdouble q
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
D3D11_SHADER_VARIABLE_DESC desc
static DWORD DWORD DWORD DWORD * steps
XML_DEPRECATED XMLPUBFUN int xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar *cur, int *len)
static unsigned __int64 next
void xmlDictFree(xmlDictPtr dict)
int xmlDictReference(xmlDictPtr dict)
const xmlChar * xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
xmlReallocFunc xmlRealloc
Character const *const prefix
XMLPUBFUN xmlChar * xmlStrndup(const xmlChar *cur, int len)
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)