You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sa...@apache.org on 2004/01/20 21:08:41 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util NodeSetType.java ResultTreeType.java
santiagopg 2004/01/20 12:08:41
Modified: java/src/org/apache/xalan/xsltc/compiler FunctionCall.java
java/src/org/apache/xalan/xsltc/compiler/util
NodeSetType.java ResultTreeType.java
Log:
XSLT->Java and Java->XSLT conversion table revisited. I made sure that two internal types corresponding to the same XSLT type had identical conversion rules (e.g. IntType and RealType). The multi-step conversions NodeSetType->int and ResultTreeType->double have been eliminated in order to simplify the table (they can always by implemented externally). The resulting conversion table is still not identical to the interpreter (and perhaps it will never be) so it should be documented separately.
Parameters
----------------------------------------------------------------
XSLT type Java Type
boolean boolean, java.lang.Boolean, java.lang.Object
number double, java.lang.Double, float, long,
java.lang.Integer, int, short, byte, char,
java.lang.Object
string java.lang.String, java.lang.Object
node-set org.w3c.NodeList, org.w3c.Node, java.lang.Object,
java.lang.String
result-tree org.w3c.NodeList, org.w3c.Node, java.lang.Object,
java.lang.String
Return type
---------------------------------------------------------------
boolean boolean
void (ignored)
char, byte,
short, int,
long, float,
double number
java.lang.String string
For parameters, the order on the right column of the table is significant --following the convention already in used in the docs.
Revision Changes Path
1.35 +5 -7 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FunctionCall.java
Index: FunctionCall.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FunctionCall.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- FunctionCall.java 23 Dec 2003 15:34:51 -0000 1.34
+++ FunctionCall.java 20 Jan 2004 20:08:40 -0000 1.35
@@ -241,25 +241,23 @@
_internal2Java.put(Type.String, new JavaType(String.class, 0));
_internal2Java.put(Type.String, new JavaType(Object.class, 1));
- // Type.NodeSet -> { NodeList(0), Node(1), Object(2), String(3), int(10) }
+ // Type.NodeSet -> { NodeList(0), Node(1), Object(2), String(3) }
_internal2Java.put(Type.NodeSet, new JavaType(nodeListClass, 0));
_internal2Java.put(Type.NodeSet, new JavaType(nodeClass, 1));
_internal2Java.put(Type.NodeSet, new JavaType(Object.class, 2));
_internal2Java.put(Type.NodeSet, new JavaType(String.class, 3));
- _internal2Java.put(Type.NodeSet, new JavaType(Integer.TYPE, 10));
// Type.Node -> { Node(0), NodeList(1), Object(2), String(3) }
- _internal2Java.put(Type.Node, new JavaType(nodeClass, 0));
- _internal2Java.put(Type.Node, new JavaType(nodeListClass, 1));
+ _internal2Java.put(Type.Node, new JavaType(nodeListClass, 0));
+ _internal2Java.put(Type.Node, new JavaType(nodeClass, 1));
_internal2Java.put(Type.Node, new JavaType(Object.class, 2));
_internal2Java.put(Type.Node, new JavaType(String.class, 3));
- // Type.ResultTree -> { NodeList(0), Node(1), Object(2), String(3), double(4) }
+ // Type.ResultTree -> { NodeList(0), Node(1), Object(2), String(3) }
_internal2Java.put(Type.ResultTree, new JavaType(nodeListClass, 0));
_internal2Java.put(Type.ResultTree, new JavaType(nodeClass, 1));
_internal2Java.put(Type.ResultTree, new JavaType(Object.class, 2));
_internal2Java.put(Type.ResultTree, new JavaType(String.class, 3));
- _internal2Java.put(Type.ResultTree, new JavaType(Double.TYPE, 4));
_internal2Java.put(Type.Reference, new JavaType(Object.class, 0));
1.16 +1 -18 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/NodeSetType.java
Index: NodeSetType.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/NodeSetType.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- NodeSetType.java 1 Apr 2003 21:12:39 -0000 1.15
+++ NodeSetType.java 20 Jan 2004 20:08:40 -0000 1.16
@@ -314,23 +314,6 @@
il.append(new INVOKEINTERFACE(index, 2));
}
- else if (className.equals("int")) {
- int next = cpg.addInterfaceMethodref(NODE_ITERATOR,
- "next", "()I");
- int index = cpg.addInterfaceMethodref(DOM_INTF,
- GET_NODE_VALUE,
- "(I)"+STRING_SIG);
- int str = cpg.addMethodref(BASIS_LIBRARY_CLASS,
- STRING_TO_INT,
- STRING_TO_INT_SIG);
-
- // Get next node from the iterator
- il.append(new INVOKEINTERFACE(next, 1));
- // Get the node's string value (from the DOM)
- il.append(new INVOKEINTERFACE(index, 2));
- // Create a new Integer object from the string value
- il.append(new INVOKESTATIC(str));
- }
else {
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
toString(), className);
1.20 +1 -4 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ResultTreeType.java
Index: ResultTreeType.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ResultTreeType.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ResultTreeType.java 24 Nov 2003 22:18:51 -0000 1.19
+++ ResultTreeType.java 20 Jan 2004 20:08:40 -0000 1.20
@@ -461,9 +461,6 @@
else if (className.equals("java.lang.String")) {
translateTo(classGen, methodGen, Type.String);
}
- else if (clazz == Double.TYPE) {
- translateTo(classGen, methodGen, Type.Real);
- }
else {
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
toString(), className);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org