dbertoni    2002/12/20 16:56:38

  Modified:    c/src/XPath XPath.cpp
  Log:
  Experimental code to avoid using getPreviousSibling().  This code is not 
active.
  
  Revision  Changes    Path
  1.83      +42 -0     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.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- XPath.cpp 5 Dec 2002 01:43:28 -0000       1.82
  +++ XPath.cpp 21 Dec 2002 00:56:37 -0000      1.83
  @@ -2604,6 +2604,7 @@
        const int       argLen =
                currentExpression.getOpCodeMapValue(opPos + 
XPathExpression::s_opCodeMapLengthIndex + 1) - 3;
   
  +#if 1
        XalanNode*      pos = context->getPreviousSibling();
   
        if (pos != 0)
  @@ -2631,6 +2632,47 @@
                        pos = pos->getPreviousSibling();
                } while(0 != pos);
        }
  +#else
  +    // This is some experimental code which avoids using 
getPreviousSibling(), with the idea that we
  +    // could reduce our in-memory representation size by not keeping the 
previous sibling node.
  +     XalanNode*      pos = context->getParentNode();
  +
  +     if (pos != 0)
  +     {
  +             pos = pos->getFirstChild();
  +
  +             if (pos != context)
  +             {
  +                     opPos += 3;
  +
  +                     const NodeTester        theTester(
  +                                                     *this,
  +                                                     executionContext,
  +                                                     opPos,
  +                                                     argLen,
  +                                                     stepType);
  +
  +                     do
  +                     {
  +                             const eMatchScore       score = 
  +                                     theTester(*pos, pos->getNodeType());
  +                                     assert(score == 
nodeTest(executionContext, pos, pos->getNodeType(), opPos, argLen, stepType));
  +
  +                             if(eMatchScoreNone != score)
  +                             {
  +                                     subQueryResults.addNode(pos);
  +                             }
  +
  +                             pos = pos->getNextSibling();
  +                     } while(pos != context);
  +             }
  +
  +             // Now, reverse the order of the nodes, since
  +             // preceeding-sibling is a reverse axis, and we searched
  +             // the document from the root to this node.
  +             subQueryResults.reverse();
  +     }
  +#endif
   
        subQueryResults.setReverseDocumentOrder();
   
  
  
  

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

Reply via email to