dbertoni 01/07/08 11:48:42
Modified: c/src/XSLT ElemNumber.cpp ElemTemplate.cpp KeyTable.cpp
SelectionEvent.hpp Stylesheet.cpp
StylesheetExecutionContext.cpp
StylesheetExecutionContext.hpp StylesheetRoot.cpp
TraceListenerDefault.cpp VariablesStack.cpp
XalanTemplate.cpp XSLTEngineImpl.cpp
Log:
More efficient match score implementation.
Revision Changes Path
1.44 +9 -9 xml-xalan/c/src/XSLT/ElemNumber.cpp
Index: ElemNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- ElemNumber.cpp 2001/06/14 19:17:23 1.43
+++ ElemNumber.cpp 2001/07/08 18:48:39 1.44
@@ -249,7 +249,7 @@
{
if(fromMatchPattern->getMatchScore(contextCopy, *this,
executionContext) !=
- XPath::s_MatchScoreNone)
+ XPath::eMatchScoreNone)
{
break;
}
@@ -259,7 +259,7 @@
{
if(countMatchPattern->getMatchScore(contextCopy, *this,
executionContext) !=
- XPath::s_MatchScoreNone)
+ XPath::eMatchScoreNone)
{
break;
}
@@ -289,7 +289,7 @@
{
if(fromMatchPattern->getMatchScore(contextCopy, *this,
executionContext) !=
- XPath::s_MatchScoreNone)
+ XPath::eMatchScoreNone)
{
contextCopy = 0;
break;
@@ -300,7 +300,7 @@
{
if(countMatchPattern->getMatchScore(contextCopy, *this,
executionContext) !=
- XPath::s_MatchScoreNone)
+ XPath::eMatchScoreNone)
{
break;
}
@@ -551,7 +551,7 @@
fromMatchPattern->getMatchScore(
next,
*this,
- executionContext) !=
XPath::s_MatchScoreNone))
+ executionContext) !=
XPath::eMatchScoreNone))
{
pos = 0; // return 0 from function.
@@ -579,7 +579,7 @@
countMatchPattern->getMatchScore(
pos,
*this,
- executionContext) !=
XPath::s_MatchScoreNone))
+ executionContext) !=
XPath::eMatchScoreNone))
{
break;
}
@@ -596,7 +596,7 @@
countMatchPattern->getMatchScore(
pos,
*this,
- executionContext) !=
XPath::s_MatchScoreNone))
+ executionContext) !=
XPath::eMatchScoreNone))
{
break;
}
@@ -680,7 +680,7 @@
{
if((0 != m_fromMatchPattern) &&
(m_fromMatchPattern->getMatchScore(node, *this,
executionContext) !=
- XPath::s_MatchScoreNone))
+ XPath::eMatchScoreNone))
{
// The following if statement gives level="single"
different
// behavior from level="multiple", which seems
incorrect according
@@ -696,7 +696,7 @@
error(TranscodeFromLocalCodePage("Programmer error!
countMatchPattern should never be 0!"));
if(countMatchPattern->getMatchScore(node, *this,
executionContext) !=
- XPath::s_MatchScoreNone)
+ XPath::eMatchScoreNone)
{
ancestors.addNode(node);
1.15 +1 -1 xml-xalan/c/src/XSLT/ElemTemplate.cpp
Index: ElemTemplate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplate.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ElemTemplate.cpp 2001/03/09 16:19:59 1.14
+++ ElemTemplate.cpp 2001/07/08 18:48:39 1.15
@@ -91,7 +91,7 @@
m_matchPattern(0),
m_name(),
m_mode(),
- m_priority(XPath::s_MatchScoreNone)
+ m_priority(XPath::getMatchScoreValue(XPath::eMatchScoreNone))
{
const unsigned int nAttrs = atts.getLength();
1.15 +2 -2 xml-xalan/c/src/XSLT/KeyTable.cpp
Index: KeyTable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/KeyTable.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- KeyTable.cpp 2000/12/04 20:48:35 1.14
+++ KeyTable.cpp 2001/07/08 18:48:39 1.15
@@ -152,12 +152,12 @@
// the match attribute on xsl:key.
assert(kd.getMatchPattern() != 0);
- const double score =
+ const XPath::eMatchScore score =
kd.getMatchPattern()->getMatchScore(testNode,
resolver,
executionContext);
- if(score != XPath::s_MatchScoreNone)
+ if(score != XPath::eMatchScoreNone)
{
processKeyDeclaration(
m_keys,
1.7 +2 -1 xml-xalan/c/src/XSLT/SelectionEvent.hpp
Index: SelectionEvent.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/SelectionEvent.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SelectionEvent.hpp 2000/11/21 21:10:18 1.6
+++ SelectionEvent.hpp 2001/07/08 18:48:39 1.7
@@ -129,7 +129,8 @@
const XPath& m_xpath;
/**
- * The result of the selection.
+ * The result of the selection. If it's null, m_sourceNode
+ * was selected.
*/
const XObjectPtr m_selection;
1.59 +13 -9 xml-xalan/c/src/XSLT/Stylesheet.cpp
Index: Stylesheet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- Stylesheet.cpp 2001/06/29 18:53:18 1.58
+++ Stylesheet.cpp 2001/07/08 18:48:39 1.59
@@ -895,8 +895,12 @@
const ElemTemplate* bestMatchedRule = 0;
const MatchPattern2* bestMatchedPattern = 0; // Syncs with
bestMatchedRule
- double bestMatchPatPriority =
XPath::s_MatchScoreNone;
+ const double matchScoreNoneValue =
+ XPath::getMatchScoreValue(XPath::eMatchScoreNone);
+ double bestMatchPatPriority =
matchScoreNoneValue;
+
+
unsigned int nConflicts = 0;
// Use a stack-based array when possible...
@@ -924,12 +928,12 @@
{
const XalanDOMString* prevPat = 0;
const MatchPattern2* prevMatchPat = 0;
- double
prevMatchPatPriority = XPath::s_MatchScoreNone;
+ double
prevMatchPatPriority = matchScoreNoneValue;
do
{
const MatchPattern2* matchPat =
*theCurrentEntry;
- double
matchPatPriority = XPath::s_MatchScoreNone;
+ double
matchPatPriority = matchScoreNoneValue;
assert(matchPat != 0);
const ElemTemplate* const rule =
matchPat->getTemplate();
@@ -960,25 +964,25 @@
prevPat = patterns;
prevMatchPat = matchPat;
prevMatchPatPriority =
matchPatPriority;
- matchPatPriority =
XPath::s_MatchScoreNone;
+ matchPatPriority =
matchScoreNoneValue;
const XPath* const
xpath = matchPat->getExpression();
- double score =
+ XPath::eMatchScore
score =
xpath->getMatchScore(targetNode, *this, executionContext);
-
if(XPath::s_MatchScoreNone != score)
+
if(XPath::eMatchScoreNone != score)
{
const double
priorityVal = rule->getPriority();
const double
priorityOfRule
-
= (XPath::s_MatchScoreNone != priorityVal)
-
? priorityVal : score;
+
= (matchScoreNoneValue != priorityVal)
+
? priorityVal : XPath::getMatchScoreValue(score);
matchPatPriority = priorityOfRule;
const double
priorityOfBestMatched =
(0 != bestMatchedPattern) ?
bestMatchPatPriority :
-
XPath::s_MatchScoreNone;
+
matchScoreNoneValue;
if(priorityOfRule > priorityOfBestMatched)
{
1.9 +10 -17 xml-xalan/c/src/XSLT/StylesheetExecutionContext.cpp
Index: StylesheetExecutionContext.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StylesheetExecutionContext.cpp 2001/06/06 21:55:31 1.8
+++ StylesheetExecutionContext.cpp 2001/07/08 18:48:40 1.9
@@ -86,37 +86,30 @@
XalanNode*
sourceNode,
const ElemTemplateElement* targetTemplate)
:
m_executionContext(executionContext),
- m_savedStackFrameIndex(executionContext.getCurrentStackFrameIndex()),
- m_pushContextMarker(xslCallTemplateElement.hasVariables() ||
xslCallTemplateElement.hasParams())
+ m_savedStackFrameIndex(executionContext.getCurrentStackFrameIndex())
{
- if (m_pushContextMarker == true)
- {
- executionContext.pushContextMarker();
+ executionContext.pushContextMarker();
-
executionContext.setCurrentStackFrameIndex(m_savedStackFrameIndex);
+ executionContext.setCurrentStackFrameIndex(m_savedStackFrameIndex);
- if (xslCallTemplateElement.hasParams() == true)
- {
- executionContext.pushParams(
+ if (xslCallTemplateElement.hasParams() == true)
+ {
+ executionContext.pushParams(
xslCallTemplateElement,
sourceNode,
targetTemplate);
- }
-
- executionContext.setCurrentStackFrameIndex();
}
+
+ executionContext.setCurrentStackFrameIndex();
}
StylesheetExecutionContext::ParamsPushPop::~ParamsPushPop()
{
- if (m_pushContextMarker == true)
- {
- m_executionContext.popContextMarker();
+ m_executionContext.popContextMarker();
-
m_executionContext.setCurrentStackFrameIndex(m_savedStackFrameIndex);
- }
+ m_executionContext.setCurrentStackFrameIndex(m_savedStackFrameIndex);
}
1.59 +0 -2 xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- StylesheetExecutionContext.hpp 2001/06/25 20:17:18 1.58
+++ StylesheetExecutionContext.hpp 2001/07/08 18:48:40 1.59
@@ -827,8 +827,6 @@
StylesheetExecutionContext& m_executionContext;
const int
m_savedStackFrameIndex;
-
- const bool
m_pushContextMarker;
};
/**
1.48 +0 -4 xml-xalan/c/src/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- StylesheetRoot.cpp 2001/06/29 19:21:00 1.47
+++ StylesheetRoot.cpp 2001/07/08 18:48:40 1.48
@@ -161,10 +161,6 @@
StylesheetRoot::~StylesheetRoot()
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::for_each;
-#endif
-
delete m_defaultRule;
delete m_defaultTextRule;
delete m_defaultRootRule;
1.8 +9 -1 xml-xalan/c/src/XSLT/TraceListenerDefault.cpp
Index: TraceListenerDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/TraceListenerDefault.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TraceListenerDefault.cpp 2001/01/08 18:29:54 1.7
+++ TraceListenerDefault.cpp 2001/07/08 18:48:40 1.8
@@ -243,7 +243,15 @@
m_printWriter.print(ev.m_xpath.getExpression().getCurrentPattern());
m_printWriter.print(XALAN_STATIC_UCODE_STRING("\": "));
- if(ev.m_selection->getType() == XObject::eTypeNodeSet)
+ if (ev.m_selection.null() == true)
+ {
+ assert(ev.m_sourceNode != 0);
+ m_printWriter.println();
+
+ m_printWriter.print(XALAN_STATIC_UCODE_STRING(" "));
+
m_printWriter.println(DOMServices::getNodeData(*ev.m_sourceNode));
+ }
+ else if(ev.m_selection->getType() == XObject::eTypeNodeSet)
{
m_printWriter.println();
1.17 +4 -2 xml-xalan/c/src/XSLT/VariablesStack.cpp
Index: VariablesStack.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/VariablesStack.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- VariablesStack.cpp 2001/06/22 17:16:48 1.16
+++ VariablesStack.cpp 2001/07/08 18:48:40 1.17
@@ -476,7 +476,9 @@
{
StackEntry& theEntry = m_stack[i];
- if(theEntry.getType() == StackEntry::eVariable)
+ const StackEntry::eType theType =
theEntry.getType();
+
+ if(theType == StackEntry::eVariable)
{
assert(theEntry.getName() != 0);
@@ -487,7 +489,7 @@
break;
}
}
- else if(theEntry.getType() ==
StackEntry::eContextMarker)
+ else if(theType == StackEntry::eContextMarker)
{
break;
}
1.26 +0 -2 xml-xalan/c/src/XSLT/XalanTemplate.cpp
Index: XalanTemplate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XalanTemplate.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- XalanTemplate.cpp 2001/07/01 14:42:34 1.25
+++ XalanTemplate.cpp 2001/07/08 18:48:40 1.26
@@ -199,8 +199,6 @@
static FormatterToHTML::ElementFlagsMapType theElementFlagsMapType;
static XPathExpression::TokenQueueType theTokenQueueType;
static set<const XalanNode*,less<const XalanNode*> > theXalanNodeSet;
-static XPathExpression::OpCodeLengthMapType theOpCodeLengthMapType;
-static XPathExpression::OpCodeMapValueType theOpCodeMapValueType;
static XPathExecutionContext::XObjectArgVectorType theVector;
static XPathProcessorImpl::NodeTypesMapType theNodeTypesMapType;
static Stylesheet::PatternTableListType thePatternTableList;
1.106 +6 -6 xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- XSLTEngineImpl.cpp 2001/07/01 14:43:17 1.105
+++ XSLTEngineImpl.cpp 2001/07/08 18:48:40 1.106
@@ -2850,8 +2850,8 @@
static_cast<const
XalanElement*>(parent);
#endif
- double highPreserveScore =
XPath::s_MatchScoreNone;
- double highStripScore =
XPath::s_MatchScoreNone;
+ XPath::eMatchScore
highPreserveScore = XPath::eMatchScoreNone;
+ XPath::eMatchScore
highStripScore = XPath::eMatchScoreNone;
ElementPrefixResolverProxy
theProxy(parentElem, m_xpathEnvSupport, m_domSupport);
@@ -2871,7 +2871,7 @@
const XPath*
const matchPat = theElements[i];
assert(matchPat
!= 0);
- const double
score = matchPat->getMatchScore(parent, theProxy, executionContext);
+ const
XPath::eMatchScore score = matchPat->getMatchScore(parent, theProxy,
executionContext);
if(score >
highPreserveScore)
highPreserveScore = score;
@@ -2893,15 +2893,15 @@
theElements[i];
assert(matchPat
!= 0);
- const double
score = matchPat->getMatchScore(parent, theProxy, executionContext);
+ const
XPath::eMatchScore score = matchPat->getMatchScore(parent, theProxy,
executionContext);
if(score >
highStripScore)
highStripScore = score;
}
}
- if(highPreserveScore >
XPath::s_MatchScoreNone ||
- highStripScore >
XPath::s_MatchScoreNone)
+ if(highPreserveScore >
XPath::eMatchScoreNone ||
+ highStripScore >
XPath::eMatchScoreNone)
{
if(highPreserveScore >
highStripScore)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]