auriemma    00/11/08 06:21:22

  Modified:    c/src/XPath XPath.cpp
  Log:
  Changed the way variable arguments are handled.
  
  Revision  Changes    Path
  1.33      +25 -26    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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- XPath.cpp 2000/11/06 19:33:42     1.32
  +++ XPath.cpp 2000/11/08 14:21:05     1.33
  @@ -1335,12 +1335,9 @@
        opPos++;
   
        typedef XPathExecutionContext::XObjectArgVectorType             
XObjectArgVectorType;
  -     typedef XPathExecutionContext::PushPopArgVector                 
PushPopArgVector;
   
  -     PushPopArgVector        thePushPop(executionContext);
  +     XObjectArgVectorType    args;
   
  -     XObjectArgVectorType&   args = thePushPop.getVector();
  -
        while(opPos < endExtFunc)
        {
                const int       nextOpPos = 
m_expression.getNextOpCodePosition(opPos);
  @@ -1391,6 +1388,8 @@
                        int                                             opPos,
                        XPathExecutionContext&  executionContext) const
   {
  +     const XObject*  theResult = 0;
  +
        const int       endFunc = opPos + m_expression.m_opMap[opPos + 1] - 1;
   
        opPos += 2;
  @@ -1412,7 +1411,7 @@
        {
                assert(opPos == endFunc);
   
  -             return s_functions[funcID].execute(executionContext, context);
  +             theResult =  s_functions[funcID].execute(executionContext, 
context);
        }
        else if (argCount == 1)
        {
  @@ -1424,7 +1423,7 @@
                
                assert(opPos == endFunc);
   
  -             return s_functions[funcID].execute(executionContext, context, 
theArg.get());
  +             theResult =  s_functions[funcID].execute(executionContext, 
context, theArg.get());
        }
        else if (argCount == 2)
        {
  @@ -1442,7 +1441,7 @@
                
                assert(opPos == endFunc);
   
  -             return s_functions[funcID].execute(executionContext, context, 
theArg1.get(), theArg2.get());
  +             theResult =  s_functions[funcID].execute(executionContext, 
context, theArg1.get(), theArg2.get());
        }
        else if (argCount == 3)
        {
  @@ -1467,34 +1466,34 @@
   
                assert(opPos == endFunc);
   
  -             return s_functions[funcID].execute(executionContext, context, 
theArg1.get(), theArg2.get(), theArg3.get());
  +             theResult =  s_functions[funcID].execute(executionContext, 
context, theArg1.get(), theArg2.get(), theArg3.get());
        }
  +     else
  +     {
  +             typedef XPathExecutionContext::XObjectArgVectorType             
XObjectArgVectorType;
   
  -     typedef XPathExecutionContext::XObjectArgVectorType             
XObjectArgVectorType;
  -     typedef XPathExecutionContext::PushPopArgVector                 
PushPopArgVector;
  +             XObjectArgVectorType    args;
   
  -     PushPopArgVector        thePushPop(executionContext);
  +             args.reserve(argCount);
   
  -     XObjectArgVectorType&   args = thePushPop.getVector();
  +             while(opPos < endFunc)
  +             {
  +                     const int       nextOpPos = 
m_expression.getNextOpCodePosition(opPos);
   
  -     while(opPos < endFunc)
  -     {
  -             const int       nextOpPos = 
m_expression.getNextOpCodePosition(opPos);
  +                     args.push_back(executeMore(context, opPos, 
executionContext));
   
  -             args.push_back(executeMore(context, opPos, executionContext));
  +                     opPos = nextOpPos;
  +             }
   
  -             opPos = nextOpPos;
  -     }
  +             theResult = function(context, opPos, funcID, args, 
executionContext);
   
  -     const XObject* const            theResult =
  -             function(context, opPos, funcID, args, executionContext);
  +             // Return the args...
  +             while(args.size() > 0)
  +             {
  +                     theFactory.returnObject(args.back());
   
  -     // Return the args...
  -     while(args.size() > 0)
  -     {
  -             theFactory.returnObject(args.back());
  -
  -             args.pop_back();
  +                     args.pop_back();
  +             }
        }
   
        return theResult;
  
  
  

Reply via email to