morten      01/07/30 06:35:41

  Modified:    java/src/org/apache/xalan/xsltc DOM.java
               java/src/org/apache/xalan/xsltc/compiler EqualityExpr.java
                        FilterParentPath.java Parser.java Predicate.java
                        Step.java SyntaxTreeNode.java Variable.java
                        XSLTC.java
               java/src/org/apache/xalan/xsltc/dom DOMAdapter.java
                        DOMImpl.java MultiDOM.java
               java/src/org/apache/xalan/xsltc/runtime
                        AbstractTranslet.java DefaultSAXOutputHandler.java
                        TextOutput.java
               java/src/org/apache/xalan/xsltc/trax
                        TransformerFactoryImpl.java
  Log:
  Added code that will speed up predicates such as //[EMAIL PROTECTED],
  //foo[bar = $var] and //foo/[EMAIL PROTECTED] = 'str'].
  PR:           n/a
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.2       +3 -1      xml-xalan/java/src/org/apache/xalan/xsltc/DOM.java
  
  Index: DOM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/DOM.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOM.java  2001/04/17 18:51:12     1.1
  +++ DOM.java  2001/07/30 13:35:40     1.2
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DOM.java,v 1.1 2001/04/17 18:51:12 sboag Exp $
  + * @(#)$Id: DOM.java,v 1.2 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -95,6 +95,8 @@
       public NodeIterator getTypedAxisIterator(final int axis, final int type);
       public NodeIterator getNthDescendant(int node, int n);
       public NodeIterator getNamespaceAxisIterator(final int axis, final int 
ns);
  +    public NodeIterator getNodeValueIterator(NodeIterator iter,
  +                                          String value, boolean op);
       public NodeIterator orderNodes(NodeIterator source, int node);
       public String getNodeName(final int node);
       public String getNamespaceName(final int node);
  
  
  
  1.5       +16 -1     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/EqualityExpr.java
  
  Index: EqualityExpr.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/EqualityExpr.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EqualityExpr.java 2001/07/10 17:45:08     1.4
  +++ EqualityExpr.java 2001/07/30 13:35:40     1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: EqualityExpr.java,v 1.4 2001/07/10 17:45:08 morten Exp $
  + * @(#)$Id: EqualityExpr.java,v 1.5 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -90,6 +90,21 @@
       
       public String toString() {
        return Operators.names[_op] + '(' + _left + ", " + _right + ')';
  +    }
  +
  +    public Expression getLeft() {
  +     return _left;
  +    }
  +
  +    public Expression getRight() {
  +     return _right;
  +    }
  +
  +    public boolean getOp() {
  +     if (_op == Operators.NE)
  +         return false;
  +     else
  +         return true;
       }
   
       private void swapArguments() {
  
  
  
  1.4       +6 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FilterParentPath.java
  
  Index: FilterParentPath.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FilterParentPath.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FilterParentPath.java     2001/06/17 12:23:28     1.3
  +++ FilterParentPath.java     2001/07/30 13:35:40     1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: FilterParentPath.java,v 1.3 2001/06/17 12:23:28 curcuru Exp $
  + * @(#)$Id: FilterParentPath.java,v 1.4 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -98,6 +98,11 @@
            if (ftype instanceof ReferenceType)  {
                _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
            }
  +         /*
  +         else if (ftype instanceof ResultTreeType)  {
  +             _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
  +         }
  +         */
            else if (ftype instanceof NodeType)  {
                _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
            }
  
  
  
  1.18      +10 -2     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Parser.java
  
  Index: Parser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Parser.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Parser.java       2001/07/19 18:48:31     1.17
  +++ Parser.java       2001/07/30 13:35:40     1.18
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Parser.java,v 1.17 2001/07/19 18:48:31 morten Exp $
  + * @(#)$Id: Parser.java,v 1.18 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -86,7 +86,7 @@
   import org.apache.xalan.xsltc.compiler.util.*;
   import org.apache.xalan.xsltc.runtime.AttributeList;
   
  -public final class Parser implements Constants, ContentHandler {
  +public class Parser implements Constants, ContentHandler {
   
       private static final String XSL = "xsl";            // standard prefix
       private static final String TRANSLET = "translet"; // extension prefix
  @@ -181,6 +181,10 @@
        return (SyntaxTreeNode)_variableScope.get(name);
       }
   
  +    public void setXSLTC(XSLTC xsltc) {
  +     _xsltc = xsltc;
  +    }
  +
       public XSLTC getXSLTC() {
        return _xsltc;
       }
  @@ -409,6 +413,10 @@
            reportError(Constants.ERROR, new ErrorMsg(e.getMessage()));
        }
        return null;
  +    }
  +
  +    public SyntaxTreeNode getDocumentRoot() {
  +     return _root;
       }
   
       /**
  
  
  
  1.6       +85 -4     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Predicate.java
  
  Index: Predicate.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Predicate.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Predicate.java    2001/06/28 15:36:14     1.5
  +++ Predicate.java    2001/07/30 13:35:40     1.6
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Predicate.java,v 1.5 2001/06/28 15:36:14 morten Exp $
  + * @(#)$Id: Predicate.java,v 1.6 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -293,20 +293,101 @@
       }
   
       /**
  +     * Method to see if we can optimise the predicate by using a specialised
  +     * iterator for expressions like '/foo/[EMAIL PROTECTED] = $var]', which 
are
  +     * very common in many stylesheets
  +     */
  +    public boolean isNodeValueTest() {
  +     if ((getStep() != null) && (getCompareValue() != null))
  +         return true;
  +     else
  +         return false;
  +    }
  +
  +    private Expression _value = null;
  +    private Expression _step = null;
  +
  +    /**
  +     * Utility method for optimisation. See isNodeValueTest()
  +     */
  +    public Expression getCompareValue() {
  +     if (_value != null) return _value;
  +     if (_exp == null) return null;
  +
  +     if (_exp instanceof EqualityExpr) {
  +         EqualityExpr exp = (EqualityExpr)_exp;
  +         Expression left = exp.getLeft();
  +         Expression right = exp.getRight();
  +
  +         Type tleft = left.getType();
  +         Type tright = right.getType();
  +
  +         
  +         if (left instanceof CastExpr) left = ((CastExpr)left).getExpr();
  +         if (right instanceof CastExpr) right = ((CastExpr)right).getExpr();
  +         
  +         try {
  +             if ((tleft == Type.String) && (!(left instanceof Step)))
  +                 _value = exp.getLeft();
  +             if ((left instanceof VariableRef) ||
  +                 (left instanceof ParameterRef))
  +                 _value = new CastExpr(left, Type.String);
  +         }
  +         catch (TypeCheckError e) { }
  +
  +         try {
  +             if ((tright == Type.String) && (!(right instanceof Step)))
  +                 _value = exp.getRight();
  +             if ((right instanceof VariableRef) || 
  +                 (right instanceof ParameterRef))
  +                 _value = new CastExpr(right, Type.String);
  +         }
  +         catch (TypeCheckError e) { }
  +
  +     }
  +     return _value;
  +    }
  +
  +    /**
  +     * Utility method for optimisation. See isNodeValueTest()
  +     */
  +    public Expression getStep() {
  +     if (_step != null) return _step;
  +     if (_exp == null) return null;
  +
  +     if (_exp instanceof EqualityExpr) {
  +         EqualityExpr exp = (EqualityExpr)_exp;
  +         Expression left = exp.getLeft();
  +         Expression right = exp.getRight();
  +
  +         if (left instanceof CastExpr) left = ((CastExpr)left).getExpr();
  +         if (left instanceof Step) _step = left;
  +         
  +         if (right instanceof CastExpr) right = ((CastExpr)right).getExpr();
  +         if (right instanceof Step) _step = right;
  +     }
  +     return _step;
  +    }
  +
  +    /**
        * Translate a predicate expression. This translation pushes
        * two references on the stack: a reference to a newly created
        * filter object and a reference to the predicate's closure.
        */
       public void translate(ClassGenerator classGen, MethodGenerator 
methodGen) {
   
  +     final ConstantPoolGen cpg = classGen.getConstantPool();
  +     final InstructionList il = methodGen.getInstructionList();
  +
        if (_nthPositionFilter || _nthDescendant) {
            _exp.translate(classGen, methodGen);
        }
  +     else if (isNodeValueTest()) {
  +         _value.translate(classGen, methodGen);
  +         il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
  +     }
        else {
            compileFilter(classGen, methodGen);
  -     
  -         final ConstantPoolGen cpg = classGen.getConstantPool();
  -         final InstructionList il = methodGen.getInstructionList();
            il.append(new NEW(cpg.addClass(_className)));
            il.append(DUP);
            il.append(new INVOKESPECIAL(cpg.addMethodref(_className,
  
  
  
  1.5       +38 -13    
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Step.java
  
  Index: Step.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Step.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Step.java 2001/06/28 15:36:17     1.4
  +++ Step.java 2001/07/30 13:35:40     1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Step.java,v 1.4 2001/06/28 15:36:17 morten Exp $
  + * @(#)$Id: Step.java,v 1.5 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -153,6 +153,13 @@
   
   
       /**
  +     *
  +     */
  +    protected void setParent(SyntaxTreeNode node) {
  +     _parent = node;
  +    }
  +
  +    /**
        * Returns 'true' if this step has a parent pattern
        */
       public boolean hasParent() {
  @@ -349,8 +356,28 @@
            final Predicate predicate = (Predicate)_predicates.lastElement();
            _predicates.remove(predicate);
   
  +         // Handle '//[EMAIL PROTECTED] = $var]' expression
  +         if (predicate.isNodeValueTest()) {
  +             Step step = (Step)(predicate.getStep());
  +             ParentLocationPath path = new ParentLocationPath(this, step);
  +
  +             try {
  +                 path.typeCheck(getParser().getSymbolTable());
  +             }
  +             catch (TypeCheckError e) {}
  +
  +             il.append(methodGen.loadDOM());
  +             path.translate(classGen, methodGen);
  +             
  +             final String signature =
  +                 "("+NODE_ITERATOR_SIG+STRING_SIG+"Z)"+NODE_ITERATOR_SIG;
  +             final int iter = cpg.addMethodref(DOM_CLASS,
  +                                               "getNodeValueIterator",
  +                                               signature);
  +             il.append(new INVOKEVIRTUAL(iter));
  +         }
            // Handle '//*[n]' expression
  -         if (predicate.isNthDescendant()) {
  +         else if (predicate.isNthDescendant()) {
                il.append(methodGen.loadDOM());
                il.append(methodGen.loadContextNode());
                predicate.translate(classGen, methodGen);
  @@ -372,20 +399,18 @@
                il.append(new INVOKESPECIAL(initNI));
            }
            else {
  -             final int initCNLI =
  -                 cpg.addMethodref(CURRENT_NODE_LIST_ITERATOR,
  -                                  "<init>",
  -                                  "("
  -                                  + NODE_ITERATOR_SIG
  -                                  + CURRENT_NODE_LIST_FILTER_SIG
  -                                  + NODE_SIG // current node
  -                                  + TRANSLET_SIG
  -                                  + ")V");
  +             final int init = cpg.addMethodref(CURRENT_NODE_LIST_ITERATOR,
  +                                               "<init>",
  +                                               "("
  +                                               + NODE_ITERATOR_SIG
  +                                               + CURRENT_NODE_LIST_FILTER_SIG
  +                                               + NODE_SIG
  +                                               + TRANSLET_SIG
  +                                               + ")V");
                // create new CurrentNodeListIterator
                il.append(new NEW(cpg.addClass(CURRENT_NODE_LIST_ITERATOR)));
                il.append(DUP);
                translatePredicates(classGen, methodGen); // recursive call
  -             
                predicate.translate(classGen, methodGen);
                
                il.append(methodGen.loadCurrentNode());
  @@ -394,7 +419,7 @@
                    final String className = classGen.getClassName();
                    il.append(new CHECKCAST(cpg.addClass(className)));
                }
  -             il.append(new INVOKESPECIAL(initCNLI));
  +             il.append(new INVOKESPECIAL(init));
            }
        }
       }
  
  
  
  1.10      +3 -3      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java
  
  Index: SyntaxTreeNode.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SyntaxTreeNode.java       2001/07/12 10:45:59     1.9
  +++ SyntaxTreeNode.java       2001/07/30 13:35:40     1.10
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: SyntaxTreeNode.java,v 1.9 2001/07/12 10:45:59 morten Exp $
  + * @(#)$Id: SyntaxTreeNode.java,v 1.10 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -90,7 +90,7 @@
       private final int _line;
   
       // Reference to this node's parent node
  -    private SyntaxTreeNode _parent;
  +    protected SyntaxTreeNode _parent;
       // Contains all child nodes of this node
       private final Vector   _contents = new Vector(2);
   
  @@ -212,7 +212,7 @@
        _parser = parser;
       }
   
  -    protected final void setParent(SyntaxTreeNode parent) {
  +    protected void setParent(SyntaxTreeNode parent) {
        if (_parent == null)
            _parent = parent;
       }
  
  
  
  1.10      +2 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Variable.java
  
  Index: Variable.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Variable.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Variable.java     2001/07/10 17:45:31     1.9
  +++ Variable.java     2001/07/30 13:35:40     1.10
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Variable.java,v 1.9 2001/07/10 17:45:31 morten Exp $
  + * @(#)$Id: Variable.java,v 1.10 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -72,6 +72,7 @@
   import de.fub.bytecode.generic.*;
   import de.fub.bytecode.classfile.Field;
   import org.apache.xalan.xsltc.compiler.util.*;
  +import org.apache.xalan.xsltc.dom.Axis;
   
   final class Variable extends TopLevelElement {
   
  
  
  
  1.21      +34 -52    
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java
  
  Index: XSLTC.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- XSLTC.java        2001/07/23 07:39:35     1.20
  +++ XSLTC.java        2001/07/30 13:35:40     1.21
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: XSLTC.java,v 1.20 2001/07/23 07:39:35 morten Exp $
  + * @(#)$Id: XSLTC.java,v 1.21 2001/07/30 13:35:40 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -91,7 +91,7 @@
   public final class XSLTC {
   
       // A reference to the main stylesheet parser object.
  -    private final Parser _parser;
  +    private Parser _parser;
   
       // A reference to an external XMLReader (SAX parser) passed to us
       private XMLReader _reader = null;
  @@ -124,10 +124,10 @@
       private Hashtable _namespaces; // Hashtable of all registered namespaces
   
       // These define the various methods for outputting the translet
  -    private static final int FILE_OUTPUT        = 0;
  -    private static final int JAR_OUTPUT         = 1;
  -    private static final int BYTEARRAY_OUTPUT   = 2;
  -    private static final int CLASSLOADER_OUTPUT = 3;
  +    public static final int FILE_OUTPUT        = 0;
  +    public static final int JAR_OUTPUT         = 1;
  +    public static final int BYTEARRAY_OUTPUT   = 2;
  +    public static final int CLASSLOADER_OUTPUT = 3;
   
       // Compiler options (passed from command line or XSLTC client)
       private boolean _debug = false;      // -x
  @@ -148,6 +148,20 @@
       }
   
       /**
  +     * Only for user by the internal TrAX implementation.
  +     */
  +    public void setParser(Parser parser) {
  +     _parser = parser;
  +    }
  +
  +    /**
  +     * Only for user by the internal TrAX implementation.
  +     */
  +    public void setOutputType(int type) {
  +     _outputType = type;
  +    }
  +
  +    /**
        * Initializes the compiler to compile a new stylesheet
        */
       public void init() {
  @@ -337,69 +351,33 @@
       }
   
       /**
  -     * Compiles a stylesheet pointed to by a URL. The result is put in a
  -     * set of byte arrays. One byte array for each generated class.
  -     * @param name The name of the translet class to generate
  -     * @param input An InputSource that will pass in the stylesheet contents
  +     * Returns an array of bytecode arrays generated by a compilation.
        * @return JVM bytecodes that represent translet class definition
        */
  -    public byte[][] compile(String name, InputSource input) {
  -     _outputType = BYTEARRAY_OUTPUT;
  -     if (compile(input, name)) {
  -         final int count = _classes.size();
  -         final byte[][] result = new byte[count][1];
  -         for (int i = 0; i < count; i++)
  -             result[i] = (byte[])_classes.elementAt(i);
  -         return result;
  -     }
  -     /*
  -     catch (IOException e) {
  -         _parser.reportError(Constants.FATAL, new ErrorMsg(e.getMessage()));
  -         return null;
  -     }
  -     */
  -     return null;
  +    public byte[][] getBytecodes() {
  +     final int count = _classes.size();
  +     final byte[][] result = new byte[count][1];
  +     for (int i = 0; i < count; i++)
  +         result[i] = (byte[])_classes.elementAt(i);
  +     return result;
       }
   
       /**
        * Compiles a stylesheet pointed to by a URL. The result is put in a
        * set of byte arrays. One byte array for each generated class.
        * @param name The name of the translet class to generate
  -     * @param input An InputStream that will pass in the stylesheet contents
  +     * @param input An InputSource that will pass in the stylesheet contents
        * @return JVM bytecodes that represent translet class definition
        */
  -    /*
  -    public byte[][] compile(InputStream stream, String systemId, String 
name) {
  +    public byte[][] compile(String name, InputSource input) {
        _outputType = BYTEARRAY_OUTPUT;
  -     final InputSource input = new InputSource(stream);
  -     input.setSystemId(systemId);
  -     if (compile(input, name, null))
  +     if (compile(input, name))
            return getBytecodes();
        else
            return null;
       }
  -    */
   
       /**
  -     * Compiles a stylesheet pointed to by a URL. The result is put in a
  -     * set of byte arrays. One byte array for each generated class.
  -     * @param name The name of the translet class to generate
  -     * @param reader The Reader object to get the stylesheet contents from
  -     * @return JVM bytecodes that represent translet class definition
  -     */
  -    /*
  -    public byte[][] compile(Reader reader, String systemId, String name) {
  -     _outputType = BYTEARRAY_OUTPUT;
  -     final InputSource input = new InputSource(reader);
  -     input.setSystemId(systemId);
  -     if (compile(input, name, null))
  -         return getBytecodes();
  -     else
  -         return null;
  -    }
  -    */
  -    
  -    /**
        * Set the XMLReader to use for parsing the next input stylesheet
        * @param reader XMLReader (SAX2 parser) to use
        */
  @@ -444,6 +422,10 @@
        */
       protected void setMultiDocument(boolean flag) {
        _multiDocument = flag;
  +    }
  +
  +    public boolean isMultiDocument() {
  +     return _multiDocument;
       }
   
       /**
  
  
  
  1.2       +6 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java
  
  Index: DOMAdapter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMAdapter.java   2001/04/17 18:52:29     1.1
  +++ DOMAdapter.java   2001/07/30 13:35:41     1.2
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DOMAdapter.java,v 1.1 2001/04/17 18:52:29 sboag Exp $
  + * @(#)$Id: DOMAdapter.java,v 1.2 2001/07/30 13:35:41 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -142,6 +142,11 @@
   
       public NodeIterator getNthDescendant(int node, int n) {
        return _domImpl.getNthDescendant(node, n);
  +    }
  +
  +    public NodeIterator getNodeValueIterator(NodeIterator iterator,
  +                                          String value, boolean op) {
  +     return _domImpl.getNodeValueIterator(iterator, value, op);
       }
   
       public NodeIterator orderNodes(NodeIterator source, int node) {
  
  
  
  1.14      +80 -3     
xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java
  
  Index: DOMImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DOMImpl.java      2001/07/27 08:33:20     1.13
  +++ DOMImpl.java      2001/07/30 13:35:41     1.14
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DOMImpl.java,v 1.13 2001/07/27 08:33:20 morten Exp $
  + * @(#)$Id: DOMImpl.java,v 1.14 2001/07/30 13:35:41 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -1474,11 +1474,88 @@
   
       } // end of StrippingIterator
   
  -    public NodeIterator strippingIterator(NodeIterator iterator, short[] 
mapping,
  +    public NodeIterator strippingIterator(NodeIterator iterator,
  +                                       short[] mapping,
                                          StripWhitespaceFilter filter) {
        return(new StrippingIterator(iterator, mapping, filter));
       }
  -                                
  +
  +    /**************************************************************
  +     * This is a specialised iterator for predicates comparing node or
  +     * attribute values to variable or parameter values.
  +     */
  +    private final class NodeValueIterator extends NodeIteratorBase {
  +
  +     private NodeIterator _source;
  +     private String _value;
  +     private boolean _op;
  +     private final boolean _isReverse;
  +
  +     public NodeValueIterator(NodeIterator source,
  +                              String value, boolean op) {
  +         _source = source;
  +         _value = value;
  +         _op = op;
  +         _isReverse = source.isReverse();
  +     }
  +
  +     public boolean isReverse() {
  +         return _isReverse;
  +     }
  +    
  +     public NodeIterator cloneIterator() {
  +         try {
  +             NodeValueIterator clone = (NodeValueIterator)super.clone();
  +             clone._isRestartable = false;
  +             clone._source = _source.cloneIterator();
  +             clone._value = _value;
  +             clone._op = _op;
  +             return clone.reset();
  +         }
  +         catch (CloneNotSupportedException e) {
  +             BasisLibrary.runTimeError("Iterator clone not supported."); 
  +             return null;
  +         }
  +     }
  +    
  +     public NodeIterator reset() {
  +         _source.reset();
  +         return resetPosition();
  +     }
  +
  +     public int next() {
  +
  +         int node;
  +         while ((node = _source.next()) != END) {
  +             String val = getNodeValue(node);
  +             if (_value.equals(val) == _op) {
  +                 return _parent[node];
  +             }
  +         }
  +         return END;
  +     }
  +
  +     public NodeIterator setStartNode(int node) {
  +         if (_isRestartable) {
  +             _source.setStartNode(_startNode = node); 
  +             return resetPosition();
  +         }
  +         return this;
  +     }
  +
  +     public void setMark() {
  +         _source.setMark();
  +     }
  +
  +     public void gotoMark() {
  +         _source.gotoMark();
  +     }
  +    }                       
  +
  +    public NodeIterator getNodeValueIterator(NodeIterator iterator,
  +                                          String value, boolean op) {
  +     return(new NodeValueIterator(iterator, value, op));
  +    }
   
       /**************************************************************
        * Iterator that assured that a single node is only returned once
  
  
  
  1.4       +6 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/dom/MultiDOM.java
  
  Index: MultiDOM.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/MultiDOM.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MultiDOM.java     2001/07/10 17:46:18     1.3
  +++ MultiDOM.java     2001/07/30 13:35:41     1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: MultiDOM.java,v 1.3 2001/07/10 17:46:18 morten Exp $
  + * @(#)$Id: MultiDOM.java,v 1.4 2001/07/30 13:35:41 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -227,6 +227,11 @@
   
       public NodeIterator getNthDescendant(int node, int n) {
        return _adapters[node>>>24].getNthDescendant(node & CLR, n);
  +    }
  +
  +    public NodeIterator getNodeValueIterator(NodeIterator iterator,
  +                                          String value, boolean op) {
  +     return _adapters[0].getNodeValueIterator(iterator, value, op);
       }
   
       public NodeIterator getNamespaceAxisIterator(final int axis, final int 
ns) {
  
  
  
  1.15      +5 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java
  
  Index: AbstractTranslet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractTranslet.java     2001/07/19 16:46:35     1.14
  +++ AbstractTranslet.java     2001/07/30 13:35:41     1.15
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: AbstractTranslet.java,v 1.14 2001/07/19 16:46:35 morten Exp $
  + * @(#)$Id: AbstractTranslet.java,v 1.15 2001/07/30 13:35:41 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -229,6 +229,7 @@
        * Get the value of a variable given its index.
        */
       public final Object getVariable(int vindex) {
  +     Object blob = varsStack.elementAt(vbase + vindex);
        return varsStack.elementAt(vbase + vindex);
       }
   
  @@ -236,7 +237,9 @@
        * Set the value of a variable in the current frame.
        */
       public final void addVariable(int vindex, Object value) {
  -     varsStack.insertElementAt(value, vbase + vindex);
  +     final int index = vbase + vindex;
  +     if (index > varsStack.size()) varsStack.setSize(index);
  +     varsStack.insertElementAt(value, index);
       }
   
       /************************************************************************
  
  
  
  1.9       +2 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/DefaultSAXOutputHandler.java
  
  Index: DefaultSAXOutputHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/DefaultSAXOutputHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultSAXOutputHandler.java      2001/07/20 11:56:48     1.8
  +++ DefaultSAXOutputHandler.java      2001/07/30 13:35:41     1.9
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DefaultSAXOutputHandler.java,v 1.8 2001/07/20 11:56:48 morten 
Exp $
  + * @(#)$Id: DefaultSAXOutputHandler.java,v 1.9 2001/07/30 13:35:41 morten 
Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -105,7 +105,7 @@
       private static final char[] ENDPI    = "?>".toCharArray();
       private static final char[] GT_CR    = ">\n".toCharArray();
       private static final char[] GT_LT_SL = "></".toCharArray();
  -    private static final char[] SL_GT    = "/>".toCharArray();
  +    private static final char[] SL_GT    = "/>\n".toCharArray();
       private static final char[] XMLNS    = " xmlns".toCharArray();
   
       // All of these are used to control/track output indentation
  
  
  
  1.15      +2 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java
  
  Index: TextOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TextOutput.java   2001/07/19 16:46:35     1.14
  +++ TextOutput.java   2001/07/30 13:35:41     1.15
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TextOutput.java,v 1.14 2001/07/19 16:46:35 morten Exp $
  + * @(#)$Id: TextOutput.java,v 1.15 2001/07/30 13:35:41 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -113,7 +113,7 @@
       private static final char[] ENDCDATA = "]]>".toCharArray();
       private static final char[] CNTCDATA = "]]]]><![CDATA[>".toCharArray();
       private static final char[] BEGCOMM  = "<!--".toCharArray();
  -    private static final char[] ENDCOMM  = "-->".toCharArray();
  +    private static final char[] ENDCOMM  = "-->\n".toCharArray();
   
       private static final String EMPTYSTRING = "";
   
  
  
  
  1.15      +2 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TransformerFactoryImpl.java       2001/07/23 08:47:56     1.14
  +++ TransformerFactoryImpl.java       2001/07/30 13:35:41     1.15
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransformerFactoryImpl.java,v 1.14 2001/07/23 08:47:56 morten 
Exp $
  + * @(#)$Id: TransformerFactoryImpl.java,v 1.15 2001/07/30 13:35:41 morten 
Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -92,7 +92,7 @@
    * Implementation of a JAXP1.1 TransformerFactory for Translets.
    */
   public class TransformerFactoryImpl
  -    extends TransformerFactory implements SourceLoader {
  +    extends SAXTransformerFactory implements SourceLoader {
   
       // This constant should be removed once all abstract methods are impl'ed.
       private static final String NYI = "Not yet implemented";
  
  
  

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

Reply via email to