santiagopg    02/04/18 13:55:32

  Modified:    java/src/org/apache/xalan/xsltc/compiler Tag:
                        jaxp-ri-1_2_0-fcs-branch CastExpr.java
               java/src/org/apache/xalan/xsltc/compiler/util Tag:
                        jaxp-ri-1_2_0-fcs-branch ReferenceType.java
               java/src/org/apache/xalan/xsltc/runtime Tag:
                        jaxp-ri-1_2_0-fcs-branch BasisLibrary.java
  Log:
  Fixed problem with extension function nodeset() and parameters.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.10.4.1  +2 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CastExpr.java
  
  Index: CastExpr.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/CastExpr.java,v
  retrieving revision 1.10
  retrieving revision 1.10.4.1
  diff -u -r1.10 -r1.10.4.1
  --- CastExpr.java     1 Feb 2002 20:07:08 -0000       1.10
  +++ CastExpr.java     18 Apr 2002 20:55:32 -0000      1.10.4.1
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: CastExpr.java,v 1.10 2002/02/01 20:07:08 tmiller Exp $
  + * @(#)$Id: CastExpr.java,v 1.10.4.1 2002/04/18 20:55:32 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -140,6 +140,7 @@
        InternalTypeMap.put(Type.Reference, Type.String);
        InternalTypeMap.put(Type.Reference, Type.Node);
        InternalTypeMap.put(Type.Reference, Type.NodeSet);
  +     InternalTypeMap.put(Type.Reference, Type.ResultTree);
   
        InternalTypeMap.put(Type.Void, Type.String);
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.4.1   +18 -1     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ReferenceType.java
  
  Index: ReferenceType.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ReferenceType.java,v
  retrieving revision 1.7
  retrieving revision 1.7.4.1
  diff -u -r1.7 -r1.7.4.1
  --- ReferenceType.java        1 Feb 2002 20:08:11 -0000       1.7
  +++ ReferenceType.java        18 Apr 2002 20:55:32 -0000      1.7.4.1
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ReferenceType.java,v 1.7 2002/02/01 20:08:11 tmiller Exp $
  + * @(#)$Id: ReferenceType.java,v 1.7.4.1 2002/04/18 20:55:32 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -113,6 +113,9 @@
        else if (type == Type.Node) {
            translateTo(classGen, methodGen, (NodeType) type);
        }
  +     else if (type == Type.ResultTree) {
  +         translateTo(classGen, methodGen, (ResultTreeType) type);
  +     }
        else {
            ErrorMsg err = new ErrorMsg(ErrorMsg.INTERNAL_ERR, type.toString());
            classGen.getParser().reportError(Constants.FATAL, err);
  @@ -208,6 +211,20 @@
                            NodeType type) {
        translateTo(classGen, methodGen, Type.NodeSet);
        Type.NodeSet.translateTo(classGen, methodGen, type);
  +    }
  +
  +    /**
  +     * Casts a reference into a ResultTree.
  +     *
  +     * @see  org.apache.xalan.xsltc.compiler.util.Type#translateTo
  +     */
  +    public void translateTo(ClassGenerator classGen, MethodGenerator 
methodGen, 
  +                         ResultTreeType type) {
  +     final ConstantPoolGen cpg = classGen.getConstantPool();
  +     final InstructionList il = methodGen.getInstructionList();
  +     int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, 
"referenceToResultTree", 
  +                                  "(" + OBJECT_SIG + ")" + DOM_INTF_SIG);
  +     il.append(new INVOKESTATIC(index));
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.34.8.4  +24 -21    
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java
  
  Index: BasisLibrary.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java,v
  retrieving revision 1.34.8.3
  retrieving revision 1.34.8.4
  diff -u -r1.34.8.3 -r1.34.8.4
  --- BasisLibrary.java 17 Apr 2002 20:26:12 -0000      1.34.8.3
  +++ BasisLibrary.java 18 Apr 2002 20:55:32 -0000      1.34.8.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: BasisLibrary.java,v 1.34.8.3 2002/04/17 20:26:12 santiagopg Exp $
  + * @(#)$Id: BasisLibrary.java,v 1.34.8.4 2002/04/18 20:55:32 santiagopg Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -904,28 +904,31 @@
        * obj is an instanceof Node then create a singleton iterator.
        */
       public static NodeIterator referenceToNodeSet(Object obj) {
  +     // Convert var/param -> node
  +     if (obj instanceof Node) {
  +         return(new SingletonIterator(((Node)obj).node));
  +     }
  +     // Convert var/param -> node-set
  +     else if (obj instanceof NodeIterator) {
  +         return(((NodeIterator)obj).cloneIterator());
  +     }
  +     else {
  +         final String className = obj.getClass().getName();
  +         runTimeError(DATA_CONVERSION_ERR, "reference", className);
  +         return null;
  +     }
  +    }
  +
  +    /**
  +     * Utility function used to convert references to DOMs. 
  +     */
  +    public static DOM referenceToResultTree(Object obj) {
        try {
  -         // Convert var/param -> node
  -         if (obj instanceof Node) {
  -             return(new SingletonIterator(((Node)obj).node));
  -         }
  -         // Convert var/param -> node-set
  -         else if (obj instanceof NodeIterator) {
  -             return(((NodeIterator)obj).cloneIterator());
  -         }
  -         // Convert var/param -> result-tree fragment
  -         else if (obj instanceof DOM) {
  -             DOM dom = (DOM)obj;
  -             return(dom.getIterator());
  -         }
  -         else {
  -             final String className = obj.getClass().getName();
  -             runTimeError(DATA_CONVERSION_ERR, "reference", className);
  -             return null;
  -         }
  +         return ((DOM) obj);
        }
  -     catch (ClassCastException e) {
  -         runTimeError(DATA_CONVERSION_ERR, "reference", "node-set");
  +     catch (IllegalArgumentException e) {
  +         final String className = obj.getClass().getName();
  +         runTimeError(DATA_CONVERSION_ERR, "reference", className);
            return null;
        }
       }
  
  
  

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

Reply via email to