dbertoni 2002/12/04 17:43:29
Modified: c/src/XPath XPath.cpp XPathExecutionContextDefault.cpp
XPathProcessorImpl.cpp XPathProcessorImpl.hpp
Log:
Remove use of exception throwing for last() in match pattern.
Revision Changes Path
1.82 +6 -2 xml-xalan/c/src/XPath/XPath.cpp
Index: XPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- XPath.cpp 26 Nov 2002 02:11:26 -0000 1.81
+++ XPath.cpp 5 Dec 2002 01:43:28 -0000 1.82
@@ -1671,7 +1671,9 @@
// if I could sense this condition earlier...
try
{
+#if 0
executionContext.setThrowFoundIndex(true);
+#endif
while(XPathExpression::eOP_PREDICATE == nextStepType ||
XPathExpression::eOP_PREDICATE_WITH_POSITION
== nextStepType)
@@ -1716,10 +1718,14 @@
nextStepType =
currentExpression.getOpCodeMapValue(opPos);
}
+#if 0
executionContext.setThrowFoundIndex(false);
+#endif
}
catch(const FoundIndex&)
{
+ executionContext.setThrowFoundIndex(false);
+
score = handleFoundIndex(executionContext, context,
startOpPos);
}
}
@@ -1746,8 +1752,6 @@
// localContext, then see if the current localContext is found in the
// node set. Seems crazy, but, so far, it seems like the
// easiest way.
- executionContext.setThrowFoundIndex(false);
-
XalanNode* const parentContext =
DOMServices::getParentOfNode(*localContext);
1.56 +9 -1 xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp
Index: XPathExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- XPathExecutionContextDefault.cpp 4 Dec 2002 21:45:40 -0000 1.55
+++ XPathExecutionContextDefault.cpp 5 Dec 2002 01:43:28 -0000 1.56
@@ -239,10 +239,14 @@
XPathExecutionContextDefault::size_type
XPathExecutionContextDefault::getContextNodeListLength() const
{
+#if 1
+ assert(m_throwFoundIndex == false);
+#else
if (m_throwFoundIndex == true)
{
throw FoundIndex();
}
+#endif
return m_contextNodeList->getLength();
}
@@ -252,15 +256,19 @@
XPathExecutionContextDefault::size_type
XPathExecutionContextDefault::getContextNodeListPosition(const XalanNode&
contextNode) const
{
+#if 1
+ assert(m_throwFoundIndex == false);
+#else
if (m_throwFoundIndex == true)
{
throw FoundIndex();
}
+#endif
if (m_cachedPosition.m_node == &contextNode)
{
assert((m_cachedPosition.m_index == 0 &&
m_contextNodeList->indexOf(&contextNode) == NodeRefListBase::npos) ||
- (m_contextNodeList->indexOf(&contextNode) + 1
== m_cachedPosition.m_index));
+ (m_contextNodeList->indexOf(&contextNode) + 1 ==
m_cachedPosition.m_index));
}
else
{
1.65 +12 -1 xml-xalan/c/src/XPath/XPathProcessorImpl.cpp
Index: XPathProcessorImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- XPathProcessorImpl.cpp 21 Nov 2002 01:26:18 -0000 1.64
+++ XPathProcessorImpl.cpp 5 Dec 2002 01:43:28 -0000 1.65
@@ -1611,6 +1611,7 @@
}
+
void
XPathProcessorImpl::FunctionCall()
{
@@ -1674,7 +1675,8 @@
int theFunctionID =
XPath::getFunctionTable().nameToID(m_token);
- if (equals(m_token, s_positionString) == true &&
+ if ((equals(m_token, s_positionString) == true
||
+ equals(m_token, s_lastString) == true)
&&
m_positionPredicateStack.empty() ==
false)
{
m_positionPredicateStack.back() = true;
@@ -2650,6 +2652,15 @@
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_d,
+ 0
+};
+
+const XalanDOMChar XPathProcessorImpl::s_lastString[] =
+{
+ XalanUnicode::charLetter_l,
+ XalanUnicode::charLetter_a,
+ XalanUnicode::charLetter_s,
+ XalanUnicode::charLetter_t,
0
};
1.27 +2 -0 xml-xalan/c/src/XPath/XPathProcessorImpl.hpp
Index: XPathProcessorImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.hpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- XPathProcessorImpl.hpp 21 Nov 2002 01:26:18 -0000 1.26
+++ XPathProcessorImpl.hpp 5 Dec 2002 01:43:28 -0000 1.27
@@ -841,6 +841,8 @@
static const XalanDOMChar s_childString[];
+ static const XalanDOMChar s_lastString[];
+
static const XalanDOMChar s_positionString[];
static const XalanDOMChar s_asteriskString[];
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]