dbertoni    2003/01/02 09:39:09

  Modified:    c/src/XPath XBoolean.cpp XBoolean.hpp XObject.cpp
                        XObject.hpp XPath.cpp XPath.hpp XPathExpression.cpp
                        XPathExpression.hpp XPathInit.cpp
                        XPathProcessorImpl.cpp XPathProcessorImpl.hpp
  Log:
  Changes for new type-specific XPath execution and "inlining" of function 
calls.
  
  Revision  Changes    Path
  1.16      +3 -34     xml-xalan/c/src/XPath/XBoolean.cpp
  
  Index: XBoolean.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XBoolean.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XBoolean.cpp      21 Nov 2002 01:26:18 -0000      1.15
  +++ XBoolean.cpp      2 Jan 2003 17:39:08 -0000       1.16
  @@ -71,12 +71,6 @@
   
   
   
  -XalanDOMString       XBoolean::s_falseString;
  -
  -XalanDOMString       XBoolean::s_trueString;
  -
  -
  -
   XBoolean::XBoolean(bool              val) :
        XObject(eTypeBoolean),
        m_value(val)
  @@ -122,7 +116,7 @@
   double
   XBoolean::num() const
   {
  -     return m_value == true ? 1.0 : 0.0;
  +     return number(m_value);
   }
   
   
  @@ -138,7 +132,7 @@
   const XalanDOMString&
   XBoolean::str() const
   {
  -     return m_value == true ? s_trueString : s_falseString;
  +     return string(m_value);
   }
   
   
  @@ -148,14 +142,7 @@
                        FormatterListener&      formatterListener,
                        MemberFunctionPtr       function) const
   {
  -     if (m_value == true)
  -     {
  -             (formatterListener.*function)(c_wstr(s_trueString), 
FormatterListener::size_type(length(s_trueString)));
  -     }
  -     else
  -     {
  -             (formatterListener.*function)(c_wstr(s_falseString), 
FormatterListener::size_type(length(s_falseString)));
  -     }
  +     string(m_value, formatterListener, function);
   }
   
   
  @@ -182,24 +169,6 @@
   {
        theCallbackObject.Boolean(*this,
                                                          boolean());
  -}
  -
  -
  -
  -void
  -XBoolean::initialize()
  -{
  -     s_falseString = XALAN_STATIC_UCODE_STRING("false");
  -     s_trueString = XALAN_STATIC_UCODE_STRING("true");
  -}
  -
  -
  -
  -void
  -XBoolean::terminate()
  -{
  -     releaseMemory(s_falseString);
  -     releaseMemory(s_trueString);
   }
   
   
  
  
  
  1.13      +0 -16     xml-xalan/c/src/XPath/XBoolean.hpp
  
  Index: XBoolean.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XBoolean.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XBoolean.hpp      21 Nov 2002 01:26:18 -0000      1.12
  +++ XBoolean.hpp      2 Jan 2003 17:39:08 -0000       1.13
  @@ -78,18 +78,6 @@
   public:
   
        /**
  -      * Perform static initialization.  See class XPathInit.
  -      */
  -     static void
  -     initialize();
  -
  -     /**
  -      * Perform static shut down.  See class XPathInit.
  -      */
  -     static void
  -     terminate();
  -
  -     /**
         * Construct an XBoolean object from a boolean value
         * 
         * @param val           boolean value to initialize object
  @@ -139,10 +127,6 @@
   private:
   
        bool    m_value;
  -
  -     static XalanDOMString   s_falseString;
  -
  -     static XalanDOMString   s_trueString;
   };
   
   
  
  
  
  1.31      +22 -0     xml-xalan/c/src/XPath/XObject.cpp
  
  Index: XObject.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.cpp,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- XObject.cpp       21 Nov 2002 01:26:18 -0000      1.30
  +++ XObject.cpp       2 Jan 2003 17:39:08 -0000       1.31
  @@ -81,7 +81,29 @@
   
   
   
  +XalanDOMString       XObject::s_falseString;
  +
  +XalanDOMString       XObject::s_trueString;
  +
   const XalanDOMString XObject::s_nullString;
  +
  +
  +
  +void
  +XObject::initialize()
  +{
  +     s_falseString = XALAN_STATIC_UCODE_STRING("false");
  +     s_trueString = XALAN_STATIC_UCODE_STRING("true");
  +}
  +
  +
  +
  +void
  +XObject::terminate()
  +{
  +     releaseMemory(s_falseString);
  +     releaseMemory(s_trueString);
  +}
   
   
   
  
  
  
  1.25      +166 -0    xml-xalan/c/src/XPath/XObject.hpp
  
  Index: XObject.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.hpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- XObject.hpp       21 Nov 2002 01:26:18 -0000      1.24
  +++ XObject.hpp       2 Jan 2003 17:39:08 -0000       1.25
  @@ -68,11 +68,17 @@
   
   
   
  +#include <PlatformSupport/DoubleSupport.hpp>
   #include <PlatformSupport/FormatterListener.hpp>
   #include <PlatformSupport/XalanReferenceCountedObject.hpp>
   
   
   
  +#include <DOMSupport/DOMServices.hpp>
  +
  +
  +
  +#include <XPath/NodeRefListBase.hpp>
   #include <XPath/XalanXPathException.hpp>
   
   
  @@ -121,6 +127,18 @@
                                                };
   
        /**
  +      * Perform static initialization.  See class XPathInit.
  +      */
  +     static void
  +     initialize();
  +
  +     /**
  +      * Perform static shut down.  See class XPathInit.
  +      */
  +     static void
  +     terminate();
  +
  +     /**
         * Create an XObject.
         *
         * @param theObjectType The enum for the type of the object.
  @@ -314,6 +332,148 @@
                return m_objectType;
        }
   
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return bool value
  +      */
  +     static bool
  +     boolean(double  theNumber)
  +     {
  +             return DoubleSupport::isNaN(theNumber) || 
DoubleSupport::isPositiveZero(theNumber) ? false : true;
  +     }
  +
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return bool value
  +      */
  +     static bool
  +     boolean(const XalanDOMString&   theString)
  +     {
  +             return theString.length() == 0 ? false : true;
  +     }
  +
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return bool value
  +      */
  +     static bool
  +     boolean(const NodeRefListBase&  theNodeList)
  +     {
  +             return theNodeList.getLength() == 0 ? false : true;
  +     }
  +
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return The string value of the number
  +      */
  +     static const XalanDOMString&
  +     string(bool             theBool)
  +     {
  +             return theBool == true ? s_trueString : s_falseString;
  +     }
  +
  +     static void
  +     string(
  +                     bool                            theBool,
  +                     FormatterListener&      formatterListener,
  +                     MemberFunctionPtr       function)
  +     {
  +             if(theBool == true)
  +             {
  +                     (formatterListener.*function)(s_trueString.c_str(), 
s_trueString.length());
  +             }
  +             else
  +             {
  +                     (formatterListener.*function)(s_falseString.c_str(), 
s_falseString.length());
  +             }
  +     }
  +
  +     static void
  +     string(
  +                     const NodeRefListBase&  theNodeList,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function)
  +     {
  +             if (theNodeList.getLength() > 0)
  +             {
  +                     assert(theNodeList.item(0) != 0);
  +
  +                     DOMServices::getNodeData(*theNodeList.item(0), 
formatterListener, function);
  +             }
  +     }
  +
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return The string value of the number
  +      */
  +     static void
  +     string(
  +                     double                          theNumber,
  +                     XalanDOMString&         theString)
  +     {
  +             DoubleToDOMString(theNumber, theString);
  +     }
  +
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return The string value of the node list
  +      */
  +     static void
  +     string(
  +                     const NodeRefListBase&  theNodeList,
  +                     XalanDOMString&                 theString)
  +     {
  +             if (theNodeList.getLength() > 0)
  +             {
  +                     assert(theNodeList.item(0) != 0);
  +
  +                     DOMServices::getNodeData(*theNodeList.item(0), 
theString);
  +             }
  +     }
  +
  +     static void
  +     string(
  +                     double                          theNumber,
  +                     FormatterListener&      formatterListener,
  +                     MemberFunctionPtr       function)
  +     {
  +             DOMStringHelper::DoubleToCharacters(theNumber, 
formatterListener, function);
  +     }
  +
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return bool value
  +      */
  +     static double
  +     number(bool             theBoolean)
  +     {
  +             return theBoolean == true ? 1.0 : 0.0;
  +     }
  +
  +     static double
  +     number(const XalanDOMString&    theString)
  +     {
  +             return DoubleSupport::toDouble(theString);
  +     }
  +
  +     /**
  +      * Static conversion function.
  +      *
  +      * @return The number value of the node list
  +      */
  +     static double
  +     number(
  +                     XPathExecutionContext&          executionContext,
  +                     const MutableNodeRefList&       theNodeList);
  +
  +
        // All XObject instances are controlled by an instance of an 
XObjectFactory.
        friend class XObjectFactory;
   
  @@ -393,6 +553,12 @@
        ~XObject();
   
        static const XalanDOMString             s_nullString;
  +
  +protected:
  +
  +     static XalanDOMString   s_falseString;
  +
  +     static XalanDOMString   s_trueString;
   
   private:
   
  
  
  
  1.84      +1218 -229 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.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- XPath.cpp 21 Dec 2002 00:56:37 -0000      1.83
  +++ XPath.cpp 2 Jan 2003 17:39:08 -0000       1.84
  @@ -116,6 +116,37 @@
   
   
   
  +void
  +XPath::unknownOpCodeError(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext,
  +                     int                                             opPos) 
const
  +{
  +     XalanDOMString  theMessage("Unknown op code: ");
  +                     
  +     LongToDOMString(m_expression.getOpCodeMapValue(opPos), theMessage);
  +
  +     executionContext.error(
  +                     theMessage,
  +                     context,
  +                     m_locator);
  +}
  +
  +
  +
  +void
  +XPath::notNodeSetError(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     executionContext.error(
  +             "The expression does not evaluate to a node-set",
  +             context,
  +             m_locator);
  +}
  +
  +
  +
   const XObjectPtr
   XPath::execute(
                        XalanNode*                              context,
  @@ -127,147 +158,854 @@
                                                                        
executionContext,
                                                                        
&prefixResolver);
   
  -     // Push and pop the current node...
  -     XPathExecutionContext::CurrentNodeSetAndRestore         
theNodeSetAndRestore(
  -                                                                     
executionContext,
  -                                                                     
context);
  +     // Push and pop the current node...
  +     XPathExecutionContext::CurrentNodeSetAndRestore         
theNodeSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
context);
  +
  +     return executeMore(context, 0, executionContext);
  +}
  +
  +
  +
  +void
  +XPath::execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     bool&                                   result) const
  +{
  +     // Push and pop the PrefixResolver...
  +     XPathExecutionContext::PrefixResolverSetAndRestore      
theResolverSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
&prefixResolver);
  +
  +     // Push and pop the current node...
  +     XPathExecutionContext::CurrentNodeSetAndRestore         
theNodeSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
context);
  +
  +     executeMore(context, 0, executionContext, result);
  +}
  +
  +
  +
  +void
  +XPath::execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 result) const
  +{
  +     // Push and pop the PrefixResolver...
  +     XPathExecutionContext::PrefixResolverSetAndRestore      
theResolverSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
&prefixResolver);
  +
  +     // Push and pop the current node...
  +     XPathExecutionContext::CurrentNodeSetAndRestore         
theNodeSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
context);
  +
  +     executeMore(context, 0, executionContext, result);
  +}
  +
  +
  +
  +void
  +XPath::execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 result) const
  +{
  +     // Push and pop the PrefixResolver...
  +     XPathExecutionContext::PrefixResolverSetAndRestore      
theResolverSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
&prefixResolver);
  +
  +     // Push and pop the current node...
  +     XPathExecutionContext::CurrentNodeSetAndRestore         
theNodeSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
context);
  +
  +     executeMore(context, 0, executionContext, result);
  +}
  +
  +
  +
  +void
  +XPath::execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
  +{
  +     // Push and pop the PrefixResolver...
  +     XPathExecutionContext::PrefixResolverSetAndRestore      
theResolverSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
&prefixResolver);
  +
  +     // Push and pop the current node...
  +     XPathExecutionContext::CurrentNodeSetAndRestore         
theNodeSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
context);
  +
  +     executeMore(context, 0, executionContext, formatterListener, function);
  +}
  +
  +
  +
  +const XObjectPtr
  +XPath::execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const
  +{
  +     // Push and pop the PrefixResolver...
  +     XPathExecutionContext::PrefixResolverSetAndRestore      
theResolverSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
&prefixResolver);
  +
  +     // Push and pop the current node...
  +     XPathExecutionContext::CurrentNodeSetAndRestore         
theNodeSetAndRestore(
  +                                                                     
executionContext,
  +                                                                     
context);
  +
  +     return executeMore(context, 0, executionContext, result);
  +}
  +
  +
  +
  +const XObjectPtr
  +XPath::executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     switch(m_expression.getOpCodeMapValue(opPos))
  +     {
  +     case XPathExpression::eOP_XPATH:
  +             return executeMore(context, opPos + 2, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_OR:
  +             return 
executionContext.getXObjectFactory().createBoolean(Or(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_AND:
  +             return 
executionContext.getXObjectFactory().createBoolean(And(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_NOTEQUALS:
  +             return 
executionContext.getXObjectFactory().createBoolean(notequals(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_EQUALS:
  +             return 
executionContext.getXObjectFactory().createBoolean(equals(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_LTE:
  +             return 
executionContext.getXObjectFactory().createBoolean(lte(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_LT:
  +             return 
executionContext.getXObjectFactory().createBoolean(lt(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_GTE:
  +             return 
executionContext.getXObjectFactory().createBoolean(gte(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_GT:
  +             return 
executionContext.getXObjectFactory().createBoolean(gt(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_PLUS:
  +             return 
executionContext.getXObjectFactory().createNumber(plus(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_MINUS:
  +             return 
executionContext.getXObjectFactory().createNumber(minus(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_MULT:
  +             return 
executionContext.getXObjectFactory().createNumber(mult(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_DIV:
  +             return 
executionContext.getXObjectFactory().createNumber(div(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_MOD:
  +             return 
executionContext.getXObjectFactory().createNumber(mod(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_NEG:
  +             return 
executionContext.getXObjectFactory().createNumber(neg(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_UNION:
  +             return Union(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_LITERAL:
  +             return literal(opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_VARIABLE:
  +             return variable(opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_GROUP:
  +             return group(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_NUMBERLIT:
  +             return numberlit(opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_ARGUMENT:
  +             return arg(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_EXTFUNCTION:
  +             return runExtFunction(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION:
  +             return runFunction(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_LOCATIONPATH:
  +             return locationPath(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_POSITION:
  +             return functionPositionGeneric(context, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_LAST:
  +             return functionLastGeneric(executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_COUNT:
  +             return functionCountGeneric(context, opPos, executionContext);
  +             break;
  +
  +     default:
  +             unknownOpCodeError(context, executionContext, opPos);
  +             break;
  +     }
  +
  +     return XObjectPtr();
  +}
  +
  +
  +
  +void
  +XPath::executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     bool&                                   result) const
  +{
  +     switch(m_expression.getOpCodeMapValue(opPos))
  +     {
  +     case XPathExpression::eOP_XPATH:
  +             executeMore(context, opPos + 2, executionContext, result);
  +             break;
  +
  +     case XPathExpression::eOP_OR:
  +             result = Or(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_AND:
  +             result = And(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_NOTEQUALS:
  +             result = notequals(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_EQUALS:
  +             result = equals(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_LTE:
  +             result = lte(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_LT:
  +             result = lt(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_GTE:
  +             result = gte(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_GT:
  +             result = gt(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_PLUS:
  +             result = XObject::boolean(plus(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_MINUS:
  +             result = XObject::boolean(minus(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_MULT:
  +             result = XObject::boolean(mult(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_DIV:
  +             result = XObject::boolean(div(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_MOD:
  +             result = XObject::boolean(mod(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_NEG:
  +             result = XObject::boolean(neg(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_UNION:
  +             result = Union(context, opPos, executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_LITERAL:
  +             result = literal(opPos, executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_VARIABLE:
  +             result = variable(opPos, executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_GROUP:
  +             result = group(context, opPos, executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_NUMBERLIT:
  +             result = XObject::boolean(numberlit(opPos));
  +             break;
  +
  +     case XPathExpression::eOP_ARGUMENT:
  +             result = arg(context, opPos, executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_EXTFUNCTION:
  +             result = runExtFunction(context, opPos, 
executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION:
  +             result = runFunction(context, opPos, 
executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_LOCATIONPATH:
  +             result = locationPath(context, opPos, 
executionContext)->boolean();
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_POSITION:
  +             result = XObject::boolean(functionPosition(context, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_LAST:
  +             result = XObject::boolean(functionLast(executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_COUNT:
  +             result = XObject::boolean(functionCount(context, opPos, 
executionContext));
  +             break;
  +
  +     default:
  +             unknownOpCodeError(context, executionContext, opPos);
  +             break;
  +     }
  +}
  +
  +
  +
  +void
  +XPath::executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 result) const
  +{
  +     switch(m_expression.getOpCodeMapValue(opPos))
  +     {
  +     case XPathExpression::eOP_XPATH:
  +             executeMore(context, opPos + 2, executionContext, result);
  +             break;
  +
  +     case XPathExpression::eOP_OR:
  +             result = XObject::number(Or(context, opPos, executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_AND:
  +             result = XObject::number(And(context, opPos, executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_NOTEQUALS:
  +             result = XObject::number(notequals(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_EQUALS:
  +             result = XObject::number(equals(context, opPos, 
executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_LTE:
  +             result = XObject::number(lte(context, opPos, executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_LT:
  +             result = XObject::number(lt(context, opPos, executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_GTE:
  +             result = XObject::number(gte(context, opPos, executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_GT:
  +             result = XObject::number(gt(context, opPos, executionContext));
  +             break;
  +
  +     case XPathExpression::eOP_PLUS:
  +             result = plus(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_MINUS:
  +             result = minus(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_MULT:
  +             result = mult(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_DIV:
  +             result = div(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_MOD:
  +             result = mod(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_NEG:
  +             result = neg(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_UNION:
  +             result = Union(context, opPos, executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_LITERAL:
  +             result = literal(opPos, executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_VARIABLE:
  +             result = variable(opPos, executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_GROUP:
  +             result = group(context, opPos, executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_NUMBERLIT:
  +             result = numberlit(opPos);
  +             break;
  +
  +     case XPathExpression::eOP_ARGUMENT:
  +             result = arg(context, opPos, executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_EXTFUNCTION:
  +             result = runExtFunction(context, opPos, 
executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION:
  +             result = runFunction(context, opPos, executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_LOCATIONPATH:
  +             result = locationPath(context, opPos, executionContext)->num();
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_POSITION:
  +             result = functionPosition(context, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_LAST:
  +             result = functionLast(executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_COUNT:
  +             result = functionCount(context, opPos, executionContext);
  +             break;
  +
  +     default:
  +             unknownOpCodeError(context, executionContext, opPos);
  +             break;
  +     }
  +}
  +
  +
  +
  +void
  +XPath::executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 result) const
  +{
  +     switch(m_expression.getOpCodeMapValue(opPos))
  +     {
  +     case XPathExpression::eOP_XPATH:
  +             executeMore(context, opPos + 2, executionContext, result);
  +             break;
  +
  +     case XPathExpression::eOP_OR:
  +             XObject::string(Or(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_AND:
  +             XObject::string(And(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_NOTEQUALS:
  +             XObject::string(notequals(context, opPos, executionContext), 
result);
  +             break;
  +
  +     case XPathExpression::eOP_EQUALS:
  +             XObject::string(equals(context, opPos, executionContext), 
result);
  +             break;
  +
  +     case XPathExpression::eOP_LTE:
  +             XObject::string(lte(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_LT:
  +             XObject::string(lt(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_GTE:
  +             XObject::string(gte(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_GT:
  +             XObject::string(gt(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_PLUS:
  +             XObject::string(plus(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_MINUS:
  +             XObject::string(minus(context, opPos, executionContext), 
result);
  +             break;
  +
  +     case XPathExpression::eOP_MULT:
  +             XObject::string(mult(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_DIV:
  +             XObject::string(div(context, opPos, executionContext), result);
  +             break;
   
  -     return executeMore(context, 0, executionContext);
  +     case XPathExpression::eOP_MOD:
  +             XObject::string(mod(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_NEG:
  +             XObject::string(neg(context, opPos, executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_UNION:
  +             Union(context, opPos, executionContext)->str(result);
  +             break;
  +
  +     case XPathExpression::eOP_LITERAL:
  +             literal(opPos, result);
  +             break;
  +
  +     case XPathExpression::eOP_VARIABLE:
  +             variable(opPos, executionContext)->str(result);
  +             break;
  +
  +     case XPathExpression::eOP_GROUP:
  +             group(context, opPos, executionContext)->str(result);
  +             break;
  +
  +     case XPathExpression::eOP_NUMBERLIT:
  +             numberlit(opPos, result);
  +             break;
  +
  +     case XPathExpression::eOP_ARGUMENT:
  +             arg(context, opPos, executionContext)->str(result);
  +             break;
  +
  +     case XPathExpression::eOP_EXTFUNCTION:
  +             runExtFunction(context, opPos, executionContext)->str(result);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION:
  +             runFunction(context, opPos, executionContext)->str(result);
  +             break;
  +
  +     case XPathExpression::eOP_LOCATIONPATH:
  +             locationPath(context, opPos, executionContext)->str(result);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_POSITION:
  +             XObject::string(functionPosition(context, executionContext), 
result);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_LAST:
  +             XObject::string(functionLast(executionContext), result);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_COUNT:
  +             XObject::string(functionCount(context, opPos, 
executionContext), result);
  +             break;
  +
  +     default:
  +             unknownOpCodeError(context, executionContext, opPos);
  +             break;
  +     }
   }
   
   
   
  -const XObjectPtr
  +void
   XPath::executeMore(
                        XalanNode*                              context,
                        int                                     opPos,
  -                     XPathExecutionContext&  executionContext) const
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
   {
        switch(m_expression.getOpCodeMapValue(opPos))
        {
        case XPathExpression::eOP_XPATH:
  -             return executeMore(context, opPos + 2, executionContext);
  -             break;
  -
  -     case XPathExpression::eOP_MATCHPATTERN:
  -             return matchPattern(context, opPos + 2, executionContext);
  +             executeMore(context, opPos + 2, executionContext, 
formatterListener, function);
                break;
   
        case XPathExpression::eOP_OR:
  -             return Or(context, opPos, executionContext);
  +             XObject::string(
  +                             Or(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_AND:
  -             return And(context, opPos, executionContext);
  +             XObject::string(
  +                             And(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_NOTEQUALS:
  -             return notequals(context, opPos, executionContext);
  +             XObject::string(
  +                             notequals(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_EQUALS:
  -             return equals(context, opPos, executionContext);
  +             XObject::string(
  +                             equals(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_LTE:
  -             return lte(context, opPos, executionContext);
  +             XObject::string(
  +                             lte(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_LT:
  -             return lt(context, opPos, executionContext);
  +             XObject::string(
  +                             lt(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_GTE:
  -             return gte(context, opPos, executionContext);
  +             XObject::string(
  +                             gte(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_GT:
  -             return gt(context, opPos, executionContext);
  +             XObject::string(
  +                             gt(context, opPos, executionContext),
  +                             formatterListener,
  +                             function);
                break;
   
        case XPathExpression::eOP_PLUS:
  -             return plus(context, opPos, executionContext);
  +             plus(context, opPos, executionContext, formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_MINUS:
  -       return minus(context, opPos, executionContext);
  -       break;
  +             minus(context, opPos, executionContext, formatterListener, 
function);
  +             break;
   
        case XPathExpression::eOP_MULT:
  -             return mult(context, opPos, executionContext);
  +             mult(context, opPos, executionContext, formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_DIV:
  -             return div(context, opPos, executionContext);
  +             div(context, opPos, executionContext, formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_MOD:
  -             return mod(context, opPos, executionContext);
  +             mod(context, opPos, executionContext, formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_NEG:
  -             return neg(context, opPos, executionContext);
  -             break;
  -
  -     case XPathExpression::eOP_BOOL:
  -             return boolean(context, opPos, executionContext);
  +             neg(context, opPos, executionContext, formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_UNION:
  -             return Union(context, opPos, executionContext);
  +             Union(context, opPos, executionContext)->str(formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_LITERAL:
  -             return literal(context, opPos, executionContext);
  +             literal(opPos, formatterListener, function);
                break;
   
        case XPathExpression::eOP_VARIABLE:
  -       return variable(context, opPos, executionContext);
  -       break;
  +             variable(opPos, executionContext)->str(formatterListener, 
function);
  +             break;
   
        case XPathExpression::eOP_GROUP:
  -             return group(context, opPos, executionContext);
  +             group(context, opPos, executionContext)->str(formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_NUMBERLIT:
  -             return numberlit(context, opPos, executionContext);
  +             numberlit(opPos, formatterListener, function);
                break;
   
        case XPathExpression::eOP_ARGUMENT:
  -             return arg(context, opPos, executionContext);
  +             arg(context, opPos, executionContext)->str(formatterListener, 
function);
                break;
   
        case XPathExpression::eOP_EXTFUNCTION:
  -             return runExtFunction(context, opPos, executionContext);
  +             runExtFunction(context, opPos, 
executionContext)->str(formatterListener, function);
                break;
   
        case XPathExpression::eOP_FUNCTION:
  -             return runFunction(context, opPos, executionContext);
  +             runFunction(context, opPos, 
executionContext)->str(formatterListener, function);
                break;
   
        case XPathExpression::eOP_LOCATIONPATH:
  -             return locationPath(context, opPos, executionContext);
  +             locationPath(context, opPos, executionContext, 
formatterListener, function);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_POSITION:
  +             XObject::string(functionPosition(context, executionContext), 
formatterListener, function);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION_LAST:
  +             XObject::string(functionLast(executionContext), 
formatterListener, function);
                break;
   
  -     case XPathExpression::eOP_LOCATIONPATHPATTERN:
  -             return locationPathPattern(context, opPos, executionContext);
  +     case XPathExpression::eOP_FUNCTION_COUNT:
  +             XObject::string(functionCount(context, opPos, 
executionContext), formatterListener, function);
                break;
   
        default:
  -             {
  -                     XalanDOMString  theMessage("Unknown op code: ");
  -                     
  -                     LongToDOMString(m_expression.getOpCodeMapValue(opPos), 
theMessage);
  +             unknownOpCodeError(context, executionContext, opPos);
  +             break;
  +     }
  +}
   
  -                     executionContext.error(
  -                             theMessage,
  -                             context,
  -                             m_locator);
  -             }
  +
  +
  +const XObjectPtr
  +XPath::executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const
  +{
  +     XObjectPtr      theXObject;
  +
  +     switch(m_expression.getOpCodeMapValue(opPos))
  +     {
  +     case XPathExpression::eOP_XPATH:
  +             theXObject = executeMore(context, opPos + 2, executionContext, 
result);
  +             break;
  +
  +     case XPathExpression::eOP_OR:
  +     case XPathExpression::eOP_AND:
  +     case XPathExpression::eOP_NOTEQUALS:
  +     case XPathExpression::eOP_EQUALS:
  +     case XPathExpression::eOP_LTE:
  +     case XPathExpression::eOP_LT:
  +     case XPathExpression::eOP_GTE:
  +     case XPathExpression::eOP_GT:
  +     case XPathExpression::eOP_PLUS:
  +     case XPathExpression::eOP_MINUS:
  +     case XPathExpression::eOP_MULT:
  +     case XPathExpression::eOP_DIV:
  +     case XPathExpression::eOP_MOD:
  +     case XPathExpression::eOP_NEG:
  +     case XPathExpression::eOP_LITERAL:
  +     case XPathExpression::eOP_NUMBERLIT:
  +     case XPathExpression::eOP_FUNCTION_POSITION:
  +     case XPathExpression::eOP_FUNCTION_LAST:
  +     case XPathExpression::eOP_FUNCTION_COUNT:
  +             notNodeSetError(context, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_UNION:
  +             Union(context, opPos, executionContext, result);
  +             break;
  +
  +     case XPathExpression::eOP_VARIABLE:
  +             theXObject = variable(opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_GROUP:
  +             group(context, opPos, executionContext, result);
  +             break;
  +
  +     case XPathExpression::eOP_ARGUMENT:
  +             theXObject = arg(context, opPos, executionContext, result);
  +             break;
  +
  +     case XPathExpression::eOP_EXTFUNCTION:
  +             theXObject = runExtFunction(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_FUNCTION:
  +             theXObject = runFunction(context, opPos, executionContext);
  +             break;
  +
  +     case XPathExpression::eOP_LOCATIONPATH:
  +             locationPath(context, opPos, executionContext, result);
  +             break;
  +
  +     default:
  +             unknownOpCodeError(context, executionContext, opPos);
                break;
        }
   
  -     return XObjectPtr();
  +     if (theXObject.null() == false && theXObject->getType() != 
XObject::eTypeNodeSet)
  +     {
  +             notNodeSetError(context, executionContext);
  +     }
  +
  +     return theXObject;
   }
   
   
  @@ -575,45 +1313,7 @@
   
   
   
  -const XObjectPtr
  -XPath::matchPattern(
  -                     XalanNode*                              context,
  -                     int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const
  -
  -{
  -     XObjectPtr      score;
  -
  -     while(m_expression.m_opMap[opPos] == 
XPathExpression::eOP_LOCATIONPATHPATTERN)
  -     {
  -             const int       nextOpPos = 
m_expression.getNextOpCodePosition(opPos);
  -
  -             score = executeMore(context, opPos, executionContext);
  -             assert(score.null() == false);
  -
  -             if(score->num() != getMatchScoreValue(eMatchScoreNone))
  -             {
  -                     break;
  -             }
  -             else
  -             {
  -                     opPos = nextOpPos;
  -             }
  -     }
  -
  -     if(score.null() == false)
  -     {
  -             return score;
  -     }
  -     else
  -     {
  -             return 
executionContext.getXObjectFactory().createNumber(getMatchScoreValue(eMatchScoreNone));
  -     }
  -}
  -
  -
  -
  -const XObjectPtr
  +bool
   XPath::Or(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -621,46 +1321,47 @@
   {
        opPos += 2;
   
  -     bool    fResult = executeMore(context, opPos, 
executionContext)->boolean();
  +     bool    theResult;
   
  -     if(fResult == false)
  +     executeMore(context, opPos, executionContext, theResult);
  +
  +     if(theResult == false)
        {
                opPos = m_expression.getNextOpCodePosition(opPos);
   
  -             fResult = executeMore(context, opPos, 
executionContext)->boolean();
  +             executeMore(context, opPos, executionContext, theResult);
        }
   
  -     return executionContext.getXObjectFactory().createBoolean(fResult);
  +     return theResult;
   }
   
   
   
  -const XObjectPtr
  +bool
   XPath::And(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
  -     bool    fResult = false;
  -
        opPos += 2;     
   
  -     if (executeMore(context, opPos, executionContext)->boolean() == true)
  +     bool    fResult;
  +
  +     executeMore(context, opPos, executionContext, fResult);
  +
  +     if (fResult == true)
        {
                opPos = m_expression.getNextOpCodePosition(opPos);
   
  -             if (executeMore(context, opPos, executionContext)->boolean() == 
true)
  -             {
  -                     fResult = true;
  -             }
  +             executeMore(context, opPos, executionContext, fResult);
        }       
   
  -     return executionContext.getXObjectFactory().createBoolean(fResult);
  +     return fResult;
   }
   
   
   
  -const XObjectPtr
  +bool
   XPath::notequals(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -673,15 +1374,14 @@
   
        opPos = m_expression.getNextOpCodePosition(opPos);
   
  -     return executionContext.getXObjectFactory().createBoolean(
  -             expr1->notEquals(
  +     return expr1->notEquals(
                        *executeMore(context, opPos, executionContext).get(),
  -                     executionContext));
  +                     executionContext);
   }
   
   
   
  -const XObjectPtr
  +bool
   XPath::equals(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -694,15 +1394,14 @@
   
        opPos = m_expression.getNextOpCodePosition(opPos);
   
  -     return executionContext.getXObjectFactory().createBoolean(
  -             expr1->equals(
  +     return expr1->equals(
                        *executeMore(context, opPos, executionContext).get(),
  -                     executionContext));
  +                     executionContext);
   }
   
   
   
  -const XObjectPtr
  +bool
   XPath::lte(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -715,15 +1414,14 @@
   
        opPos = m_expression.getNextOpCodePosition(opPos);
   
  -     return executionContext.getXObjectFactory().createBoolean(
  -             expr1->lessThanOrEquals(
  +     return expr1->lessThanOrEquals(
                        *executeMore(context, opPos, executionContext).get(),
  -                     executionContext));
  +                     executionContext);
   }
   
   
   
  -const XObjectPtr
  +bool
   XPath::lt(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -736,15 +1434,14 @@
   
        opPos = m_expression.getNextOpCodePosition(opPos);
   
  -     return executionContext.getXObjectFactory().createBoolean(
  -             expr1->lessThan(
  +     return expr1->lessThan(
                        *executeMore(context, opPos, executionContext).get(),
  -                     executionContext));
  +                     executionContext);
   }
   
   
   
  -const XObjectPtr
  +bool
   XPath::gte(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -757,15 +1454,14 @@
   
        opPos = m_expression.getNextOpCodePosition(opPos);
   
  -     return executionContext.getXObjectFactory().createBoolean(
  -             expr1->greaterThanOrEquals(
  +     return expr1->greaterThanOrEquals(
                        *executeMore(context, opPos, executionContext).get(),
  -                     executionContext));
  +                     executionContext);
   }
   
   
   
  -const XObjectPtr
  +bool
   XPath::gt(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -778,10 +1474,9 @@
   
        opPos = m_expression.getNextOpCodePosition(opPos);
   
  -     return executionContext.getXObjectFactory().createBoolean(
  -             expr1->greaterThan(
  +     return expr1->greaterThan(
                        *executeMore(context, opPos, executionContext).get(),
  -                     executionContext));
  +                     executionContext);
   }
   
   
  @@ -801,16 +1496,88 @@
        }
        else
        {
  -             return executeMore(context, opPos, executionContext)->num();
  +             double  theResult;
  +
  +             executeMore(context, opPos, executionContext, theResult);
  +
  +             return theResult;
        }
   }
   
   
   
  -const XObjectPtr
  +double
  +XPath::plus(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     opPos += 2;
  +
  +     const double    expr1 = getNumericOperand(context, opPos, 
executionContext);
  +
  +     opPos = m_expression.getNextOpCodePosition(opPos);
  +
  +     const double    expr2 = getNumericOperand(context, opPos, 
executionContext);
  +
  +     return DoubleSupport::add(expr1, expr2);
  +}
  +
  +
  +
  +void
   XPath::plus(
                        XalanNode*                              context,
                        int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
  +{
  +     const double    theResult = plus(context, opPos, executionContext);
  +
  +     XObject::string(theResult, formatterListener, function);
  +}
  +
  +
  +
  +double
  +XPath::minus(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     opPos += 2;
  +
  +     const double    expr1 = getNumericOperand(context, opPos, 
executionContext);
  +
  +     opPos = m_expression.getNextOpCodePosition(opPos);
  +
  +     const double    expr2 = getNumericOperand(context, opPos, 
executionContext);
  +
  +     return DoubleSupport::subtract(expr1, expr2);
  +}
  +
  +
  +
  +void
  +XPath::minus(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
  +{
  +     const double    theResult = minus(context, opPos, executionContext);
  +
  +     XObject::string(theResult, formatterListener, function);
  +}
  +
  +
  +
  +double
  +XPath::mult(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
        opPos += 2;
  @@ -821,13 +1588,28 @@
   
        const double    expr2 = getNumericOperand(context, opPos, 
executionContext);
   
  -     return 
executionContext.getXObjectFactory().createNumber(DoubleSupport::add(expr1, 
expr2));
  +     return DoubleSupport::multiply(expr1, expr2);
  +}
  +
  +
  +
  +void
  +XPath::mult(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
  +{
  +     const double    theResult = mult(context, opPos, executionContext);
  +
  +     XObject::string(theResult, formatterListener, function);
   }
   
   
   
  -const XObjectPtr
  -XPath::minus(
  +double
  +XPath::div(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
  @@ -840,37 +1622,33 @@
   
        const double    expr2 = getNumericOperand(context, opPos, 
executionContext);
   
  -     return 
executionContext.getXObjectFactory().createNumber(DoubleSupport::subtract(expr1,
 expr2));
  +     return DoubleSupport::divide(expr1, expr2);
   }
   
   
   
  -const XObjectPtr
  -XPath::mult(
  +void
  +XPath::div(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
   {
  -     opPos += 2;
  -
  -     const double    expr1 = getNumericOperand(context, opPos, 
executionContext);
  -
  -     opPos = m_expression.getNextOpCodePosition(opPos);
  -
  -     const double    expr2 = getNumericOperand(context, opPos, 
executionContext);
  +     const double    theResult = div(context, opPos, executionContext);
   
  -     return 
executionContext.getXObjectFactory().createNumber(DoubleSupport::multiply(expr1,
 expr2));
  +     XObject::string(theResult, formatterListener, function);
   }
   
   
   
  -const XObjectPtr
  -XPath::div(
  +double
  +XPath::mod(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
  -     opPos += 2;
  +     opPos += 2;     
   
        const double    expr1 = getNumericOperand(context, opPos, 
executionContext);
   
  @@ -878,97 +1656,111 @@
   
        const double    expr2 = getNumericOperand(context, opPos, 
executionContext);
   
  -     return 
executionContext.getXObjectFactory().createNumber(DoubleSupport::divide(expr1, 
expr2));
  +     return DoubleSupport::modulus(expr1, expr2);
   }
   
   
   
  -const XObjectPtr
  +void
   XPath::mod(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
   {
  -     opPos += 2;     
  +     const double    theResult = mod(context, opPos, executionContext);
   
  -     const double    expr1 = getNumericOperand(context, opPos, 
executionContext);
  +     XObject::string(theResult, formatterListener, function);
  +}
   
  -     opPos = m_expression.getNextOpCodePosition(opPos);
   
  -     const double    expr2 = getNumericOperand(context, opPos, 
executionContext);
   
  -     return 
executionContext.getXObjectFactory().createNumber(DoubleSupport::modulus(expr1, 
expr2));
  +double
  +XPath::neg(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     return DoubleSupport::negative(getNumericOperand(context, opPos + 2, 
executionContext));
   }
   
   
   
  -const XObjectPtr
  +void
   XPath::neg(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
   {
  -     return executionContext.getXObjectFactory().createNumber(
  -             DoubleSupport::negative(executeMore(context, opPos + 2, 
executionContext)->num()));
  +     const double    theResult = neg(context, opPos, executionContext);
  +
  +     XObject::string(theResult, formatterListener, function);
   }
   
   
   
   const XObjectPtr
  -XPath::boolean(
  +XPath::Union(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
  -     const XObjectPtr        expr1(executeMore(context, opPos + 2, 
executionContext));
  -     assert(expr1.get() != 0);
  +     typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
   
  -     // Try to optimize when the result of the execution is
  -     // already a boolean.
  -     if (expr1->getType() == XObject::eTypeBoolean)
  -     {
  -             return expr1;
  -     }
  -     else
  -     {
  -             return 
executionContext.getXObjectFactory().createBoolean(expr1->boolean());
  -     }
  +     BorrowReturnMutableNodeRefList  resultNodeList(executionContext);
  +
  +     Union(context, opPos, executionContext, *resultNodeList);
  +
  +     return 
executionContext.getXObjectFactory().createNodeSet(resultNodeList);
   }
   
   
  - 
  -const XObjectPtr
  +
  +void
   XPath::Union(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const
   {
  +     assert(result.empty() == true);
  +
        opPos += 2;
   
        typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
   
  -     BorrowReturnMutableNodeRefList  resultNodeList(executionContext);
  +     BorrowReturnMutableNodeRefList  theGuard(executionContext);
  +
  +     MutableNodeRefList&             tempNodeList = *theGuard;
   
        while(m_expression.getOpCodeMapValue(opPos) != XPathExpression::eENDOP)
        {
  -             const XObjectPtr        expr(executeMore(context, opPos, 
executionContext));
  +             const XObjectPtr        nodesetResult(executeMore(context, 
opPos, executionContext, tempNodeList));
   
  -             const NodeRefListBase&  nl =
  -                             expr->nodeset();
  +             if (nodesetResult.null() == false)
  +             {
  +                     result.addNodesInDocOrder(nodesetResult->nodeset(), 
executionContext);
  +             }
  +             else
  +             {
  +                     result.addNodesInDocOrder(tempNodeList, 
executionContext);
   
  -             resultNodeList->addNodesInDocOrder(nl, executionContext);       
  +                     tempNodeList.clear();
  +             }
   
                opPos = m_expression.getNextOpCodePosition(opPos);
        }
   
  -     return 
executionContext.getXObjectFactory().createNodeSet(resultNodeList);
  +     result.setDocumentOrder();
   }
   
   
   
   const XObjectPtr
   XPath::literal(
  -                     XalanNode*                              /* context */,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
  @@ -989,9 +1781,39 @@
   
   
   
  +void
  +XPath::literal(
  +                     int                                     opPos,
  +                     XalanDOMString&         theString) const
  +{
  +     assert(m_expression.m_opMap.size() > unsigned(opPos + 2));
  +     assert(m_expression.m_tokenQueue.size() > 
unsigned(m_expression.m_opMap[opPos + 2]));
  +
  +     const XToken&   theLiteral = 
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
  +
  +     theLiteral.str(theString);
  +}
  +
  +
  +
  +void
  +XPath::literal(
  +                     int                                     opPos,
  +                     FormatterListener&      formatterListener,
  +                     MemberFunctionPtr       function) const
  +{
  +     assert(m_expression.m_opMap.size() > unsigned(opPos + 2));
  +     assert(m_expression.m_tokenQueue.size() > 
unsigned(m_expression.m_opMap[opPos + 2]));
  +
  +     const XToken&   theLiteral = 
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
  +
  +     theLiteral.str(formatterListener, function);
  +}
  +
  +
  +
   const XObjectPtr
   XPath::variable(
  -                     XalanNode*                              /* context */,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
  @@ -1006,7 +1828,6 @@
   
   const XObjectPtr
   XPath::numberlit(
  -                     XalanNode*                              /* context */,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
  @@ -1027,6 +1848,50 @@
   
   
   
  +double
  +XPath::numberlit(int opPos) const
  +{
  +     assert(m_expression.m_opMap.size() > unsigned(opPos + 3));
  +     assert(m_expression.m_tokenQueue.size() > 
unsigned(m_expression.m_opMap[opPos + 3]));
  +
  +     const XToken&   theLiteral = 
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 3]];
  +
  +     return theLiteral.num();
  +}
  +
  +
  +
  +void
  +XPath::numberlit(
  +                     int                                     opPos,
  +                     XalanDOMString&         theString) const
  +{
  +     assert(m_expression.m_opMap.size() > unsigned(opPos + 3));
  +     assert(m_expression.m_tokenQueue.size() > 
unsigned(m_expression.m_opMap[opPos + 3]));
  +
  +     const XToken&   theLiteral = 
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 3]];
  +
  +     theLiteral.str(theString);
  +}
  +
  +
  +
  +void
  +XPath::numberlit(
  +                     int                                     opPos,
  +                     FormatterListener&      formatterListener,
  +                     MemberFunctionPtr       function) const
  +{
  +     assert(m_expression.m_opMap.size() > unsigned(opPos + 3));
  +     assert(m_expression.m_tokenQueue.size() > 
unsigned(m_expression.m_opMap[opPos + 3]));
  +
  +     const XToken&   theLiteral = 
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 3]];
  +
  +     theLiteral.str(formatterListener, function);
  +}
  +
  +
  +
   const XObjectPtr
   XPath::locationPath(
                        XalanNode*                              context,
  @@ -1035,23 +1900,81 @@
   {    
        assert(context != 0);
   
  -     return locationPath(executionContext, *context, opPos);
  +     typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
  +
  +     BorrowReturnMutableNodeRefList  mnl(executionContext);
  +
  +     locationPath(context, opPos, executionContext, *mnl.get());
  +
  +     return executionContext.getXObjectFactory().createNodeSet(mnl);
   }
   
   
   
  -const XObjectPtr
  -XPath::locationPathPattern(
  +void
  +XPath::locationPath(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 theResult) const
  +{
  +     assert(context != 0);
  +
  +     typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
  +
  +     BorrowReturnMutableNodeRefList  mnl(executionContext);
  +
  +     locationPath(context, opPos, executionContext, *mnl.get());
  +
  +     // $$$ ToDo: Reduce this to a call on XObject...
  +     XPathExecutionContext::GetAndReleaseCachedString        
theGuard(executionContext);
  +
  +     XalanDOMString&         theString = theGuard.get();
  +
  +     XObject::string(*mnl.get(), theString);
  +
  +     theResult = XObject::number(theString);
  +}
  +
  +
  +
  +void
  +XPath::locationPath(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 theResult) const
   {
        assert(context != 0);
   
  -     const eMatchScore       result =
  -             locationPathPattern(executionContext, *context, opPos);
  +     typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
  +
  +     BorrowReturnMutableNodeRefList  mnl(executionContext);
  +
  +     locationPath(context, opPos, executionContext, *mnl.get());
  +
  +     XObject::string(*mnl.get(), theResult);
  +}
  +
  +
  +
  +void
  +XPath::locationPath(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
  +{
  +     assert(context != 0);
   
  -     return 
executionContext.getXObjectFactory().createNumber(getMatchScoreValue(result));
  +     typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
  +
  +     BorrowReturnMutableNodeRefList  mnl(executionContext);
  +
  +     locationPath(context, opPos, executionContext, *mnl.get());
  +
  +     XObject::string(*mnl, formatterListener, function);
   }
   
   
  @@ -1183,19 +2106,83 @@
   
   
   
  +double
  +XPath::functionPosition(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     if (context == 0)
  +     {
  +             executionContext.error(
  +                             "The position() function requires a non-null 
context node!",
  +                             context,
  +                             m_locator);
  +     }
  +
  +     return executionContext.getContextNodeListPosition(*context);
  +}
  +
  +
  +
   const XObjectPtr
  -XPath::locationPath(
  -                     XPathExecutionContext&  executionContext,
  -                     XalanNode&                              context, 
  -                     int                                     opPos) const
  +XPath::functionPositionGeneric(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     return 
executionContext.getXObjectFactory().createNumber(functionPosition(context, 
executionContext));
  +}
  +
  +
  +
  +double
  +XPath::functionLast(XPathExecutionContext&   executionContext) const
  +{
  +     return executionContext.getContextNodeListLength();
  +}
  +
  +
  +
  +const XObjectPtr
  +XPath::functionLastGeneric(XPathExecutionContext&    executionContext) const
  +{
  +     return 
executionContext.getXObjectFactory().createNumber(functionLast(executionContext));
  +}
  +
  +
  +
  +double
  +XPath::functionCount(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const
   {
        typedef XPathExecutionContext::BorrowReturnMutableNodeRefList   
BorrowReturnMutableNodeRefList;
   
  -     BorrowReturnMutableNodeRefList  mnl(executionContext);
  +     BorrowReturnMutableNodeRefList  result(executionContext);
   
  -     step(executionContext, &context, opPos + 2, *mnl.get());
  +     const XObjectPtr        nodesetResult(executeMore(context, opPos + 2, 
executionContext, *result));
   
  -     return executionContext.getXObjectFactory().createNodeSet(mnl);
  +     if (nodesetResult.null() == false)
  +     {
  +             return nodesetResult->nodeset().getLength();
  +     }
  +     else
  +     {
  +             return result->getLength();
  +     }
  +
  +     return executionContext.getContextNodeListLength();
  +}
  +
  +
  +
  +const XObjectPtr
  +XPath::functionCountGeneric(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const
  +{
  +     return 
executionContext.getXObjectFactory().createNumber(functionCount(context, opPos, 
executionContext));
   }
   
   
  @@ -1324,11 +2311,10 @@
        if(XPathExpression::eOP_PREDICATE == nextStepType ||
           XPathExpression::eOP_PREDICATE_WITH_POSITION == nextStepType)
        {
  -             predicates(executionContext,
  -                                context,
  -                                opPos, 
  -                                *subQueryResults,
  -                                opPos);
  +             opPos = predicates(
  +                     executionContext,
  +                opPos, 
  +                *subQueryResults);
   
                nextStepType = currentExpression.getOpCodeMapValue(opPos);
        }
  @@ -1669,9 +2655,9 @@
                // Execute the xpath.predicates, but if we have an index, then 
we have 
                // to start over and do a search from the parent.  It would be 
nice 
                // if I could sense this condition earlier...
  +#if 0
                try
                {
  -#if 0
                        executionContext.setThrowFoundIndex(true);
   #endif
   
  @@ -1720,7 +2706,6 @@
   
   #if 0
                        executionContext.setThrowFoundIndex(false);
  -#endif
                }
                catch(const FoundIndex&)
                {
  @@ -1728,6 +2713,7 @@
   
                        score = handleFoundIndex(executionContext, context, 
startOpPos);
                }
  +#endif
        }
   
        if (scoreHolder == eMatchScoreNone || 
  @@ -1824,17 +2810,22 @@
                        int                                     /* stepType */,
                        MutableNodeRefList&     subQueryResults) const
   {
  -     const XPathExpression&  currentExpression = getExpression();
  -
  -     const XObjectPtr                obj(executeMore(context, opPos, 
executionContext));
  +     assert(subQueryResults.empty() == true);
   
  -     const NodeRefListBase&  nl = obj->nodeset();
  +     const XObjectPtr        nodesetResult(executeMore(context, opPos, 
executionContext, subQueryResults));
   
  -     subQueryResults.addNodesInDocOrder(nl, executionContext);
  +     if (nodesetResult.null() == true)
  +     {
  +             assert(subQueryResults.getDocumentOrder());
  +     }
  +     else
  +     {
  +             subQueryResults.addNodesInDocOrder(nodesetResult->nodeset(), 
executionContext);
   
  -     subQueryResults.setDocumentOrder();
  +             subQueryResults.setDocumentOrder();
  +     }
   
  -     return currentExpression.getOpCodeLengthFromOpMap(opPos);
  +     return getExpression().getOpCodeLengthFromOpMap(opPos);
   }
   
   
  @@ -3061,13 +4052,11 @@
   
   
   
  -void
  +int
   XPath::predicates(
                        XPathExecutionContext&  executionContext,
  -                     XalanNode*                              /* context */, 
                        int                                     opPos,
  -                     MutableNodeRefList&     subQueryResults,
  -                     int&                                    
endPredicatesPos) const
  +                     MutableNodeRefList&     subQueryResults) const
   {
        const XPathExpression&  currentExpression = getExpression();
   
  @@ -3176,7 +4165,7 @@
                }
        }
   
  -     endPredicatesPos = opPos;
  +     return opPos;
   }
   
   
  
  
  
  1.37      +856 -114  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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- XPath.hpp 21 Nov 2002 01:26:18 -0000      1.36
  +++ XPath.hpp 2 Jan 2003 17:39:08 -0000       1.37
  @@ -77,6 +77,7 @@
   
   
   
  +#include <XPath/MutableNodeRefList.hpp>
   #include <XPath/XPathExpression.hpp>
   #include <XPath/Function.hpp>
   #include <XPath/XPathFunctionTable.hpp>
  @@ -197,7 +198,6 @@
        explicit
        XPath(const LocatorType*        theLocator = 0);
   
  -     virtual
        ~XPath();
   
        /**
  @@ -215,7 +215,7 @@
         * @param context          current source tree context node
         * @param prefixResolver   prefix resolver to use
         * @param executionContext current execution context
  -      * @return pointer to union of node-set operands
  +      * @return smart-pointer to result XObject
         */
        const XObjectPtr
        execute(
  @@ -228,9 +228,100 @@
         *
         * @param context          current source tree context node
         * @param prefixResolver   prefix resolver to use
  +      * @param executionContext current execution context
  +      * @param result           the boolean result
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     bool&                                   result) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param executionContext current execution context
  +      * @param result           the numeric result
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 result) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.  The
  +      * result is appended to the supplied string.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param executionContext current execution context
  +      * @param result           the string result
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 result) const;
  +
  +     typedef void (FormatterListener::*MemberFunctionPtr)(const XMLCh* 
const, const unsigned int);
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.  Normally,
  +      * the expression will be evaluated and the result placed
  +      * in the parameter result.  However, some cases (such as
  +      * the evalution of a variable) could result in the copying
  +      * of a node-set, which is extremely expensive.  In that
  +      * case, the return value will contain the result of the
  +      * evaluation.  If the call to XObject::null() on the return
  +      * value is true, that indicates the value was executed
  +      * directly into the parameter.  Otherwise, the parameter
  +      * will be empty, and the result will be in the XObject
  +      * instance returned.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param executionContext current execution context
  +      * @param result           the node-set result
  +      * @return the node-set result, if the result was not returned in the 
parameter
  +      */
  +     const XObjectPtr
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
         * @param contextNodeList  node list for current context
         * @param executionContext current execution context
  -      * @return pointer to union of node-set operands
  +      * @return smart-pointer to result XObject
         */
        const XObjectPtr
        execute(
  @@ -242,18 +333,157 @@
                // Set and restore the context node list...
                XPathExecutionContext::ContextNodeListSetAndRestore             
theSetAndRestore(
                                                                                
executionContext,
  -                                                                             
contextNodeList);       
  +                                                                             
contextNodeList);
   
                return execute(context, prefixResolver, executionContext);
        }
   
        /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param contextNodeList  node list for current context
  +      * @param executionContext current execution context
  +      * @param result           the boolean result
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     const NodeRefListBase&  contextNodeList,
  +                     XPathExecutionContext&  executionContext,
  +                     bool&                                   result) const
  +     {
  +             // Set and restore the context node list...
  +             XPathExecutionContext::ContextNodeListSetAndRestore             
theSetAndRestore(
  +                                                                             
executionContext,
  +                                                                             
contextNodeList);
  +
  +             execute(context, prefixResolver, executionContext, result);
  +     }
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param contextNodeList  node list for current context
  +      * @param executionContext current execution context
  +      * @param result           the numeric result
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     const NodeRefListBase&  contextNodeList,
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 result) const
  +     {
  +             // Set and restore the context node list...
  +             XPathExecutionContext::ContextNodeListSetAndRestore             
theSetAndRestore(
  +                                                                             
executionContext,
  +                                                                             
contextNodeList);
  +
  +             execute(context, prefixResolver, executionContext, result);
  +     }
  +
  +     /**
  +      * Execute the XPath from the provided context.  The
  +      * result is appended to the supplied string.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param contextNodeList  node list for current context
  +      * @param executionContext current execution context
  +      * @param result           the string result
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     const NodeRefListBase&  contextNodeList,
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 result) const
  +     {
  +             // Set and restore the context node list...
  +             XPathExecutionContext::ContextNodeListSetAndRestore             
theSetAndRestore(
  +                                                                             
executionContext,
  +                                                                             
contextNodeList);
  +
  +             execute(context, prefixResolver, executionContext, result);
  +     }
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param contextNodeList  node list for current context
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
  +      */
  +     void
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     const NodeRefListBase&  contextNodeList,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
  +     {
  +             // Set and restore the context node list...
  +             XPathExecutionContext::ContextNodeListSetAndRestore             
theSetAndRestore(
  +                                                                             
executionContext,
  +                                                                             
contextNodeList);
  +
  +             execute(context, prefixResolver, executionContext, 
formatterListener, function);
  +     }
  +
  +     /**
  +      * Execute the XPath from the provided context.  Normally,
  +      * the expression will be evaluated and the result placed
  +      * in the parameter result.  However, some cases (such as
  +      * the evalution of a variable) could result in the copying
  +      * of a node-set, which is extremely expensive.  In that
  +      * case, the return value will contain the result of the
  +      * evaluation.  If the call to XObject::null() on the return
  +      * value is true, that indicates the value was executed
  +      * directly into the parameter.  Otherwise, the parameter
  +      * will be empty, and the result will be in the XObject
  +      * instance returned.
  +      *
  +      * @param context          current source tree context node
  +      * @param prefixResolver   prefix resolver to use
  +      * @param contextNodeList  node list for current context
  +      * @param executionContext current execution context
  +      * @param result           the result as a set of nodes
  +      * @return the node-set result, if the result was not returned in the 
parameter
  +      */
  +     const XObjectPtr
  +     execute(
  +                     XalanNode*                              context,
  +                     const PrefixResolver&   prefixResolver,
  +                     const NodeRefListBase&  contextNodeList,
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const
  +     {
  +             // Set and restore the context node list...
  +             XPathExecutionContext::ContextNodeListSetAndRestore             
theSetAndRestore(
  +                                                                             
executionContext,
  +                                                                             
contextNodeList);
  +
  +             return execute(context, prefixResolver, executionContext, 
result);
  +     }
  +
  +     /**
         * Execute the XPath from the provided context.  The
         * prefix resolver must already be set in the
         * execution context.
         *
         * @param executionContext current execution context
  -      * @return pointer to result XObject
  +      * @return smart-pointer to result XObject
         */
        const XObjectPtr
        execute(XPathExecutionContext&  executionContext) const
  @@ -264,32 +494,108 @@
        }
   
        /**
  -      * Execute the XPath from the provided context.
  +      * Execute the XPath from the provided context.  The
  +      * prefix resolver must already be set in the
  +      * execution context.
         *
  -      * @param context          current source tree context node
  -      * @param opPos            current position in the m_opMap array
         * @param executionContext current execution context
  -      * @return pointer to union of node-set operands
  +      * @param result           the boolean result
         */
  -     const XObjectPtr
  -     executeMore(
  -                     XalanNode*                              context,
  -                     int                                     opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +     void
  +     execute(
  +                     XPathExecutionContext&  executionContext,
  +                     bool&                                   result) const
  +     {
  +             assert(executionContext.getPrefixResolver() != 0);
  +
  +             executeMore(executionContext.getCurrentNode(), 0, 
executionContext, result);
  +     }
   
        /**
  -      * Execute a location path.
  +      * Execute the XPath from the provided context.  The
  +      * prefix resolver must already be set in the
  +      * execution context.
         *
  -      * @param context          current source tree context node
  -      * @param opPos            current position in the m_opMap array
         * @param executionContext current execution context
  -      * @return node-set
  +      * @param result           the numeric result
  +      */
  +     void
  +     execute(
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 result) const
  +     {
  +             assert(executionContext.getPrefixResolver() != 0);
  +
  +             executeMore(executionContext.getCurrentNode(), 0, 
executionContext, result);
  +     }
  +
  +     /**
  +      * Execute the XPath from the provided context.  The
  +      * prefix resolver must already be set in the
  +      * execution context.  The result is appended to the
  +      * supplied string.
  +      *
  +      * @param executionContext current execution context
  +      * @param result           the string result
  +      */
  +     void
  +     execute(
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 result) const
  +     {
  +             assert(executionContext.getPrefixResolver() != 0);
  +
  +             executeMore(executionContext.getCurrentNode(), 0, 
executionContext, result);
  +     }
  +
  +     /**
  +      * Execute the XPath from the provided context.  The
  +      * prefix resolver must already be set in the
  +      * execution context.
  +      *
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
  +      */
  +     void
  +     execute(
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const
  +     {
  +             assert(executionContext.getPrefixResolver() != 0);
  +
  +             executeMore(executionContext.getCurrentNode(), 0, 
executionContext, formatterListener, function);
  +     }
  +
  +     /**
  +      * Execute the XPath from the provided context.  Normally,
  +      * the expression will be evaluated and the result placed
  +      * in the parameter result.  However, some cases (such as
  +      * the evalution of a variable) could result in the copying
  +      * of a node-set, which is extremely expensive.  In that
  +      * case, the return value will contain the result of the
  +      * evaluation.  If the call to XObject::null() on the return
  +      * value is true, that indicates the value was executed
  +      * directly into the parameter.  Otherwise, the parameter
  +      * will be empty, and the result will be in the XObject
  +      * instance returned.
  +      * 
  +      * The prefix resolver must already be set in the
  +      * execution context.
  +      *
  +      * @param executionContext current execution context
  +      * @return the node-set result, if the result was not returned in the 
parameter
         */
        const XObjectPtr
  -     locationPath(
  -                     XalanNode*                              context,
  -                     int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +     execute(
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const
  +     {
  +             assert(executionContext.getPrefixResolver() != 0);
  +
  +             return executeMore(executionContext.getCurrentNode(), 0, 
executionContext, result);
  +     }
   
        /**
         * Retrieve a reference to the current expression.
  @@ -534,18 +840,177 @@
   protected:
   
        /**
  -      * Computes the union of its operands which must be node-sets.
  -      * @param context The current source tree context node.
  -      * @param opPos The current position in the m_opMap array.
  -      * @return the match score in the form of an XObject.
  +      * Execute a location path.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @return node-set
         */
        const XObjectPtr
  -     matchPattern(
  +     locationPath(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
  -protected:
  +     /**
  +      * Execute a location path.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param theResult            the result as a node list
  +      */
  +     void
  +     locationPath(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             theResult) const
  +     {
  +             step(executionContext, context, opPos + 2, theResult);
  +     }
  +
  +     /**
  +      * Execute a location path.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param theResult            the result as a number
  +      */
  +     void
  +     locationPath(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 theResult) 
const;
  +
  +     /**
  +      * Execute a location path.  The result is appended to the
  +      * supplied string.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param theResult            the string
  +      */
  +     void
  +     locationPath(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 theResult) const;
  +
  +     /**
  +      * Execute a location path.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
  +      */
  +     void
  +     locationPath(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @return pointer to union of node-set operands
  +      */
  +     const XObjectPtr
  +     executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param theResult        The result of the execution
  +      */
  +     void
  +     executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     bool&                                   theResult) 
const;
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param theResult        The result of the execution
  +      */
  +     void
  +     executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     double&                                 theResult) 
const;
  +
  +     /**
  +      * Execute the XPath from the provided context.  The result
  +      * is appended to the supplied string.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param theResult        The result of the execution
  +      */
  +     void
  +     executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     XalanDOMString&                 theResult) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
  +      */
  +     void
  +     executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
  +
  +     /**
  +      * Execute the XPath from the provided context.
  +      *
  +      * @param context          current source tree context node
  +      * @param opPos            current position in the m_opMap array
  +      * @param executionContext current execution context
  +      * @param theResult        The result of the execution
  +      * @return the node-set result, if the result was not returned in the 
parameter
  +      */
  +     const XObjectPtr
  +     executeMore(
  +                     XalanNode*                              context,
  +                     int                                     opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             theResult) const;
   
        /**
         * Helper function to get match score.
  @@ -563,9 +1028,10 @@
         * OR two expressions and return the boolean result.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if the one of the two arguments are 
true.
  +      * @param executionContext current execution context
  +      * @return true if the one of the two arguments are true.
         */
  -     const XObjectPtr
  +     bool
        Or(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -575,9 +1041,10 @@
         * OR two expressions and return the boolean result.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if the two arguments are both true.
  +      * @param executionContext current execution context
  +      * @return true if the two arguments are both true.
         */
  -     const XObjectPtr
  +     bool
        And(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -587,9 +1054,10 @@
         * Tell if two expressions are functionally not equal.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if the two arguments are not equal.
  +      * @param executionContext current execution context
  +      * @return true if the two arguments are not equal.
         */
  -     const XObjectPtr
  +     bool
        notequals(
                        XalanNode*                              context,
                        int                                             opPos,
  @@ -599,106 +1067,192 @@
         * Tell if two expressions are functionally equal.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if the two arguments are equal.
  +      * @param executionContext current execution context
  +      * @return true if the two arguments are equal.
         */
  -     const XObjectPtr
  +     bool
        equals(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
        /**
  -      * Tell if one argument is less than or equal to the other argument.
  +      * Tell if one argument is less than or equal to the other argument.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return true if arg 1 is less than or equal to arg 2.
  +      */
  +     bool
  +     lte(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Tell if one argument is less than the other argument.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return true if arg 1 is less than arg 2.
  +      */
  +     bool
  +     lt(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Tell if one argument is greater than or equal to the other argument.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return true if arg 1 is greater than or equal to arg 2.
  +      */
  +     bool
  +     gte(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Tell if one argument is greater than the other argument.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return true if arg 1 is greater than arg 2.
  +      */
  +     bool
  +     gt(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Give the sum of two arguments.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return sum of arg1 and arg2.
  +      */
  +     double
  +     plus(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Give the sum of two arguments.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if arg 1 is less than or equal to arg 2.
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
         */
  -     const XObjectPtr
  -     lte(
  +     void
  +     plus(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
   
        /**
  -      * Tell if one argument is less than the other argument.
  +      * Give the difference of two arguments.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if arg 1 is less than arg 2.
  +      * @param executionContext current execution context
  +      * @return difference of arg1 and arg2.
         */
  -     const XObjectPtr
  -     lt(
  +     double
  +     minus(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
        /**
  -      * Tell if one argument is greater than or equal to the other argument.
  +      * Give the difference of two arguments.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if arg 1 is greater than or equal to 
arg 2.
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
         */
  -     const XObjectPtr
  -     gte(
  +     void
  +     minus(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
   
        /**
  -      * Tell if one argument is greater than the other argument.
  +      * Multiply two arguments.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return XBoolean set to true if arg 1 is greater than arg 2.
  +      * @param executionContext current execution context
  +      * @return arg1 * arg2.
         */
  -     const XObjectPtr
  -     gt(
  +     double
  +     mult(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
        /**
  -      * Give the sum of two arguments.
  +      * Multiply two arguments.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return sum of arg1 and arg2.
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
         */
  -     const XObjectPtr
  -     plus(
  +     void
  +     mult(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
   
        /**
  -      * Give the difference of two arguments.
  +      * Divide a number.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return difference of arg1 and arg2.
  +      * @param executionContext current execution context
  +      * @return arg1 / arg2.
         */
  -     const XObjectPtr
  -     minus(
  +     double
  +     div(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
        /**
  -      * Multiply two arguments.
  +      * Divide a number.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return arg1 * arg2.
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
         */
  -     const XObjectPtr
  -     mult(
  +     void
  +     div(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
   
        /**
  -      * Divide a number.
  +      * Return the remainder from a truncating division.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return arg1 / arg2.
  +      * @param executionContext current execution context
  +      * @return arg1 mod arg2.
         */
  -     const XObjectPtr
  -     div(
  +     double
  +     mod(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
  @@ -707,83 +1261,117 @@
         * Return the remainder from a truncating division.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return arg1 mod arg2.
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
         */
  -     const XObjectPtr
  +     void
        mod(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
   
        /**
         * Return the negation of a number.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
         * @return -arg.
         */
  -     const XObjectPtr
  +     double
        neg(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
        /**
  -      * Cast an expression to a string.
  +      * Return the negation of a number.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return arg cast to a string.
  +      * @param executionContext current execution context
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
         */
  -     const XObjectPtr
  -     string(
  +     void
  +     neg(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     FormatterListener&              formatterListener,
  +                     MemberFunctionPtr               function) const;
   
        /**
  -      * Cast an expression to a boolean.
  +      * Computes the union of its operands which must be node-sets.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return arg cast to a boolean.
  +      * @param executionContext current execution context
  +      * @return the union of node-set operands.
         */
        const XObjectPtr
  -     boolean(
  +     Union(
                        XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
  - 
  +
        /**
         * Computes the union of its operands which must be node-sets.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return the union of node-set operands.
  +      * @param executionContext current execution context
  +      * @result the result of the union of node-set operands.
         */
  -     const XObjectPtr
  +     void
        Union(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const;
   
        /**
         * Get a literal value.
  -      * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
         * @return an XObject object.
         */
        const XObjectPtr
        literal(
  -                     XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
     
        /**
  +      * Get a literal value.  The value is appended to the
  +      * supplied string.
  +      *
  +      * @param opPos The current position in the m_opMap array.
  +      * @param theResult The string.
  +      */
  +     void
  +     literal(
  +                     int                                     opPos,
  +                     XalanDOMString&         theResult) const;
  +
  +     /**
  +      * Get a literal value.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return The result as a double.
  +      */
  +     void
  +     literal(
  +                     int                                     opPos,
  +                     FormatterListener&      formatterListener,
  +                     MemberFunctionPtr       function) const;
  +
  +     /**
         * Get the value of a variable.
  -      * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
         * @return an XObject object.
         */
        const XObjectPtr
        variable(
  -                     XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
  @@ -791,6 +1379,7 @@
         * Execute an expression as a group.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
         * @return arg.
         */
        const XObjectPtr
  @@ -803,21 +1392,71 @@
        }
   
        /**
  -      * Get a literal value.
  +      * Execute an expression as a group.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return an XObject object.
  +      * @param executionContext current execution context
  +      * @param theResult The result of the execution
  +      */
  +     void
  +     group(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             theResult) const
  +     {
  +             executeMore(context, opPos + 2, executionContext, theResult);
  +     }
  +
  +     /**
  +      * Get a literal value.
  +      * @param opPos The current position in the m_opMap array.
  +      * @return The result as a double.
  +      */
  +     double
  +     numberlit(int   opPos) const;
  +
  +     /**
  +      * Get a literal value.
  +      * @param opPos The current position in the m_opMap array.
  +      * @return The result as a double.
         */
        const XObjectPtr
        numberlit(
  -                     XalanNode*                              context,
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const;
   
        /**
  +      * Get a literal value.  The value is appended to the
  +      * supplied string.
  +      *
  +      * @param opPos The current position in the m_opMap array.
  +      * @param theResult The string.
  +      */
  +     void
  +     numberlit(
  +                     int                                     opPos,
  +                     XalanDOMString&         theResult) const;
  +
  +     /**
  +      * Get a literal value.
  +      *
  +      * @param opPos The current position in the m_opMap array.
  +      * @param formatterListener the FormatterListener instance to receive 
the result
  +      * @param function A pointer to the member function of 
FormatterListener to call
  +      */
  +     void
  +     numberlit(
  +                     int                                     opPos,
  +                     FormatterListener&      formatterListener,
  +                     MemberFunctionPtr       function) const;
  +
  +     /**
         * Execute a function argument.
  +      *
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
         * @return the result of the argument expression.
         */
        const XObjectPtr
  @@ -830,20 +1469,29 @@
        }
   
        /**
  -      * Execute a location path.
  +      * Execute a function argument.
         * @param context The current source tree context node.
         * @param opPos The current position in the m_opMap array.
  -      * @return score in an XNumber, one of MATCH_SCORE_NODETEST, 
  -      * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
  +      * @param executionContext current execution context
  +      * @param the result of the argument expression.
  +      * @result the result of the argument expression.
         */
        const XObjectPtr
  -     locationPathPattern(
  +     arg(
                        XalanNode*                              context,
                        int                                             opPos,
  -                     XPathExecutionContext&  executionContext) const;
  +                     XPathExecutionContext&  executionContext,
  +                     MutableNodeRefList&             result) const
  +     {
  +             return executeMore(context, opPos + 2, executionContext, 
result);
  +     }
   
        /**
         * Setup for and run an extension function.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return the result of the function.
         */
        const XObjectPtr
        runExtFunction(
  @@ -853,6 +1501,13 @@
   
        /**
         * Handle an extension function.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param theNamespace The namespace of the function.
  +      * @param functionName The name of the function.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return the result of the function.
         */
        const XObjectPtr
        extfunction(
  @@ -872,6 +1527,10 @@
   
        /**
         * Setup for and run a function.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return the result of the function.
         */
        const XObjectPtr
        runFunction(
  @@ -881,6 +1540,11 @@
   
        /**
         * Handle a built-in function.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param argVec The arguments for the function.
  +      * @param executionContext current execution context
  +      * @return the result of the function.
         */
        const XObjectPtr
        function(
  @@ -892,6 +1556,79 @@
                return s_functions[funcID].execute(executionContext, context, 
argVec, m_locator);
        }
   
  +     /**
  +      * Handle the built-in function "position".
  +      *
  +      * @param context The current source tree context node.
  +      * @param executionContext current execution context
  +      * @return the result of the function.
  +      */
  +     double
  +     functionPosition(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Handle the built-in function "position".
  +      *
  +      * @param context The current source tree context node.
  +      * @param executionContext current execution context
  +      * @return the result of the function.
  +      */
  +     const XObjectPtr
  +     functionPositionGeneric(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Handle the built-in function "last".
  +      *
  +      * @param executionContext current execution context
  +      * @return the result of the function.
  +      */
  +     double
  +     functionLast(XPathExecutionContext&             executionContext) const;
  +
  +     /**
  +      * Handle the built-in function "last".
  +      *
  +      * @param executionContext current execution context
  +      * @return the result of the function.
  +      */
  +     const XObjectPtr
  +     functionLastGeneric(XPathExecutionContext&      executionContext) const;
  +
  +     /**
  +      * Handle the built-in function "count".
  +      *
  +      * @param executionContext current execution context
  +      * @return the result of the function.
  +      */
  +     double
  +     functionCount(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Handle the built-in function "count".
  +      *
  +      * @param executionContext current execution context
  +      * @return the result of the function.
  +      */
  +     const XObjectPtr
  +     functionCountGeneric(
  +                     XalanNode*                              context,
  +                     int                                             opPos,
  +                     XPathExecutionContext&  executionContext) const;
  +
  +     /**
  +      * Get a numeric operand for an expression.
  +      * @param context The current source tree context node.
  +      * @param opPos The current position in the m_opMap array.
  +      * @param executionContext current execution context
  +      * @return The value of the operand.
  +      */
        double
        getNumericOperand(
                        XalanNode*                              context,
  @@ -915,12 +1652,6 @@
                eDefaultTargetDataSize = 5
        };
   
  -     const XObjectPtr
  -     locationPath(
  -                     XPathExecutionContext&  executionContext,
  -                     XalanNode&                              context, 
  -                     int                                     opPos) const;
  -
        eMatchScore
        locationPathPattern(
                        XPathExecutionContext&  executionContext,
  @@ -1218,13 +1949,11 @@
                        int                                     argLen,
                        int                                     stepType) const;
   
  -     void
  +     int
        predicates(
                        XPathExecutionContext&  executionContext,
  -                     XalanNode*                              context, 
                        int                                     opPos,
  -                     MutableNodeRefList&     subQueryResults,
  -                     int&                                    
endPredicatesPos) const;
  +                     MutableNodeRefList&     subQueryResults) const;
   
        eMatchScore
        handleFoundIndex(
  @@ -1238,6 +1967,19 @@
                        XalanNode*                              localContext,
                        int                                     startOpPos) 
const;
   
  +private:
  +
  +     void
  +     unknownOpCodeError(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext,
  +                     int                                             opPos) 
const;
  +
  +     void
  +     notNodeSetError(
  +                     XalanNode*                              context,
  +                     XPathExecutionContext&  executionContext) const;
  +
        // Data members...
   
        /**
  @@ -1245,19 +1987,19 @@
         * Holds information about the current expression.
         *
         */
  -     XPathExpression                                         m_expression;
  +     XPathExpression         m_expression;
   
        /**
         * A LocatorType for reporting errors.
         */
  -     const LocatorType*                                              
m_locator;
  +     const LocatorType*      m_locator;
   
        /**
         * If true, the XPath can allocated XObjects in more
         * efficient ways, since its lifetime is guaranteed
  -      * to be at least that of the transform.
  +      * to be at least that of the transformation.
         */
  -     bool                                                            
m_inStylesheet;
  +     bool                            m_inStylesheet;
   
        /**
         *
  
  
  
  1.42      +3 -0      xml-xalan/c/src/XPath/XPathExpression.cpp
  
  Index: XPathExpression.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.cpp,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- XPathExpression.cpp       21 Nov 2002 01:30:09 -0000      1.41
  +++ XPathExpression.cpp       2 Jan 2003 17:39:09 -0000       1.42
  @@ -169,6 +169,9 @@
        XPathExpression::s_opCodeMapLengthIndex + 1,
        XPathExpression::s_opCodeMapLengthIndex + 2,
        XPathExpression::s_opCodeMapLengthIndex + 2,
  +     XPathExpression::s_opCodeMapLengthIndex + 1,
  +     XPathExpression::s_opCodeMapLengthIndex + 1,
  +     XPathExpression::s_opCodeMapLengthIndex + 1,
        XPathExpression::s_opCodeMapLengthIndex + 1
   };
   
  
  
  
  1.32      +56 -1     xml-xalan/c/src/XPath/XPathExpression.hpp
  
  Index: XPathExpression.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.hpp,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- XPathExpression.hpp       21 Nov 2002 01:30:09 -0000      1.31
  +++ XPathExpression.hpp       2 Jan 2003 17:39:09 -0000       1.32
  @@ -409,7 +409,8 @@
                /**
                 * [OP_FUNCTION]
                 * [length]
  -              * [FUNC_name]
  +              * [FUNC_ID]
  +              * [arg count]
                 *  {OP_ARGUMENT}*
                 * [ENDOP]
                 * 
  @@ -576,6 +577,60 @@
                 */
                eOP_PREDICATE_WITH_POSITION = 55,
     
  +             /**
  +              * [OP_FUNCTION_POSITION]
  +              * [length]
  +              * [FUNC_ID]
  +              * [arg count]
  +              *  {OP_ARGUMENT}*
  +              * [ENDOP]
  +              * 
  +              * returns: 
  +              *  XNodeSet
  +              *  XNumber
  +              *  XString
  +              *  XBoolean
  +              *  XRTree
  +              *  XObject
  +              */
  +             eOP_FUNCTION_POSITION = 56,
  +
  +             /**
  +              * [OP_FUNCTION_POSITION]
  +              * [length]
  +              * [FUNC_ID]
  +              * [arg count]
  +              *  {OP_ARGUMENT}*
  +              * [ENDOP]
  +              * 
  +              * returns: 
  +              *  XNodeSet
  +              *  XNumber
  +              *  XString
  +              *  XBoolean
  +              *  XRTree
  +              *  XObject
  +              */
  +             eOP_FUNCTION_LAST = 57,
  +
  +             /**
  +              * [OP_FUNCTION_POSITION]
  +              * [length]
  +              * [FUNC_ID]
  +              * [arg count]
  +              *  {OP_ARGUMENT}*
  +              * [ENDOP]
  +              * 
  +              * returns: 
  +              *  XNodeSet
  +              *  XNumber
  +              *  XString
  +              *  XBoolean
  +              *  XRTree
  +              *  XObject
  +              */
  +             eOP_FUNCTION_COUNT = 58,
  +
                // Always add _before_ this one and update
                // s_opCodeLengthArray.
                eOpCodeNextAvailable
  
  
  
  1.6       +3 -3      xml-xalan/c/src/XPath/XPathInit.cpp
  
  Index: XPathInit.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathInit.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XPathInit.cpp     21 Nov 2002 01:26:18 -0000      1.5
  +++ XPathInit.cpp     2 Jan 2003 17:39:09 -0000       1.6
  @@ -59,7 +59,7 @@
   
   
   
  -#include "XBoolean.hpp"
  +#include "XObject.hpp"
   #include "XUnknown.hpp"
   #include "XPath.hpp"
   #include "XPathEnvSupportDefault.hpp"
  @@ -104,7 +104,7 @@
   void
   XPathInit::initialize()
   {
  -     XBoolean::initialize();
  +     XObject::initialize();
   
        XUnknown::initialize();
   
  @@ -124,7 +124,7 @@
   
        XUnknown::terminate();
   
  -     XBoolean::terminate();
  +     XObject::terminate();
   }
   
   
  
  
  
  1.66      +111 -46   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.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- XPathProcessorImpl.cpp    5 Dec 2002 01:43:28 -0000       1.65
  +++ XPathProcessorImpl.cpp    2 Jan 2003 17:39:09 -0000       1.66
  @@ -145,7 +145,7 @@
   
        if (length(m_token) != 0)
        {
  -             error("Extra illegal tokens!");
  +             error("Extra illegal tokens.");
        }
   
        m_xpath = 0;
  @@ -191,7 +191,7 @@
   
        if (length(m_token) != 0)
        {
  -             error("Extra illegal tokens!");
  +             error("Extra illegal tokens.");
        }
   
        // Terminate for safety.
  @@ -275,7 +275,7 @@
                                }
                                else
                                {
  -                                     error("misquoted literal... expected 
double quote!");
  +                                     error("misquoted literal... expected 
double quote.");
                                }
                        }
                        break;
  @@ -313,7 +313,7 @@
                                }
                                else
                                {
  -                                     error("misquoted literal... expected 
single quote!");
  +                                     error("misquoted literal... expected 
single quote.");
                                }
                        }
                        break;
  @@ -525,7 +525,7 @@
   
        if (0 == m_expression->tokenQueueSize())
        {
  -             error("Empty expression!");
  +             error("Empty expression.");
        }
   
        m_expression->setTokenPosition(0);
  @@ -543,8 +543,9 @@
        {
                if(!isStart)
                {
  -                     
m_expression->adjustPattern(m_expression->patternMapSize() - 1,
  -                                                                             
-TARGETEXTRA);
  +                     m_expression->adjustPattern(
  +                             m_expression->patternMapSize() - 1,
  +                             -TARGETEXTRA);
                }
   
                const int       theValue =
  @@ -1357,28 +1358,6 @@
   
   
   void
  -XPathProcessorImpl::BooleanExpr()
  -{
  -     const int       opPos = m_expression->opCodeMapLength();
  -
  -     m_expression->appendOpCode(XPathExpression::eOP_BOOL);
  -
  -     Expr();
  -
  -     const int       opLen = m_expression->opCodeMapLength() - opPos;
  -
  -     if(opLen == 2)
  -     {
  -             error("boolean(...) argument is no longer optional with 
19990709 XPath draft.");
  -     }
  -
  -     m_expression->updateOpCodeLength(XPathExpression::eOP_BOOL,
  -                                                                      opPos);
  -}
  -
  -
  -
  -void
   XPathProcessorImpl::UnionExpr()
   {
        const int       opPos = m_expression->opCodeMapLength();
  @@ -1567,7 +1546,7 @@
        }
        else
        {
  -             error(TranscodeFromLocalCodePage("A literal argument is 
required!"));
  +             error(TranscodeFromLocalCodePage("A literal argument is 
required."));
        }
   
        m_expression->updateOpCodeLength(XPathExpression::eOP_ARGUMENT,
  @@ -1587,7 +1566,7 @@
        {
                if(tokenIs(XalanUnicode::charComma) == true)
                {
  -                     error("Found ',' but no preceding argument!");
  +                     error("Found ',' but no preceding argument.");
                }
   
                Argument();
  @@ -1600,7 +1579,7 @@
   
                        if(tokenIs(XalanUnicode::charRightParenthesis) == true)
                        {
  -                             error("Found ',' but no following argument!");
  +                             error("Found ',' but no following argument.");
                        }
                }
        }
  @@ -1666,6 +1645,18 @@
                        return;
                        break;
   
  +             case XPathExpression::eOP_FUNCTION_POSITION:
  +                     FunctionPosition();
  +                     break;
  +
  +             case XPathExpression::eOP_FUNCTION_LAST:
  +                     FunctionLast();
  +                     break;
  +
  +             case XPathExpression::eOP_FUNCTION_COUNT:
  +                     FunctionCount();
  +                     break;
  +
                default:
                        {
                                // The position must be at least zero, since
  @@ -1690,18 +1681,18 @@
                                m_expression->appendOpCode(
                                                XPathExpression::eOP_FUNCTION,
                                                theArgs);
  -                     }
  -             }
   
  -             nextToken();
  +                             nextToken();
   
  -             // Get the arguments, and the argument count...
  -             const int       argCount = FunctionCallArguments();
  +                             // Get the arguments, and the argument count...
  +                             const int       argCount = 
FunctionCallArguments();
   
  -             assert(m_expression->m_opMap[opPos + 3] == 0);
  +                             assert(m_expression->m_opMap[opPos + 3] == 0);
   
  -             // update the arg count in the op map...
  -             m_expression->m_opMap[opPos + 3] = argCount;
  +                             // update the arg count in the op map...
  +                             m_expression->m_opMap[opPos + 3] = argCount;
  +                     }
  +             }
        }
   
        // Terminate for safety.
  @@ -1713,6 +1704,77 @@
   
   
   void
  +XPathProcessorImpl::FunctionPosition()
  +{
  +     m_expression->appendOpCode(XPathExpression::eOP_FUNCTION_POSITION);
  +
  +     // Consume the name...
  +     nextToken();
  +
  +     // Get the arguments, and the argument count...
  +     const int       argCount = FunctionCallArguments();
  +
  +     if (argCount != 0)
  +     {
  +             error("The position() function does not accept any arguments");
  +     }
  +     else
  +     {
  +             if (m_positionPredicateStack.empty() == false)
  +             {
  +                     m_positionPredicateStack.back() = true;
  +             }
  +     }
  +}
  +
  +
  +
  +void
  +XPathProcessorImpl::FunctionLast()
  +{
  +     m_expression->appendOpCode(XPathExpression::eOP_FUNCTION_LAST);
  +
  +     // Consume the name...
  +     nextToken();
  +
  +     // Get the arguments, and the argument count...
  +     const int       argCount = FunctionCallArguments();
  +
  +     if (argCount != 0)
  +     {
  +             error("The last() function does not accept any arguments");
  +     }
  +     else
  +     {
  +             if (m_positionPredicateStack.empty() == false)
  +             {
  +                     m_positionPredicateStack.back() = true;
  +             }
  +     }
  +}
  +
  +
  +
  +void
  +XPathProcessorImpl::FunctionCount()
  +{
  +     m_expression->appendOpCode(XPathExpression::eOP_FUNCTION_COUNT);
  +
  +     // Consume the name...
  +     nextToken();
  +
  +     // Get the arguments, and the argument count...
  +     const int       argCount = FunctionCallArguments();
  +
  +     if (argCount != 1)
  +     {
  +             error("The count() function takes one arguments");
  +     }
  +}
  +
  +
  +
  +void
   XPathProcessorImpl::LocationPath()
   {
        const int       opPos = m_expression->opCodeMapLength();
  @@ -1823,7 +1885,7 @@
        }
        else if (tokenIs(XalanUnicode::charRightParenthesis) == false)
        {
  -             error("Unexpected token!");
  +             error("Unexpected token.");
        }
   }
   
  @@ -1866,7 +1928,7 @@
                {
                        nextToken();
   
  -                     error("Expected axis or node test!");
  +                     error("Expected axis or node test.");
                }
                else
                {
  @@ -1992,7 +2054,7 @@
                }
                else if (isNodeTest(m_token) == false)
                {
  -                     error("Expected node test!");
  +                     error("Expected node test.");
                }
                else
                {
  @@ -2126,7 +2188,7 @@
        {
                error(TranscodeFromLocalCodePage("Pattern literal (") +
                          m_token +
  -                       TranscodeFromLocalCodePage(") needs to be quoted!"));
  +                       TranscodeFromLocalCodePage(") needs to be quoted."));
        }
   }
   
  @@ -2328,7 +2390,7 @@
                }
                else
                {
  -                     error("Only child:: and attribute:: axes are allowed in 
match patterns!");
  +                     error("Only child:: and attribute:: axes are allowed in 
match patterns.");
                }
   
                nextToken();
  @@ -2364,7 +2426,7 @@
                        }
                        else
                        {
  -                             error("Only child:: and attribute:: axes are 
allowed in match patterns!");
  +                             error("Only child:: and attribute:: axes are 
allowed in match patterns.");
                        }
   
                        nextToken();
  @@ -2922,9 +2984,12 @@
   
   const XPathProcessorImpl::TableEntry XPathProcessorImpl::s_functionTable[] =
   {
  +     { XPathProcessorImpl::s_lastString, XPathExpression::eOP_FUNCTION_LAST 
},
        { XPathProcessorImpl::s_nodeString, XPathExpression::eNODETYPE_NODE },
        { XPathProcessorImpl::s_textString, XPathExpression::eNODETYPE_TEXT },
  +     { XPathFunctionTable::s_count, XPathExpression::eOP_FUNCTION_COUNT  },
        { XPathProcessorImpl::s_commentString, 
XPathExpression::eNODETYPE_COMMENT },
  +     { XPathProcessorImpl::s_positionString, 
XPathExpression::eOP_FUNCTION_POSITION },
        { XPathProcessorImpl::s_piString, XPathExpression::eNODETYPE_PI },
   };
   
  
  
  
  1.29      +9 -9      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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XPathProcessorImpl.hpp    12 Dec 2002 01:51:57 -0000      1.28
  +++ XPathProcessorImpl.hpp    2 Jan 2003 17:39:09 -0000       1.29
  @@ -514,15 +514,6 @@
        UnaryExpr();
   
        /**
  -      * 
  -      * 
--------------------------------------------------------------------------------
  -      BooleanExpr  ::=       Expr   
  -      * 
--------------------------------------------------------------------------------
  -      */
  -     void
  -     BooleanExpr();
  -
  -     /**
         * The context of the right hand side expressions is the context of the 
         * left hand side expression. The results of the right hand side 
expressions 
         * are node sets. The result of the left hand side UnionExpr is the 
union 
  @@ -590,6 +581,15 @@
         */
        void
        FunctionCall();
  +
  +     void
  +     FunctionPosition();
  +
  +     void
  +     FunctionLast();
  +
  +     void
  +     FunctionCount();
   
        /**
         * 
--------------------------------------------------------------------------------
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to