+Wed Feb 25 16:35:01 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+ * libxslt/attributes.c libxslt/keys.h libxslt/preproc.c
+ libxslt/transform.c libxslt/variables.c libxslt/xsltutils.c:
+ First step toward _private cleanup: use the psvi field to store
+ the precompilation informations in the stylesheet nodes.
+
Wed Feb 25 14:24:34 CET 2004 Daniel Veillard <daniel@veillard.com>
* libxslt/variables.c: trying to use the fact that names comes
while (values != NULL) {
if (values->attr != NULL) {
xsltAttributeInternal(ctxt, node, values->attr,
- values->attr->_private, 1);
+ values->attr->psvi, 1);
}
values = values->next;
}
extern "C" {
#endif
+#define NODE_IS_KEYED (1 >> 15)
XSLTPUBFUN int XSLTCALL
xsltAddKey (xsltStylesheetPtr style,
const xmlChar *name,
comp = xsltNewStylePreComp(style, XSLT_FUNC_SORT);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->stype = xsltEvalStaticAttrValueTemplate(style, inst,
comp = xsltNewStylePreComp(style, XSLT_FUNC_COPY);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp = xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->noescape = 0;
comp = xsltNewStylePreComp(style, XSLT_FUNC_ELEMENT);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
comp = xsltNewStylePreComp(style, XSLT_FUNC_ATTRIBUTE);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
/*
comp = xsltNewStylePreComp(style, XSLT_FUNC_COMMENT);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
}
comp = xsltNewStylePreComp(style, XSLT_FUNC_PI);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
comp = xsltNewStylePreComp(style, XSLT_FUNC_COPYOF);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
comp = xsltNewStylePreComp(style, XSLT_FUNC_VALUEOF);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
prop = xsltGetCNsProp(style, inst,
comp = xsltNewStylePreComp(style, XSLT_FUNC_WITHPARAM);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
/*
comp = xsltNewStylePreComp(style, XSLT_FUNC_NUMBER);
if (comp == NULL)
return;
- cur->_private = comp;
+ cur->psvi = comp;
if ((style == NULL) || (cur == NULL))
return;
comp = xsltNewStylePreComp(style, XSLT_FUNC_APPLYIMPORTS);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
}
comp = xsltNewStylePreComp(style, XSLT_FUNC_CALLTEMPLATE);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
/*
comp = xsltNewStylePreComp(style, XSLT_FUNC_APPLYTEMPLATES);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
/*
comp = xsltNewStylePreComp(style, XSLT_FUNC_CHOOSE);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
}
comp = xsltNewStylePreComp(style, XSLT_FUNC_IF);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE);
comp = xsltNewStylePreComp(style, XSLT_FUNC_WHEN);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE);
comp = xsltNewStylePreComp(style, XSLT_FUNC_FOREACH);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
comp = xsltNewStylePreComp(style, XSLT_FUNC_VARIABLE);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
/*
comp = xsltNewStylePreComp(style, XSLT_FUNC_PARAM);
if (comp == NULL)
return;
- inst->_private = comp;
+ inst->psvi = comp;
comp->inst = inst;
/*
*/
void
xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) {
- if (inst->_private != NULL)
+ if (inst->psvi != NULL)
return;
if (IS_XSLT_ELEM(inst)) {
xsltStylePreCompPtr cur;
/* no computation needed */
return;
} else if (IS_XSLT_NAME(inst, "document")) {
- inst->_private = (void *) xsltDocumentComp(style, inst,
+ inst->psvi = (void *) xsltDocumentComp(style, inst,
(xsltTransformFunction) xsltDocumentElem);
} else {
xsltTransformError(NULL, style, inst,
* Add the namespace lookup here, this code can be shared by
* all precomputations.
*/
- cur = (xsltStylePreCompPtr) inst->_private;
+ cur = (xsltStylePreCompPtr) inst->psvi;
if (cur != NULL) {
int i = 0;
cur->nsNr = i;
}
} else {
- inst->_private =
+ inst->psvi =
(void *) xsltPreComputeExtModuleElement(style, inst);
/*
* Unknown element, maybe registered at the context
* level. Mark it for later recognition.
*/
- if (inst->_private == NULL)
- inst->_private = (void *) xsltExtMarker;
+ if (inst->psvi == NULL)
+ inst->psvi = (void *) xsltExtMarker;
}
}
/*
* This is an XSLT node
*/
- xsltStylePreCompPtr info = (xsltStylePreCompPtr) cur->_private;
+ xsltStylePreCompPtr info = (xsltStylePreCompPtr) cur->psvi;
if (info == NULL) {
if (IS_XSLT_NAME(cur, "message")) {
#endif
xsltCopyText(ctxt, insert, cur);
} else if ((cur->type == XML_ELEMENT_NODE) &&
- (cur->ns != NULL) && (cur->_private != NULL)) {
+ (cur->ns != NULL) && (cur->psvi != NULL)) {
xsltTransformFunction function;
/*
* Flagged as an extension element
*/
- if (cur->_private == xsltExtMarker)
+ if (cur->psvi == xsltExtMarker)
function = (xsltTransformFunction)
xsltExtElementLookup(ctxt, cur->name, cur->ns->href);
else
- function = ((xsltElemPreCompPtr) cur->_private)->func;
+ function = ((xsltElemPreCompPtr) cur->psvi)->func;
if (function == NULL) {
xmlNodePtr child;
#endif
ctxt->insert = insert;
- function(ctxt, node, cur, cur->_private);
+ function(ctxt, node, cur, cur->psvi);
ctxt->insert = oldInsert;
}
goto skip_children;
}
while ((IS_XSLT_ELEM(replacement) && (IS_XSLT_NAME(replacement, "when")))
|| xmlIsBlankNode(replacement)) {
- xsltStylePreCompPtr wcomp = replacement->_private;
+ xsltStylePreCompPtr wcomp = replacement->psvi;
if (xmlIsBlankNode(replacement)) {
replacement = replacement->next;
if ((cur == NULL) || (ctxt == NULL))
return(NULL);
- comp = (xsltStylePreCompPtr) cur->_private;
+ comp = (xsltStylePreCompPtr) cur->psvi;
if (comp == NULL) {
xsltTransformError(ctxt, NULL, cur,
"xsl:param : compilation error\n");
return;
xsltStylePreCompute(style, cur);
- comp = (xsltStylePreCompPtr) cur->_private;
+ comp = (xsltStylePreCompPtr) cur->psvi;
if (comp == NULL) {
xsltTransformError(NULL, style, cur,
"xsl:variable : compilation failed\n");
return;
xsltStylePreCompute(style, cur);
- comp = (xsltStylePreCompPtr) cur->_private;
+ comp = (xsltStylePreCompPtr) cur->psvi;
if (comp == NULL) {
xsltTransformError(NULL, style, cur,
"xsl:param : compilation failed\n");
if ((cur == NULL) || (ctxt == NULL))
return;
- comp = (xsltStylePreCompPtr) cur->_private;
+ comp = (xsltStylePreCompPtr) cur->psvi;
if (comp == NULL) {
xsltTransformError(ctxt, NULL, cur,
"xsl:variable : compilation failed\n");
if ((cur == NULL) || (ctxt == NULL))
return;
- comp = (xsltStylePreCompPtr) cur->_private;
+ comp = (xsltStylePreCompPtr) cur->psvi;
if (comp == NULL) {
xsltTransformError(ctxt, NULL, cur,
"xsl:param : compilation failed\n");
int oldNsNr;
xmlNsPtr *oldNamespaces;
- comp = sort->_private;
+ comp = sort->psvi;
if (comp == NULL) {
xsltGenericError(xsltGenericErrorContext,
"xsl:sort : compilation failed\n");
return;
if (sorts[0] == NULL)
return;
- comp = sorts[0]->_private;
+ comp = sorts[0]->psvi;
if (comp == NULL)
return;
return; /* nothing to do */
for (j = 0; j < nbsorts; j++) {
- comp = sorts[j]->_private;
+ comp = sorts[j]->psvi;
tempstype[j] = 0;
if ((comp->stype == NULL) && (comp->has_stype != 0)) {
comp->stype =
results = resultsTab[0];
- comp = sorts[0]->_private;
+ comp = sorts[0]->psvi;
descending = comp->descending;
number = comp->number;
if (results == NULL)
while (depth < nbsorts) {
if (sorts[depth] == NULL)
break;
- comp = sorts[depth]->_private;
+ comp = sorts[depth]->psvi;
if (comp == NULL)
break;
desc = comp->descending;
}
for (j = 0; j < nbsorts; j++) {
- comp = sorts[j]->_private;
+ comp = sorts[j]->psvi;
if (tempstype[j] == 1) {
/* The data-type needs to be recomputed each time */
xmlFree((void *)(comp->stype));