dbertoni    2003/01/06 16:40:55

  Modified:    c/src/XPath XPathProcessorImpl.cpp XPathProcessorImpl.hpp
  Log:
  New code to "inline" more XPath functions.
  
  Revision  Changes    Path
  1.69      +32 -10    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.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- XPathProcessorImpl.cpp    3 Jan 2003 21:46:31 -0000       1.68
  +++ XPathProcessorImpl.cpp    7 Jan 2003 00:40:55 -0000       1.69
  @@ -1672,6 +1672,10 @@
                        FunctionNamespaceURI(opPos);
                        break;
   
  +             case XPathExpression::eOP_FUNCTION_SUM:
  +                     FunctionSum();
  +                     break;
  +
                default:
                        {
                                // The position must be at least zero, since
  @@ -2039,6 +2043,25 @@
   
   
   void
  +XPathProcessorImpl::FunctionSum()
  +{
  +     m_expression->appendOpCode(XPathExpression::eOP_FUNCTION_SUM);
  +
  +     // Consume the name...
  +     nextToken();
  +
  +     // Get the arguments, and the argument count...
  +     const int       argCount = FunctionCallArguments();
  +
  +     if (argCount != 1)
  +     {
  +             error("The sum() function takes one argument");
  +     }
  +}
  +
  +
  +
  +void
   XPathProcessorImpl::FunctionStringLength(int opPos)
   {
        
m_expression->appendOpCode(XPathExpression::eOP_FUNCTION_STRINGLENGTH_0);
  @@ -2109,19 +2132,17 @@
   
                const int       newOpPos = m_expression->opCodeMapLength();
   
  -//           if (tokenIs(XalanUnicode::charSolidus) == false)
  -             {
  -                     // Tell how long the step is without the predicate
  -                     const XPathExpression::OpCodeMapValueVectorType         
theArgs(1, 4);
  +             // Tell how long the step is without the predicate
  +             const XPathExpression::OpCodeMapValueVectorType         
theArgs(1, 4);
   
  -                     m_expression->appendOpCode(XPathExpression::eFROM_ROOT,
  -                                                                        
theArgs);
  +             m_expression->appendOpCode(
  +                     XPathExpression::eFROM_ROOT,
  +                     theArgs);
   
  -                     
m_expression->appendOpCode(XPathExpression::eNODETYPE_ROOT);
  +             m_expression->appendOpCode(XPathExpression::eNODETYPE_ROOT);
   
  -                     // Tell how long the entire step is.
  -                     m_expression->updateOpCodeLength(newOpPos);
  -             }
  +             // Tell how long the entire step is.
  +             m_expression->updateOpCodeLength(newOpPos);
        }
   
        if(length(m_token) != 0)
  @@ -3315,6 +3336,7 @@
   const XPathProcessorImpl::TableEntry XPathProcessorImpl::s_functionTable[] =
   {
        { XPathFunctionTable::s_not, XPathExpression::eOP_FUNCTION_NOT },
  +     { XPathFunctionTable::s_sum, XPathExpression::eOP_FUNCTION_SUM },
        { XPathProcessorImpl::s_lastString, XPathExpression::eOP_FUNCTION_LAST 
},
        { XPathFunctionTable::s_name, XPathExpression::eOP_FUNCTION_NAME_0 },
        { XPathProcessorImpl::s_nodeString, XPathExpression::eNODETYPE_NODE },
  
  
  
  1.31      +3 -0      xml-xalan/c/src/XPath/XPathProcessorImpl.hpp
  
  Index: XPathProcessorImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.hpp,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- XPathProcessorImpl.hpp    3 Jan 2003 08:04:24 -0000       1.30
  +++ XPathProcessorImpl.hpp    7 Jan 2003 00:40:55 -0000       1.31
  @@ -624,6 +624,9 @@
        FunctionStringLength(int        opPos);
   
        void
  +     FunctionSum();
  +
  +     void
        FunctionNamespaceURI(int        opPos);
   
        /**
  
  
  

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

Reply via email to