dbertoni 00/05/24 12:36:09
Modified: c/src/XPath XPath.cpp XPath.hpp XPathEnvSupport.hpp
XPathEnvSupportDefault.cpp
XPathEnvSupportDefault.hpp
XPathExecutionContext.hpp
XPathExecutionContextDefault.cpp
XPathExecutionContextDefault.hpp
XPathProcessorImpl.cpp
Log:
Fixed problem where the second operand of a union that was not a location
path would not execute. Implemented function-available() for built-in
functions. Made parameter names more consistent.
Revision Changes Path
1.18 +3 -3 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XPath.cpp 2000/05/11 19:05:43 1.17
+++ XPath.cpp 2000/05/24 19:36:03 1.18
@@ -1045,7 +1045,7 @@
XObject* resultNodeSet = 0;
- while(m_expression.m_opMap[opPos] == XPathExpression::eOP_LOCATIONPATH)
+ while(m_expression.m_opMap[opPos] != XPathExpression::eENDOP)
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
@@ -1291,12 +1291,12 @@
XalanNode*
context,
int
/* opPos */,
const XalanDOMString&
theNamespace,
- const XalanDOMString&
extensionName,
+ const XalanDOMString&
functionName,
const Function::XObjectArgVectorType& argVec,
XPathExecutionContext&
executionContext) const
{
return executionContext.extFunction(theNamespace,
-
extensionName,
+
functionName,
context,
argVec);
}
1.7 +1 -2 xml-xalan/c/src/XPath/XPath.hpp
Index: XPath.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XPath.hpp 2000/05/11 19:05:43 1.6
+++ XPath.hpp 2000/05/24 19:36:04 1.7
@@ -379,7 +379,6 @@
return s_functions.isInstalledFunction(theFunctionName);
}
- // $$$ What's this typedef for?
typedef XPathFunctionTable FunctionTableType;
/**
@@ -791,7 +790,7 @@
XalanNode*
context,
int
opPos,
const XalanDOMString&
theNamespace,
- const XalanDOMString&
extensionName,
+ const XalanDOMString&
functionName,
const Function::XObjectArgVectorType& argVec,
XPathExecutionContext&
executionContext) const;
1.9 +12 -10 xml-xalan/c/src/XPath/XPathEnvSupport.hpp
Index: XPathEnvSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupport.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XPathEnvSupport.hpp 2000/05/15 15:54:30 1.8
+++ XPathEnvSupport.hpp 2000/05/24 19:36:04 1.9
@@ -198,32 +198,34 @@
* Determine if an external element is available.
*
* @param theNamespace namespace for the element
- * @param extensionName name of extension element
- * @return whether the given element is available or not
+ * @param elementName name of extension element
+ * @return whether the element is available or not
*/
virtual bool
elementAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const = 0;
+ const XalanDOMString& elementName) const = 0;
/**
- * Determine if an external function is available.
+ * Determine if a function is available. For standard
+ * function availability, theNamespace should be an
+ * empty string.
*
- * @param theNamespace namespace for th function
- * @param extensionName name of extension function
- * @return whether the given function is available or not
+ * @param theNamespace namespace for the function
+ * @param functionName name of the function
+ * @return whether the function is available or not
*/
virtual bool
functionAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const = 0;
+ const XalanDOMString& functionName) const = 0;
/**
* Handle an extension function.
*
* @param executionContext current execution context
* @param theNamespace namespace of function
- * @param extensionName extension function name
+ * @param functionName extension function name
* @param argVec vector of arguments to function
* @return pointer to XObject result
*/
@@ -231,7 +233,7 @@
extFunction(
XPathExecutionContext&
executionContext,
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
XalanNode*
context,
const XObjectArgVectorType& argVec) const =
0;
1.11 +42 -33 xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp
Index: XPathEnvSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPathEnvSupportDefault.cpp 2000/05/15 15:54:30 1.10
+++ XPathEnvSupportDefault.cpp 2000/05/24 19:36:04 1.11
@@ -75,6 +75,7 @@
#include "SimpleNodeLocator.hpp"
#include "XObject.hpp"
#include "XObjectFactory.hpp"
+#include "XPath.hpp"
#include "XPathExecutionContext.hpp"
@@ -109,7 +110,7 @@
XPathEnvSupportDefault::updateFunctionTable(
NamespaceFunctionTablesType& theTable,
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
const Function*
function)
{
// See if there's a table for that namespace...
@@ -122,7 +123,7 @@
// 0, then add a clone of the function.
if (function != 0)
{
- theTable[theNamespace][extensionName] =
+ theTable[theNamespace][functionName] =
function->clone();
}
}
@@ -131,7 +132,7 @@
// There is already a table for the namespace,
// so look for the function...
const FunctionTableType::iterator j =
- i->second.find(extensionName);
+ i->second.find(functionName);
if (j == i->second.end())
{
@@ -139,13 +140,12 @@
// 0, then add a clone of the function.
if (function != 0)
{
- i->second[extensionName] = function->clone();
+ i->second[functionName] = function->clone();
}
}
else
{
// Found it, so delete the function...
-
delete j->second;
// If function is not 0, then we update
@@ -169,10 +169,10 @@
void
XPathEnvSupportDefault::installExternalFunctionGlobal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
const Function& function)
{
- updateFunctionTable(s_externalFunctions, theNamespace, extensionName,
&function);
+ updateFunctionTable(s_externalFunctions, theNamespace, functionName,
&function);
}
@@ -180,9 +180,9 @@
void
XPathEnvSupportDefault::uninstallExternalFunctionGlobal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName)
+ const XalanDOMString& functionName)
{
- updateFunctionTable(s_externalFunctions, theNamespace, extensionName,
0);
+ updateFunctionTable(s_externalFunctions, theNamespace, functionName, 0);
}
@@ -190,10 +190,10 @@
void
XPathEnvSupportDefault::installExternalFunctionLocal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
const Function& function)
{
- updateFunctionTable(m_externalFunctions, theNamespace, extensionName,
&function);
+ updateFunctionTable(m_externalFunctions, theNamespace, functionName,
&function);
}
@@ -201,9 +201,9 @@
void
XPathEnvSupportDefault::uninstallExternalFunctionLocal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName)
+ const XalanDOMString& functionName)
{
- updateFunctionTable(m_externalFunctions, theNamespace, extensionName,
0);
+ updateFunctionTable(m_externalFunctions, theNamespace, functionName, 0);
}
@@ -314,7 +314,7 @@
bool
XPathEnvSupportDefault::elementAvailable(
const XalanDOMString& /* theNamespace */,
- const XalanDOMString& /* extensionName */) const
+ const XalanDOMString& /* elementName */) const
{
return false;
}
@@ -324,24 +324,33 @@
bool
XPathEnvSupportDefault::functionAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const
+ const XalanDOMString& functionName) const
{
bool theResult = false;
-
- // See if there's a table for that namespace...
- const NamespaceFunctionTablesType::const_iterator i =
- m_externalFunctions.find(theNamespace);
- if (i != m_externalFunctions.end())
+ // Any function without a namespace prefix is considered
+ // to be an intrinsic function.
+ if (isEmpty(theNamespace) == true)
{
- // There is a table for the namespace,
- // so look for the function...
- const FunctionTableType::const_iterator j =
- i->second.find(extensionName);
+ theResult = XPath::isInstalledFunction(functionName);
+ }
+ else
+ {
+ // See if there's a table for that namespace...
+ const NamespaceFunctionTablesType::const_iterator i =
+ m_externalFunctions.find(theNamespace);
- if (j != i->second.end())
+ if (i != m_externalFunctions.end())
{
- theResult = true;
+ // There is a table for the namespace,
+ // so look for the function...
+ const FunctionTableType::const_iterator j =
+ i->second.find(functionName);
+
+ if (j != i->second.end())
+ {
+ theResult = true;
+ }
}
}
@@ -353,13 +362,13 @@
Function*
XPathEnvSupportDefault::findFunction(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const
+ const XalanDOMString& functionName) const
{
// First, look locally...
Function* theFunction = findFunction(
m_externalFunctions,
theNamespace,
- extensionName);
+ functionName);
if (theFunction == 0)
{
@@ -367,7 +376,7 @@
theFunction = findFunction(
s_externalFunctions,
theNamespace,
- extensionName);
+ functionName);
}
return theFunction;
@@ -379,7 +388,7 @@
XPathEnvSupportDefault::findFunction(
const NamespaceFunctionTablesType& theTable,
const XalanDOMString&
theNamespace,
- const XalanDOMString&
extensionName) const
+ const XalanDOMString&
functionName) const
{
Function* theFunction = 0;
@@ -392,7 +401,7 @@
// There is a table for the namespace,
// so look for the function...
const FunctionTableType::const_iterator j =
- i->second.find(extensionName);
+ i->second.find(functionName);
if (j != i->second.end())
{
@@ -412,13 +421,13 @@
XPathEnvSupportDefault::extFunction(
XPathExecutionContext&
executionContext,
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
XalanNode*
context,
const XObjectArgVectorType& argVec) const
{
XObject* theResult = 0;
- Function* const theFunction = findFunction(theNamespace,
extensionName);
+ Function* const theFunction = findFunction(theNamespace,
functionName);
if (theFunction != 0)
{
1.10 +17 -17 xml-xalan/c/src/XPath/XPathEnvSupportDefault.hpp
Index: XPathEnvSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupportDefault.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XPathEnvSupportDefault.hpp 2000/05/15 15:54:30 1.9
+++ XPathEnvSupportDefault.hpp 2000/05/24 19:36:04 1.10
@@ -96,25 +96,25 @@
* Install an external function in the global space.
*
* @param theNamespace The namespace for the functionl
- * @param extensionName The name of the function.
+ * @param functionName The name of the function.
* @param function The function to install.
*/
static void
installExternalFunctionGlobal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
const Function& function);
/**
* Uninstall an external function from the global space.
*
* @param theNamespace The namespace for the functionl
- * @param extensionName The name of the function.
+ * @param functionName The name of the function.
*/
static void
uninstallExternalFunctionGlobal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName);
+ const XalanDOMString& functionName);
// Interfaces to install and uninstall external functions in this
instance.
@@ -122,25 +122,25 @@
* Install an external function in the local space.
*
* @param theNamespace The namespace for the functionl
- * @param extensionName The name of the function.
+ * @param functionName The name of the function.
* @param function The function to install.
*/
virtual void
installExternalFunctionLocal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
const Function& function);
/**
* Uninstall an external function from the local space.
*
* @param theNamespace The namespace for the functionl
- * @param extensionName The name of the function.
+ * @param functionName The name of the function.
*/
virtual void
uninstallExternalFunctionLocal(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName);
+ const XalanDOMString& functionName);
// These interfaces are inherited from XPathEnvSupport...
@@ -180,18 +180,18 @@
virtual bool
elementAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const;
+ const XalanDOMString& elementName) const;
virtual bool
functionAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const;
+ const XalanDOMString& functionName) const;
virtual XObject*
extFunction(
XPathExecutionContext&
executionContext,
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
XalanNode*
context,
const XObjectArgVectorType& argVec) const;
@@ -239,13 +239,13 @@
* Find an external function.
*
* @param theNamespace The namespace for the function.
- * @param extensionName The name of the function.
+ * @param functionName The name of the function.
* @return a pointer to the function if found, or 0 if not found.
*/
virtual Function*
findFunction(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const;
+ const XalanDOMString& functionName) const;
private:
@@ -278,14 +278,14 @@
* the function will be added.
*
* @param theNamespace The namespace for the functionl
- * @param extensionName The name of the function.
+ * @param functionName The name of the function.
* @param function The function to install.
*/
static void
updateFunctionTable(
NamespaceFunctionTablesType& theTable,
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
const Function*
function);
/**
@@ -293,14 +293,14 @@
*
* @param theTable The table to search.
* @param theNamespace The namespace for the function.
- * @param extensionName The name of the function.
+ * @param functionName The name of the function.
* @return a pointer to the function if found, or 0 if not found.
*/
Function*
findFunction(
const NamespaceFunctionTablesType& theTable,
const XalanDOMString&
theNamespace,
- const XalanDOMString&
extensionName) const;
+ const XalanDOMString&
functionName) const;
// Data members...
1.13 +10 -8 xml-xalan/c/src/XPath/XPathExecutionContext.hpp
Index: XPathExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContext.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XPathExecutionContext.hpp 2000/05/15 15:54:30 1.12
+++ XPathExecutionContext.hpp 2000/05/24 19:36:05 1.13
@@ -283,38 +283,40 @@
* Determine if an external element is available.
*
* @param theNamespace namespace for the element
- * @param extensionName name of extension element
+ * @param elementName name of extension element
* @return whether the given element is available or not
*/
virtual bool
elementAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const = 0;
+ const XalanDOMString& elementName) const = 0;
/**
- * Determine if an external function is available.
+ * Determine if a function is available. For standard
+ * function availability, theNamespace should be an
+ * empty string.
*
* @param theNamespace namespace for the function
- * @param extensionName name of extension function
- * @return whether the given function is available or not
+ * @param functionName name of the function
+ * @return whether the function is available or not
*/
virtual bool
functionAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const = 0;
+ const XalanDOMString& functionName) const = 0;
/**
* Handle an extension function.
*
* @param theNamespace namespace of function
- * @param extensionName extension function name
+ * @param functionName extension function name
* @param argVec vector of arguments to function
* @return pointer to XObject result
*/
virtual XObject*
extFunction(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
XalanNode*
context,
const XObjectArgVectorType& argVec) = 0;
1.9 +6 -6 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XPathExecutionContextDefault.cpp 2000/05/15 15:54:31 1.8
+++ XPathExecutionContextDefault.cpp 2000/05/24 19:36:05 1.9
@@ -231,9 +231,9 @@
bool
XPathExecutionContextDefault::elementAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const
+ const XalanDOMString& elementName) const
{
- return m_xpathEnvSupport.elementAvailable(theNamespace, extensionName);
+ return m_xpathEnvSupport.elementAvailable(theNamespace, elementName);
}
@@ -241,9 +241,9 @@
bool
XPathExecutionContextDefault::functionAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const
+ const XalanDOMString& functionName) const
{
- return m_xpathEnvSupport.functionAvailable(theNamespace, extensionName);
+ return m_xpathEnvSupport.functionAvailable(theNamespace, functionName);
}
@@ -251,11 +251,11 @@
XObject*
XPathExecutionContextDefault::extFunction(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
XalanNode*
context,
const XObjectArgVectorType& argVec)
{
- return m_xpathEnvSupport.extFunction(*this, theNamespace,
extensionName, context, argVec);
+ return m_xpathEnvSupport.extFunction(*this, theNamespace, functionName,
context, argVec);
}
1.11 +4 -11 xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp
Index: XPathExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPathExecutionContextDefault.hpp 2000/05/15 15:54:31 1.10
+++ XPathExecutionContextDefault.hpp 2000/05/24 19:36:05 1.11
@@ -155,27 +155,20 @@
virtual int
getContextNodeListPosition(const XalanNode& contextNode)
const;
- /**
- * Determine if an external element is available.
- *
- * @param theNamespace namespace for the element
- * @param extensionName name of extension element
- * @return whether the given element is available or not
- */
virtual bool
elementAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const;
+ const XalanDOMString& elementName) const;
virtual bool
functionAvailable(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName) const;
+ const XalanDOMString& functionName) const;
virtual XObject*
extFunction(
const XalanDOMString& theNamespace,
- const XalanDOMString& extensionName,
+ const XalanDOMString& functionName,
XalanNode*
context,
const XObjectArgVectorType& argVec);
@@ -262,9 +255,9 @@
const XalanDOMString& theURI,
XalanDocument* theDocument);
-
virtual const XalanDecimalFormatSymbols*
getDecimalFormatSymbols(const XalanDOMString& name);
+
// These interfaces are inherited from ExecutionContext...
1.11 +11 -7 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPathProcessorImpl.cpp 2000/05/12 16:23:24 1.10
+++ XPathProcessorImpl.cpp 2000/05/24 19:36:05 1.11
@@ -1423,13 +1423,17 @@
}
nextToken();
- }
- else
- {
- break;
- }
+ }
+ else
+ {
+ if (foundUnion == true)
+ {
+ // Terminate for safety.
+
m_expression->appendOpCode(XPathExpression::eENDOP);
+ }
- // this.m_testForDocOrder = true;
+ break;
+ }
}
while(continueOrLoop == true);
@@ -2122,7 +2126,7 @@
void
XPathProcessorImpl::Pattern()
-{
+{
while(true)
{
LocationPathPattern();