From xalanejohnson@example.net Thu Aug 01 16:11:35 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 15784 invoked by uid 500); 1 Aug 2002 16:11:35 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 15768 invoked from network); 1 Aug 2002 16:11:34 -0000 Date: 1 Aug 2002 16:11:34 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/c/src/Include GCCDefinitions.hpp X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dbertoni 2002/08/01 09:11:34 Modified: c/src/Include GCCDefinitions.hpp Log: Fixed conditional compilation and added comment. Revision Changes Path 1.27 +3 -1 xml-xalan/c/src/Include/GCCDefinitions.hpp Index: GCCDefinitions.hpp =================================================================== RCS file: /home/cvs/xml-xalan/c/src/Include/GCCDefinitions.hpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- GCCDefinitions.hpp 1 Aug 2002 01:43:19 -0000 1.26 +++ GCCDefinitions.hpp 1 Aug 2002 16:11:34 -0000 1.27 @@ -72,12 +72,14 @@ -#if __GNUC__ < 3 && __GNUC_MINOR__ < 1 +#if __GNUC__ < 3 #define XALAN_OLD_STREAM_HEADERS #define XALAN_NO_MEMBER_TEMPLATES #define XALAN_NO_STD_ALLOCATORS #endif +// As of 3.1, st888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4numeric_limits<double> is broken, so +// we don't use it. #define XALAN_NO_STD_NUMERIC_LIMITS #define XALAN_RTTI_AVAILABLE #define XALAN_SGI_BASED_STL --------------------------------------------------------------------- To unsubscribe, e-mail: ejohnson@example.net For additional commands, e-mail: ejohnson@example.net From xalanejohnson@example.net Thu Aug 01 18:09:28 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 2362 invoked by uid 500); 1 Aug 2002 18:09:28 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 2350 invoked from network); 1 Aug 2002 18:09:28 -0000 Date: 1 Aug 2002 18:09:27 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/c/src/XSLT CountersTable.hpp X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dbertoni 2002/08/01 11:09:27 Modified: c/src/XSLT CountersTable.hpp Log: Fixed typo in include guard. Revision Changes Path 1.5 +2 -2 xml-xalan/c/src/XSLT/CountersTable.hpp Index: CountersTable.hpp =================================================================== RCS file: /home/cvs/xml-xalan/c/src/XSLT/CountersTable.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CountersTable.hpp 24 Jul 2002 23:19:43 -0000 1.4 +++ CountersTable.hpp 1 Aug 2002 18:09:27 -0000 1.5 @@ -55,7 +55,7 @@ * <http://www.apache.org/>. */ #if !defined(XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680) -#define XALAN_ELEMNUMBER_HEADER_GUARD_1357924680 +#define XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680 /** * $Id$ --------------------------------------------------------------------- To unsubscribe, e-mail: ejohnson@example.net For additional commands, e-mail: ejohnson@example.net From xalanejohnson@example.net Thu Aug 01 18:36:39 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 28098 invoked by uid 500); 1 Aug 2002 18:36:39 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 28083 invoked from network); 1 Aug 2002 18:36:39 -0000 Date: 1 Aug 2002 18:36:38 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/c/src runConfigure X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dbertoni 2002/08/01 11:36:38 Modified: c/src runConfigure Log: Added support for Intel compiler. Revision Changes Path 1.9 +4 -1 xml-xalan/c/src/runConfigure Index: runConfigure =================================================================== RCS file: /home/cvs/xml-xalan/c/src/runConfigure,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- runConfigure 6 May 2002 05:34:06 -0000 1.8 +++ runConfigure 1 Aug 2002 18:36:38 -0000 1.9 @@ -58,6 +58,9 @@ # # # $Log$ +# Revision 1.9 2002/08/01 18:36:38 dbertoni +# Added support for Intel compiler. +# # Revision 1.8 2002/05/06 05:34:06 dbertoni # Implemented multiple compiler options. # @@ -258,7 +261,7 @@ # case $cppcompiler in - xlC | xlc | xlC_r | xlc_r | g++ | c++ | cc | CC | aCC | cxx) + xlC | xlc | xlC_r | xlc_r | g++ | c++ | cc | CC | aCC | cxx | icpc) ;; *) --------------------------------------------------------------------- To unsubscribe, e-mail: ejohnson@example.net For additional commands, e-mail: ejohnson@example.net From xalanejohnson@example.net Thu Aug 01 18:44:31 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 31690 invoked by uid 500); 1 Aug 2002 18:44:31 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 31679 invoked from network); 1 Aug 2002 18:44:31 -0000 Date: 1 Aug 2002 18:44:30 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/c/src Makefile.in X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dbertoni 2002/08/01 11:44:30 Modified: c/src Tag: LotusXSL4C_1_3_1 Makefile.in Log: Added support for Intel compiler. Revision Changes Path No revision No revision 83.161.120.155 +18 -9 xml-xalan/c/src/Makefile.in Index: Makefile.in =================================================================== RCS file: /home/cvs/xml-xalan/c/src/Makefile.in,v retrieving revision 1.99 retrieving revision 83.161.120.155 diff -u -r1.99 -r83.161.120.155 --- Makefile.in 23 May 2002 00:13:24 -0000 1.99 +++ Makefile.in 1 Aug 2002 18:44:30 -0000 83.161.120.155 @@ -114,7 +114,7 @@ PROJECT_NAME = xalan-c LIBNAME = lib${PROJECT_NAME} THISLIB = ${LIB_DIR}/${LIBNAME} -VER = 1_4_0 +VER = 1_3_1 PRODUCTNAME = xalan PRODUCTVERSION = ${VER} @@ -142,21 +142,30 @@ ifeq ($(PLATFORM), LINUX) SUPPORTED = TRUE - PLATFORM_COMPILE_OPTIONS = -fpic -Wall -D${PLATFORM} -D_REENTRANT ALLLIBS = ${LIBS} -L/usr/lib SHLIBSUFFIX=.so + ifeq (${CXX}, icpc) + + PLATFORM_COMPILE_OPTIONS = -w1 -Xa -mp -prec_div -KPIC -D${PLATFORM} -D_REENTRANT + + else + + PLATFORM_COMPILE_OPTIONS = -fPIC -Wall -D${PLATFORM} -D_REENTRANT + + endif + # We need the ICU library if we are using the ICUBridge ifdef XALAN_USE_ICU - LD_RPATH_PRE= -Wl,-rpath, - PLATFORM_LIB_LINK_OPTIONS=$(LD_RPATH_PRE)${ICUROOT}/lib + LD_RPATH_PRE= -Wl,-rpath, + PLATFORM_LIB_LINK_OPTIONS=$(LD_RPATH_PRE)${ICUROOT}/lib endif - EXTRA_LINK_OPTIONS=-lc + EXTRA_LINK_OPTIONS= CC1 = $(CXX) $(CXXFLAGS) $(PLATFORM_COMPILE_OPTIONS) CC4 = $(CC) $(CXXFLAGS) $(PLATFORM_COMPILE_OPTIONS) - MAKE_SHARED = ${CXX} $(CXXFLAGS) -D${PLATFORM} -shared -fpic - LINK = g++ -D${PLATFORM} -fpic + MAKE_SHARED = ${CXX} $(CXXFLAGS) -D${PLATFORM} -shared -fPIC + LINK = $(CXX) -D${PLATFORM} -fpic endif @@ -323,9 +332,9 @@ # We need the Xerces library ifeq ($(PLATFORM), OS390) - ALLLIBS += $(XERCESCROOT)/lib/libxerces-c1_7_0.x + ALLLIBS += $(XERCESCROOT)/lib/libxerces-c1_6_0.x else - ALLLIBS += -L$(XERCESCROOT)/lib -lxerces-c1_7_0 + ALLLIBS += -L$(XERCESCROOT)/lib -lxerces-c1_6_0 endif # We need the ICU library if we are using the ICUBridge --------------------------------------------------------------------- To unsubscribe, e-mail: ejohnson@example.net For additional commands, e-mail: ejohnson@example.net From xalanejohnson@example.net Thu Aug 01 19:42:15 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 87362 invoked by uid 500); 1 Aug 2002 19:42:15 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 87351 invoked from network); 1 Aug 2002 19:42:14 -0000 Date: 1 Aug 2002 19:42:13 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/test build.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N zongaro 2002/08/01 12:42:12 Modified: test Tag: XSLTC_DTM build.xml Log: Added xalan.jar to xsltc.runtime.class.path until we deal with XSLTC_DTM packaging issues. Revision Changes Path No revision No revision 83.161.120.155 +3 -2 xml-xalan/test/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/xml-xalan/test/build.xml,v retrieving revision 1.53 retrieving revision 83.161.120.155 diff -u -r1.53 -r83.161.120.155 --- build.xml 23 Jul 2002 20:15:50 -0000 1.53 +++ build.xml 1 Aug 2002 19:42:12 -0000 83.161.120.155 @@ -1054,6 +1054,7 @@ <path id="xsltc.runtime.class.path"> <pathelement path="${java.class.path}" /> <pathelement location="${xalan.build.dir}/xsltc.jar" /> + <pathelement location="${xalan.build.dir}/xalan.jar" /> <pathelement location="${testxsl.jar}" /> <pathelement location="${parserjar}" /> <pathelement location="${xml-apis.jar}" /> --------------------------------------------------------------------- To unsubscribe, e-mail: ejohnson@example.net For additional commands, e-mail: ejohnson@example.net From xalanejohnson@example.net Thu Aug 01 19:55:34 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 824 invoked by uid 500); 1 Aug 2002 19:55:32 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 812 invoked from network); 1 Aug 2002 19:55:32 -0000 Date: 1 Aug 2002 19:55:31 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/java/src/org/apache/xml/utils SystemIDResolver.java TreeWalker.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N zongaro 2002/08/01 12:55:31 Modified: java/src/org/apache/xalan/extensions Tag: XSLTC_DTM ExtensionHandlerJavaClass.java java/src/org/apache/xalan/lib Tag: XSLTC_DTM ExsltCommon.java ExsltMath.java ExsltSets.java Extensions.java java/src/org/apache/xalan/processor Tag: XSLTC_DTM ProcessorInclude.java java/src/org/apache/xalan/xsltc/compiler Tag: XSLTC_DTM CastExpr.java Expression.java FlowList.java FunctionCall.java Mode.java StepPattern.java TestSeq.java java/src/org/apache/xalan/xsltc/compiler/util Tag: XSLTC_DTM MultiHashtable.java ReferenceType.java ResultTreeType.java java/src/org/apache/xml/utils Tag: XSLTC_DTM SystemIDResolver.java TreeWalker.java Log: Bringing branch back up-to-date with respect to changes in MAIN branch. Revision Changes Path No revision No revision 83.161.120.155 +9 -0 xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaClass.java Index: ExtensionHandlerJavaClass.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaClass.java,v retrieving revision 1.10 retrieving revision 83.161.120.155 diff -u -r1.10 -r83.161.120.155 --- ExtensionHandlerJavaClass.java 12 Jun 2001 19:14:33 -0000 1.10 +++ ExtensionHandlerJavaClass.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -412,6 +412,15 @@ { result = m.invoke(m_defaultInstance, new Object[] {xpc, element}); } + catch (InvocationTargetException e) + { + Throwable targetException = e.getTargetException(); + + if (targetException != null) + throw new TransformerException (targetException.getMessage (), targetException); + else + throw new TransformerException (e.getMessage (), e); + } catch (Exception e) { // e.printStackTrace (); No revision No revision 83.161.120.155 +1 -1 xml-xalan/java/src/org/apache/xalan/lib/ExsltCommon.java Index: ExsltCommon.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/ExsltCommon.java,v retrieving revision 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- ExsltCommon.java 29 Jul 2002 00:01:17 -0000 83.161.120.155 +++ ExsltCommon.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -94,7 +94,7 @@ * This class contains EXSLT common extension functions. * It is accessed by specifying a namespace URI as follows: * <pre> - * xmlns:exslt="http://exslt.org/xalan/common" + * xmlns:exslt="http://exslt.org/common" * </pre> * * The documentation for each function has been copied from the relevant 83.161.120.155 +2 -2 xml-xalan/java/src/org/apache/xalan/lib/ExsltMath.java Index: ExsltMath.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/ExsltMath.java,v retrieving revision 1.2 retrieving revision 83.161.120.155 diff -u -r1.2 -r83.161.120.155 --- ExsltMath.java 22 Mar 2002 18:54:57 -0000 1.2 +++ ExsltMath.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -195,7 +195,7 @@ * @param expCon is passed in by the Xalan extension processor * @param ni The NodeIterator for the node-set to be evaluated. * - * @return node-set with nodes containing the minimum value found, an empty node-set + * @return node-set with nodes containing the maximum value found, an empty node-set * if any node cannot be converted to a number. */ public static NodeSet highest (ExpressionContext expCon, NodeIterator ni) @@ -234,7 +234,7 @@ * @param expCon is passed in by the Xalan extension processor * @param ni The NodeIterator for the node-set to be evaluated. * - * @return node-set with nodes containing the maximum value found, an empty node-set + * @return node-set with nodes containing the minimum value found, an empty node-set * if any node cannot be converted to a number. * */ 83.161.120.155 +3 -3 xml-xalan/java/src/org/apache/xalan/lib/ExsltSets.java Index: ExsltSets.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/ExsltSets.java,v retrieving revision 1.2 retrieving revision 83.161.120.155 diff -u -r1.2 -r83.161.120.155 --- ExsltSets.java 22 Mar 2002 18:54:57 -0000 1.2 +++ ExsltSets.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -93,7 +93,7 @@ * This class contains EXSLT set extension functions. * It is accessed by specifying a namespace URI as follows: * <pre> - * xmlns:set="http://exslt.org/xalan/sets" + * xmlns:set="http://exslt.org/sets" * </pre> * * The documentation for each function has been copied from the relevant @@ -145,8 +145,8 @@ * * @param ni1 NodeIterator for first node-set. * @param ni2 NodeIterator for second node-set. - * @return a node-set containing the nodes in ni1 that precede in document order the first - * node in ni2; an empty node-set if the first noe in ni2 is not in ni1; all of ni1 if ni2 + * @return a node-set containing the nodes in ni1 that follow in document order the first + * node in ni2; an empty node-set if the first node in ni2 is not in ni1; all of ni1 if ni2 * is empty. * * @see <a href="http://www.exslt.org/">EXSLT</a> 83.161.120.155 +1 -1 xml-xalan/java/src/org/apache/xalan/lib/Extensions.java Index: Extensions.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/Extensions.java,v retrieving revision 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- Extensions.java 29 Jul 2002 00:01:17 -0000 83.161.120.155 +++ Extensions.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -280,7 +280,7 @@ } /** - * Returns true of both node-sets contain the same set of nodes. + * Returns true if both node-sets contain the same set of nodes. * @param n1 NodeIterator for first node-set * * NEEDSDOC @param ni1 No revision No revision 83.161.120.155 +10 -1 xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java Index: ProcessorInclude.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java,v retrieving revision 1.20 retrieving revision 83.161.120.155 diff -u -r1.20 -r83.161.120.155 --- ProcessorInclude.java 8 Nov 2001 20:15:48 -0000 1.20 +++ ProcessorInclude.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -238,7 +238,16 @@ if (null != source && source instanceof DOMSource) { Node node = ((DOMSource)source).getNode(); - TreeWalker walker = new TreeWalker(handler, new org.apache.xpath.DOM2Helper(), source.getSystemId()); + + String systemId = source.getSystemId(); + if (systemId == null) + { + systemId = SystemIDResolver.getAbsoluteURI(getHref(), + handler.getBaseIdentifier()); + + } + + TreeWalker walker = new TreeWalker(handler, new org.apache.xpath.DOM2Helper(), systemId); try { No revision No revision 83.161.120.155 +2 -2 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 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- CastExpr.java 29 Jul 2002 00:01:22 -0000 83.161.120.155 +++ CastExpr.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -202,7 +202,7 @@ else if (tleft instanceof ResultTreeType) { tleft = Type.ResultTree; // multiple instances } - if (InternalTypeMap.maps(tleft, _type)) { + if (InternalTypeMap.maps(tleft, _type) != null) { return _type; } throw new TypeCheckError(this); 83.161.120.155 +9 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Expression.java Index: Expression.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Expression.java,v retrieving revision 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- Expression.java 29 Jul 2002 00:01:22 -0000 83.161.120.155 +++ Expression.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -214,6 +214,14 @@ _falseList.add(il.append(new IFEQ(null))); } + public FlowList getFalseList() { + return _falseList; + } + + public FlowList getTrueList() { + return _trueList; + } + public void backPatchFalseList(InstructionHandle ih) { _falseList.backPatch(ih); } 83.161.120.155 +31 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FlowList.java Index: FlowList.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/FlowList.java,v retrieving revision 1.2 retrieving revision 83.161.120.155 diff -u -r1.2 -r83.161.120.155 --- FlowList.java 1 Feb 2002 20:07:08 -0000 1.2 +++ FlowList.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -64,6 +64,7 @@ package org.apache.xalan.xsltc.compiler; import java.util.Vector; +import java.util.Iterator; import org.apache.bcel.generic.*; public final class FlowList { @@ -118,5 +119,34 @@ } _elements.clear(); // avoid backpatching more than once } + } + + /** + * Redirect the handles from oldList to newList. "This" flow list + * is assumed to be relative to oldList. + */ + public FlowList copyAndRedirect(InstructionList oldList, + InstructionList newList) + { + final FlowList result = new FlowList(); + if (_elements == null) { + return result; + } + + final int n = _elements.size(); + final Iterator oldIter = oldList.iterator(); + final Iterator newIter = newList.iterator(); + + while (oldIter.hasNext()) { + final InstructionHandle oldIh = (InstructionHandle) oldIter.next(); + final InstructionHandle newIh = (InstructionHandle) newIter.next(); + + for (int i = 0; i < n; i++) { + if (_elements.elementAt(i) == oldIh) { + result.add(newIh); + } + } + } + return result; } } 83.161.120.155 +95 -43 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 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- FunctionCall.java 29 Jul 2002 00:01:22 -0000 83.161.120.155 +++ FunctionCall.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -133,12 +133,31 @@ private static final Hashtable _java2Internal = new Hashtable(); /** + * inner class to used in internal2Java mappings, contains + * the Java type and the distance between the internal type and + * the Java type. + */ + static class JavaType { + public Class type; + public int distance; + + public JavaType(Class type, int distance){ + this.type = type; + this.distance = distance; + } + public boolean equals(Object query){ + return query.equals(type); + } + } + + /** * Defines 2 conversion tables: * 1. From internal types to Java types and * 2. From Java types to internal types. * These two tables are used when calling external (Java) functions. */ static { + try { final Class objectClass = Class.forName("java.lang.Object"); final Class stringClass = Class.forName("java.lang.String"); @@ -146,42 +165,43 @@ final Class nodeListClass = Class.forName("org.w3c.dom.NodeList"); // Possible conversions between internal and Java types - _internal2Java.put(Type.Boolean, Boolean.TYPE); - - _internal2Java.put(Type.Int, Character.TYPE); - _internal2Java.put(Type.Int, Byte.TYPE); - _internal2Java.put(Type.Int, Short.TYPE); - _internal2Java.put(Type.Int, Integer.TYPE); - _internal2Java.put(Type.Int, Long.TYPE); - _internal2Java.put(Type.Int, Float.TYPE); - _internal2Java.put(Type.Int, Double.TYPE); - - _internal2Java.put(Type.Real, Character.TYPE); - _internal2Java.put(Type.Real, Byte.TYPE); - _internal2Java.put(Type.Real, Short.TYPE); - _internal2Java.put(Type.Real, Integer.TYPE); - _internal2Java.put(Type.Real, Long.TYPE); - _internal2Java.put(Type.Real, Float.TYPE); - _internal2Java.put(Type.Real, Double.TYPE); - - _internal2Java.put(Type.String, stringClass); - - _internal2Java.put(Type.Node, nodeClass); - _internal2Java.put(Type.Node, nodeListClass); - - _internal2Java.put(Type.NodeSet, Integer.TYPE); - _internal2Java.put(Type.NodeSet, nodeClass); - _internal2Java.put(Type.NodeSet, nodeListClass); + _internal2Java.put(Type.Boolean, new JavaType(Boolean.TYPE,0)); - _internal2Java.put(Type.ResultTree, nodeClass); - _internal2Java.put(Type.ResultTree, nodeListClass); + _internal2Java.put(Type.Int, new JavaType(Character.TYPE, 6)); + _internal2Java.put(Type.Int, new JavaType(Byte.TYPE, 5)); + _internal2Java.put(Type.Int, new JavaType(Short.TYPE, 4)); + _internal2Java.put(Type.Int, new JavaType(Integer.TYPE, 0)); + _internal2Java.put(Type.Int, new JavaType(Long.TYPE, 1)); + _internal2Java.put(Type.Int, new JavaType(Float.TYPE, 2)); + _internal2Java.put(Type.Int, new JavaType(Double.TYPE, 3)); + + _internal2Java.put(Type.Real, new JavaType(Character.TYPE, 6)); + _internal2Java.put(Type.Real, new JavaType(Byte.TYPE, 5)); + _internal2Java.put(Type.Real, new JavaType(Short.TYPE, 4)); + _internal2Java.put(Type.Real, new JavaType(Integer.TYPE, 3)); + _internal2Java.put(Type.Real, new JavaType(Long.TYPE, 2)); + _internal2Java.put(Type.Real, new JavaType(Float.TYPE, 1)); + _internal2Java.put(Type.Real, new JavaType(Double.TYPE, 0)); + + _internal2Java.put(Type.String, new JavaType(stringClass, 0)); + + _internal2Java.put(Type.Node, new JavaType(nodeClass, 0)); + _internal2Java.put(Type.Node, new JavaType(nodeListClass, 1)); + + _internal2Java.put(Type.NodeSet, new JavaType(Integer.TYPE, 10)); + _internal2Java.put(Type.NodeSet, new JavaType(nodeClass, 1)); + _internal2Java.put(Type.NodeSet, new JavaType(nodeListClass,0)); + + _internal2Java.put(Type.ResultTree, new JavaType(nodeClass, 1)); + _internal2Java.put(Type.ResultTree, new JavaType(nodeListClass,0)); + _internal2Java.put(Type.ResultTree, new JavaType(objectClass,2)); - _internal2Java.put(Type.Reference, objectClass); + _internal2Java.put(Type.Reference, new JavaType(objectClass,0)); // Possible conversions between Java and internal types - _java2Internal.put(Boolean.TYPE, Type.Boolean); + _java2Internal.put(Boolean.TYPE, Type.Boolean); - _java2Internal.put(Character.TYPE, Type.Real); + _java2Internal.put(Character.TYPE, Type.Real); _java2Internal.put(Byte.TYPE, Type.Real); _java2Internal.put(Short.TYPE, Type.Real); _java2Internal.put(Integer.TYPE, Type.Real); @@ -338,6 +358,8 @@ final Vector argsType = typeCheckArgs(stable); // Try all constructors + int bestConstrDistance = Integer.MAX_VALUE; + _type = null; // reset for (int j, i = 0; i < nConstructors; i++) { // Check if all parameters to this constructor can be converted final Constructor constructor = @@ -345,20 +367,34 @@ final Class[] paramTypes = constructor.getParameterTypes(); Class extType = null; + int currConstrDistance = 0; for (j = 0; j < nArgs; j++) { // Convert from internal (translet) type to external (Java) type extType = paramTypes[j]; final Type intType = (Type)argsType.elementAt(j); - if (!_internal2Java.maps(intType, extType)) break; + Object match = _internal2Java.maps(intType, extType); + if (match != null) { + currConstrDistance += ((JavaType)match).distance; + } + else { + // no mapping available + currConstrDistance = Integer.MAX_VALUE; + break; + } } - if (j == nArgs) { + if (j == nArgs && currConstrDistance < bestConstrDistance ) { _chosenConstructor = constructor; _isExtConstructor = true; - return _type = new ObjectType(_className); + bestConstrDistance = currConstrDistance; + _type = new ObjectType(_className); } } + if (_type != null) { + return _type; + } + final StringBuffer buf = new StringBuffer(_className); buf.append('.').append(_fname.getLocalPart()).append('('); for (int i = 0; i < nArgs; i++) { @@ -430,18 +466,30 @@ final int nMethods = methods.size(); final Vector argsType = typeCheckArgs(stable); - // Try all methods with the same name as this function + // Try all methods to identify the best fit + int bestMethodDistance = Integer.MAX_VALUE; + _type = null; // reset internal type for (int j, i = 0; i < nMethods; i++) { // Check if all paramteters to this method can be converted final Method method = (Method)methods.elementAt(i); final Class[] paramTypes = method.getParameterTypes(); - + + int currMethodDistance = 0; for (j = 0; j < nArgs; j++) { // Convert from internal (translet) type to external (Java) type extType = paramTypes[j]; final Type intType = (Type)argsType.elementAt(j); - if (!_internal2Java.maps(intType, extType)) break; + Object match = _internal2Java.maps(intType, extType); + if (match != null) { + currMethodDistance += + ((JavaType)match).distance; + } + else { + // no mapping available + currMethodDistance = Integer.MAX_VALUE; + break; + } } if (j == nArgs) { @@ -451,14 +499,18 @@ : (Type) _java2Internal.get(extType); // Use this method if all parameters & return type match - if (_type != null) { + if (_type != null && currMethodDistance < bestMethodDistance) { _chosenMethod = method; - if (_type == Type.NodeSet){ - getXSLTC().setMultiDocument(true); - } - return _type; + bestMethodDistance = currMethodDistance; } } + } + + if (_type != null) { + if (_type == Type.NodeSet){ + getXSLTC().setMultiDocument(true); + } + return _type; } final StringBuffer buf = new StringBuffer(_className); 83.161.120.155 +162 -61 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Mode.java Index: Mode.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Mode.java,v retrieving revision 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- Mode.java 29 Jul 2002 00:01:22 -0000 83.161.120.155 +++ Mode.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -79,8 +79,9 @@ import org.apache.xml.dtm.DTM; /** - * Mode gathers all the templates belonging to a given mode; it is responsible - * for generating an appropriate applyTemplates + (mode name) function + * Mode gathers all the templates belonging to a given mode; + * it is responsible for generating an appropriate + * applyTemplates + (mode name) method in the translet. */ final class Mode implements Constants { @@ -122,32 +123,67 @@ /** * Test sequence for patterns with id() or key()-type kernel. */ - private TestSeq _idxTestSeq = null; + private TestSeq _idxTestSeq = null; /** * Group for patterns with any other kernel type. */ - private Vector[] _patternGroups; + private Vector[] _patternGroups; /** * Test sequence for patterns with any other kernel type. */ private TestSeq[] _testSeq; + /** + * A mapping between patterns and instruction lists used by + * test sequences to avoid compiling the same pattern multiple + * times. Note that patterns whose kernels are "*", "node()" + * and "@*" can between shared by test sequences. + */ + private Hashtable _preCompiled = new Hashtable(); + + /** + * A mapping between templates and test sequences. + */ private Hashtable _neededTemplates = new Hashtable(); + + /** + * A mapping between named templates and Mode objects. + */ private Hashtable _namedTemplates = new Hashtable(); + + /** + * A mapping between templates and instruction handles. + */ private Hashtable _templateIHs = new Hashtable(); + + /** + * A mapping between templates and instruction lists. + */ private Hashtable _templateILs = new Hashtable(); + + /** + * A reference to the pattern matching the root node. + */ private LocationPathPattern _rootPattern = null; + /** + * Stores ranges of template precendences for the compilation + * of apply-imports (a Hashtable for historical reasons). + */ private Hashtable _importLevels = null; + /** + * A mapping between key names and keys. + */ private Hashtable _keys = null; - // Variable index for the current node - used in code generation + /** + * Variable index for the current node used in code generation. + */ private int _currentIndex; - /** * Creates a new Mode. * @@ -157,19 +193,18 @@ * (normally a sequence number - still in a String). */ public Mode(QName name, Stylesheet stylesheet, String suffix) { - // Save global info _name = name; _stylesheet = stylesheet; _methodName = APPLY_TEMPLATES + suffix; - // Initialise some data structures _templates = new Vector(); _patternGroups = new Vector[32]; } /** - * Returns the name of the method (_not_ function) that will be compiled - * for this mode. Normally takes the form 'applyTemplates()' or - * 'applyTemplates2()'. + * Returns the name of the method (_not_ function) that will be + * compiled for this mode. Normally takes the form 'applyTemplates()' + * or * 'applyTemplates2()'. + * * @return Method name for this mode */ public String functionName() { @@ -177,9 +212,28 @@ } public String functionName(int min, int max) { - if (_importLevels == null) _importLevels = new Hashtable(); + if (_importLevels == null) { + _importLevels = new Hashtable(); + } _importLevels.put(new Integer(max), new Integer(min)); - return _methodName+'_'+max; + return _methodName + '_' + max; + } + + /** + * Add a pre-compiled pattern to this mode. + */ + public void addInstructionList(Pattern pattern, + InstructionList ilist) + { + _preCompiled.put(pattern, ilist); + } + + /** + * Get the instruction list for a pre-compiled pattern. Used by + * test sequences to avoid compiling patterns more than once. + */ + public InstructionList getInstructionList(Pattern pattern) { + return (InstructionList) _preCompiled.get(pattern); } /** @@ -189,10 +243,10 @@ return _stylesheet.getClassName(); } - /** - * Add a template to this mode - * @param template The template to add - */ + public Stylesheet getStylesheet() { + return _stylesheet; + } + public void addTemplate(Template template) { _templates.addElement(template); } @@ -306,10 +360,32 @@ } /** + * Group patterns by NodeTests of their last Step + * Keep them sorted by priority within group + */ + private void addPatternToGroup(final LocationPathPattern lpp) { + // id() and key()-type patterns do not have a kernel type + if (lpp instanceof IdKeyPattern) { + addPattern(-1, lpp); + } + // Otherwise get the kernel pattern from the LPP + else { + // kernel pattern is the last (maybe only) Step + final StepPattern kernel = lpp.getKernelPattern(); + if (kernel != null) { + addPattern(kernel.getNodeType(), lpp); + } + else if (_rootPattern == null || + lpp.noSmallerThan(_rootPattern)) { + _rootPattern = lpp; + } + } + } + + /** * Adds a pattern to a pattern group */ private void addPattern(int kernelType, LocationPathPattern pattern) { - // Make sure the array of pattern groups is long enough final int oldLength = _patternGroups.length; if (kernelType >= oldLength) { @@ -328,10 +404,13 @@ if (patterns == null) { patterns = new Vector(2); patterns.addElement(pattern); - if (kernelType == -1) + + if (kernelType == -1) { _nodeGroup = patterns; - else + } + else { _patternGroups[kernelType] = patterns; + } } // Otherwise make sure patterns are ordered by precedence/priorities else { @@ -352,40 +431,58 @@ } /** - * Group patterns by NodeTests of their last Step - * Keep them sorted by priority within group + * Build test sequences. The first step is to complete the test sequences + * by including patterns of "*" and "node()" kernel to all element test + * sequences, and of "@*" to all attribute test sequences. */ - private void addPatternToGroup(final LocationPathPattern lpp) { - // id() and key()-type patterns do not have a kernel type - if (lpp instanceof IdKeyPattern) { - addPattern(-1, lpp); - } - // Otherwise get the kernel pattern from the LPP - else { - // kernel pattern is the last (maybe only) Step - final StepPattern kernel = lpp.getKernelPattern(); - if (kernel != null) { - addPattern(kernel.getNodeType(), lpp); - } - else if (_rootPattern == null || - lpp.noSmallerThan(_rootPattern)) { - _rootPattern = lpp; + private void prepareTestSequences() { + final Vector names = _stylesheet.getXSLTC().getNamesIndex(); + + final Vector starGroup = _patternGroups[DTM.ELEMENT_NODE]; + final Vector atStarGroup = _patternGroups[DTM.ATTRIBUTE_NODE]; + + // Complete test sequences with "*", "@*" and "node()" + if (starGroup != null || atStarGroup != null || _nodeGroup != null) { + final int n = _patternGroups.length; + + for (int m, i = DTM.NTYPES; i < n; i++) { + if (_patternGroups[i] == null) continue; + + final String name = (String) names.elementAt(i - DTM.NTYPES); + + if (isAttributeName(name)) { + // If an attribute then copy "@*" to its test sequence + m = (atStarGroup != null) ? atStarGroup.size() : 0; + for (int j = 0; j < m; j++) { + addPattern(i, + (LocationPathPattern) atStarGroup.elementAt(j)); + } + } + else { + // If an element then copy "*" to its test sequence + m = (starGroup != null) ? starGroup.size() : 0; + for (int j = 0; j < m; j++) { + addPattern(i, + (LocationPathPattern) starGroup.elementAt(j)); + } + + // And also copy "node()" to its test sequence + m = (_nodeGroup != null) ? _nodeGroup.size() : 0; + for (int j = 0; j < m; j++) { + addPattern(i, + (LocationPathPattern) _nodeGroup.elementAt(j)); + } + } } } - } - /** - * Build test sequences - */ - private void prepareTestSequences() { - final Vector names = _stylesheet.getXSLTC().getNamesIndex(); _testSeq = new TestSeq[DTM.NTYPES + names.size()]; final int n = _patternGroups.length; for (int i = 0; i < n; i++) { final Vector patterns = _patternGroups[i]; if (patterns != null) { - final TestSeq testSeq = new TestSeq(patterns, this); + final TestSeq testSeq = new TestSeq(patterns, i, this); testSeq.reduce(); _testSeq[i] = testSeq; testSeq.findTemplates(_neededTemplates); @@ -393,7 +490,7 @@ } if ((_nodeGroup != null) && (_nodeGroup.size() > 0)) { - _nodeTestSeq = new TestSeq(_nodeGroup, this); + _nodeTestSeq = new TestSeq(_nodeGroup, -1, this); _nodeTestSeq.reduce(); _nodeTestSeq.findTemplates(_neededTemplates); } @@ -621,20 +718,7 @@ } } - /** - * Auxiliary method to determine if a qname describes an attribute/element - */ - private static boolean isAttributeName(String qname) { - final int col = qname.lastIndexOf(':') + 1; - return (qname.charAt(col) == '@'); - } - - private static boolean isNamespaceName(String qname) { - final int col = qname.lastIndexOf(':'); - return (col > -1 && qname.charAt(qname.length()-1) == '*'); - } - - /** + /** * Compiles the applyTemplates() method and adds it to the translet. * This is the main dispatch method. */ @@ -744,7 +828,6 @@ // If there is a match on node() we need to replace ihElem // and ihText if the priority of node() is higher if (_nodeTestSeq != null) { - // Compare priorities of node() and "*" double nodePrio = _nodeTestSeq.getPriority(); int nodePos = _nodeTestSeq.getPosition(); @@ -817,6 +900,7 @@ } } + // Handle pattern with match on root node - default: traverse children targets[DTM.ROOT_NODE] = _rootPattern != null ? getTemplateInstructionHandle(_rootPattern.getTemplate()) @@ -1370,5 +1454,22 @@ public InstructionHandle getTemplateInstructionHandle(Template template) { return (InstructionHandle)_templateIHs.get(template); + } + + /** + * Auxiliary method to determine if a qname is an attribute. + */ + private static boolean isAttributeName(String qname) { + final int col = qname.lastIndexOf(':') + 1; + return (qname.charAt(col) == '@'); + } + + /** + * Auxiliary method to determine if a qname is a namespace + * qualified "*". + */ + private static boolean isNamespaceName(String qname) { + final int col = qname.lastIndexOf(':'); + return (col > -1 && qname.charAt(qname.length()-1) == '*'); } } 83.161.120.155 +4 -2 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/StepPattern.java Index: StepPattern.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/StepPattern.java,v retrieving revision 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- StepPattern.java 29 Jul 2002 00:01:23 -0000 83.161.120.155 +++ StepPattern.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -152,7 +152,9 @@ final StringBuffer buffer = new StringBuffer("stepPattern(\""); buffer.append(Axis.names[_axis]) .append("\", ") - .append(_isEpsilon ? "epsilon" : Integer.toString(_nodeType)); + .append(_isEpsilon ? + ("epsilon{" + Integer.toString(_nodeType) + "}") : + Integer.toString(_nodeType)); if (_predicates != null) buffer.append(", ").append(_predicates.toString()); return buffer.append(')').toString(); 83.161.120.155 +154 -101 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/TestSeq.java Index: TestSeq.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/TestSeq.java,v retrieving revision 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- TestSeq.java 29 Jul 2002 00:01:23 -0000 83.161.120.155 +++ TestSeq.java 1 Aug 2002 19:55:30 -0000 83.161.120.155 @@ -69,6 +69,7 @@ import java.util.Hashtable; import java.util.Dictionary; import java.util.Enumeration; +import java.util.Iterator; import org.apache.bcel.generic.*; import org.apache.xalan.xsltc.compiler.util.*; @@ -77,110 +78,149 @@ * A test sequence is a sequence of patterns that * * (1) occured in templates in the same mode - * (2) share the same kernel node type (such as A/B and C/C/B). + * (2) share the same kernel node type (e.g. A/B and C/C/B) + * (3) may also contain patterns matching "*" and "node()" + * (element sequence only) or matching "@*" (attribute + * sequence only). * - * A test sequence may have a default template, which will be run if - * none of the patterns do not match. This template is always a template - * that matches solely on the shared kernel node type. + * A test sequence may have a default template, which will be + * instantiated if none of the other patterns match. */ final class TestSeq { - private Vector _patterns = null; // all patterns - private Mode _mode = null; // the shared mode - private Template _default = null; // the default template + /** + * Integer code for the kernel type of this test sequence + */ + private int _kernelType; + + /** + * Vector of all patterns in the test sequence. May include + * patterns with "*", "@*" or "node()" kernel. + */ + private Vector _patterns = null; + + /** + * A reference to the Mode object. + */ + private Mode _mode = null; + + /** + * Default template for this test sequence + */ + private Template _default = null; + /** + * Instruction list representing this test sequence. + */ private InstructionList _instructionList; /** - * Creates a new test sequence, given a set of patterns and a mode. + * Cached handle to avoid compiling more than once. + */ + private InstructionHandle _start = null; + + /** + * Creates a new test sequence given a set of patterns and a mode. */ public TestSeq(Vector patterns, Mode mode) { + this(patterns, -2, mode); + } + + public TestSeq(Vector patterns, int kernelType, Mode mode) { _patterns = patterns; + _kernelType = kernelType; _mode = mode; } /** - * The priority is only calculated if the test sequence has a default - * template. This is bad, bad, bad. We should get the priority from the - * other templates that make up the test sequence. + * Returns a string representation of this test sequence. Notice + * that test sequences are mutable, so the value returned by this + * method is different before and after calling reduce(). */ - public double getPriority() { - double prio = (0 - Double.MAX_VALUE); + public String toString() { final int count = _patterns.size(); + final StringBuffer result = new StringBuffer(); for (int i = 0; i < count; i++) { - final Pattern pattern = (Pattern)_patterns.elementAt(i); - final Template template = pattern.getTemplate(); - final double tp = template.getPriority(); - if (tp > prio) prio = tp; - } - if (_default != null) { - final double tp = _default.getPriority(); - if (tp > prio) prio = tp; + final LocationPathPattern pattern = + (LocationPathPattern) _patterns.elementAt(i); + + if (i == 0) { + result.append("Testseq for kernel " + _kernelType) + .append('\n'); + } + result.append(" pattern " + i + ": ") + .append(pattern.toString()) + .append('\n'); } - return prio; + return result.toString(); } /** - * This method should return the last position of any template included - * in this test sequence. + * Returns the instruction list for this test sequence */ - public int getPosition() { - int pos = Integer.MIN_VALUE; - final int count = _patterns.size(); + public InstructionList getInstructionList() { + return _instructionList; + } - for (int i = 0; i < count; i++) { - final Pattern pattern = (Pattern)_patterns.elementAt(i); - final Template template = pattern.getTemplate(); - final int tp = template.getPosition(); - if (tp > pos) pos = tp; - } - if (_default != null) { - final int tp = _default.getPosition(); - if (tp > pos) pos = tp; - } - return pos; + /** + * Return the highest priority for a pattern in this test + * sequence. This is either the priority of the first or + * of the default pattern. + */ + public double getPriority() { + final Template template = (_patterns.size() == 0) ? _default + : ((Pattern) _patterns.elementAt(0)).getTemplate(); + return template.getPriority(); } - + + /** + * Returns the position of the highest priority pattern in + * this test sequence. + */ + public int getPosition() { + final Template template = (_patterns.size() == 0) ? _default + : ((Pattern) _patterns.elementAt(0)).getTemplate(); + return template.getPosition(); + } + /** - * Reduce the patterns in this test sequence to exclude the shared - * kernel node type. After the switch() in the translet's applyTemplates() - * we already know that we have a hit for the kernel node type, we only - * have the check the rest of the pattern. + * Reduce the patterns in this test sequence. Creates a new + * vector of patterns and sets the default pattern if it + * finds a patterns that is fully reduced. */ public void reduce() { final Vector newPatterns = new Vector(); - final int count = _patterns.size(); - // Traverse the existing set of patterns (they are in prioritised order) + final int count = _patterns.size(); for (int i = 0; i < count; i++) { final LocationPathPattern pattern = (LocationPathPattern)_patterns.elementAt(i); - // Reduce this pattern (get rid of kernel node type) + + // Reduce this pattern pattern.reduceKernelPattern(); - // Add this pattern to the new vector of patterns. - if (!pattern.isWildcard()) { - newPatterns.addElement(pattern); + // Is this pattern fully reduced? + if (pattern.isWildcard()) { + _default = pattern.getTemplate(); + break; // Ignore following patterns } - // Set template as default if its pattern matches purely on kernel else { - _default = pattern.getTemplate(); - // Following patterns can be ignored since default has priority - break; + newPatterns.addElement(pattern); } } _patterns = newPatterns; } /** - * Returns, by reference, the templates that are included in this test - * sequence. Remember that a single template can occur in several test - * sequences if its pattern is a union (ex. match="A/B | A/C"). + * Returns, by reference, the templates that are included in + * this test sequence. Note that a single template can occur + * in several test sequences if its pattern is a union. */ public void findTemplates(Dictionary templates) { - if (_default != null) + if (_default != null) { templates.put(_default, this); + } for (int i = 0; i < _patterns.size(); i++) { final LocationPathPattern pattern = (LocationPathPattern)_patterns.elementAt(i); @@ -189,9 +229,10 @@ } /** - * Get the instruction handle to a template's code. This is used when - * a single template occurs in several test sequences; that is, if its - * pattern is a union of patterns (ex. match="A/B | A/C"). + * Get the instruction handle to a template's code. This is + * used when a single template occurs in several test + * sequences; that is, if its pattern is a union of patterns + * (e.g. match="A/B | A/C"). */ private InstructionHandle getTemplateHandle(Template template) { return (InstructionHandle)_mode.getTemplateInstructionHandle(template); @@ -204,71 +245,83 @@ return (LocationPathPattern)_patterns.elementAt(n); } - - private InstructionHandle _start = null; - /** - * Copile the code for this test sequence. The code will first test for - * the pattern with the highest priority, then go on to the next ones, - * until it hits or finds the default template. + * Compile the code for this test sequence. Compile patterns + * from highest to lowest priority. Note that since patterns + * can be share by multiple test sequences, instruction lists + * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, - InstructionHandle continuation) { + InstructionHandle continuation) + { + // Returned cached value if already compiled + if (_start != null) { + return _start; + } + // If not patterns, then return handle for default template final int count = _patterns.size(); - - if (_start != null) return(_start); - - // EZ DC if there is only one (default) pattern - if (count == 0) getTemplateHandle(_default); + if (count == 0) { + return (_start = getTemplateHandle(_default)); + } - // The 'fail' instruction handle represents a branch to go to when - // test fails. It is updated in each iteration, so that the tests - // are linked together in the if-elseif-elseif-else fashion. - InstructionHandle fail; + // Init handle to jump when all patterns failed + InstructionHandle fail = (_default == null) ? continuation + : getTemplateHandle(_default); - // Initialize 'fail' to either the code for the default template - if (_default != null) - fail = getTemplateHandle(_default); - // ..or if that does not exist, to a location set by the caller. - else - fail = continuation; - - for (int n = (count - 1); n >= 0; n--) { + // Compile all patterns in reverse order + for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); + // Apply the test-code compiled for the pattern - il.append(pattern.compile(classGen, methodGen)); + InstructionList ilist = _mode.getInstructionList(pattern); + if (ilist == null) { + ilist = pattern.compile(classGen, methodGen); + _mode.addInstructionList(pattern, ilist); + } + + // Make a copy of the instruction list for backpatching + InstructionList copyOfilist = ilist.copy(); + + FlowList trueList = pattern.getTrueList(); + if (trueList != null) { + trueList = trueList.copyAndRedirect(ilist, copyOfilist); + } + FlowList falseList = pattern.getFalseList(); + if (falseList != null) { + falseList = falseList.copyAndRedirect(ilist, copyOfilist); + } + + il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); - pattern.backPatchTrueList(success); - pattern.backPatchFalseList(fail); - // We're working backwards here. The next pattern's 'fail' target - // is this pattern's first instruction + if (trueList != null) { + trueList.backPatch(success); + } + if (falseList != null) { + falseList.backPatch(fail); + } + + // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one - if (_instructionList != null) il.append(_instructionList); + if (_instructionList != null) { + il.append(_instructionList); + } - // Set current instruction list to be this one. + // Set current instruction list to be this one _instructionList = il; } - return(_start = fail); - } - - /** - * Returns the instruction list for this test sequence - */ - public InstructionList getInstructionList() { - return _instructionList; + return (_start = fail); } - } No revision No revision 83.161.120.155 +7 -6 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/MultiHashtable.java Index: MultiHashtable.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/MultiHashtable.java,v retrieving revision 1.2 retrieving revision 83.161.120.155 diff -u -r1.2 -r83.161.120.155 --- MultiHashtable.java 20 Aug 2001 14:50:32 -0000 1.2 +++ MultiHashtable.java 1 Aug 2002 19:55:31 -0000 83.161.120.155 @@ -75,17 +75,18 @@ return vector; } - public boolean maps(Object from, Object to) { - if (from == null) return false; + public Object maps(Object from, Object to) { + if (from == null) return null; final Vector vector = (Vector) get(from); if (vector != null) { final int n = vector.size(); for (int i = 0; i < n; i++) { - if (vector.elementAt(i).equals(to)) { - return true; + final Object item = vector.elementAt(i); + if (item.equals(to)) { + return item; } } } - return false; + return null; } } 83.161.120.155 +2 -3 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 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- ReferenceType.java 29 Jul 2002 00:01:26 -0000 83.161.120.155 +++ ReferenceType.java 1 Aug 2002 19:55:31 -0000 83.161.120.155 @@ -230,7 +230,6 @@ il.append(new INVOKESTATIC(index)); } - /** * Subsume reference into ObjectType. * @@ -238,7 +237,7 @@ */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ObjectType type) { - methodGen.getInstructionList().append(NOP); + methodGen.getInstructionList().append(NOP); } /** 83.161.120.155 +18 -1 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 83.161.120.155 retrieving revision 83.161.120.155 diff -u -r83.161.120.155 -r83.161.120.155 --- ResultTreeType.java 17 Apr 2002 18:13:43 -0000 83.161.120.155 +++ ResultTreeType.java 1 Aug 2002 19:55:31 -0000 83.161.120.155 @@ -136,6 +136,9 @@ else if (type == Type.Reference) { translateTo(classGen, methodGen, (ReferenceType)type); } + else if (type == Type.Object) { + translateTo(classGen, methodGen, (ObjectType) type); + } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), type.toString()); @@ -380,6 +383,16 @@ } /** + * Subsume result tree into ObjectType. + * + * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo + */ + public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, + ObjectType type) { + methodGen.getInstructionList().append(NOP); + } + + /** * Translates a result tree into a non-synthesized boolean. * It does not push a 0 or a 1 but instead returns branchhandle list * to be appended to the false list. @@ -429,7 +442,11 @@ MAKE_NODE_LIST_SIG2); il.append(new INVOKEINTERFACE(index, 2)); } + else if (className.equals("java.lang.Object")) { + il.append(NOP); + } else { +System.out.println("ResultTreeType.translateTo()"); ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), className); classGen.getParser().reportError(Constants.FATAL, err); No revision No revision 83.161.120.155 +2 -2 xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java Index: SystemIDResolver.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java,v retrieving revision 1.15 retrieving revision 83.161.120.155 diff -u -r1.15 -r83.161.120.155 --- SystemIDResolver.java 22 Mar 2002 00:43:41 -0000 1.15 +++ SystemIDResolver.java 1 Aug 2002 19:55:31 -0000 83.161.120.155 @@ -263,8 +263,8 @@ // Not so sure if this is good. But, for now, I'll try it. We really must // make sure the return from this function is a URL! if((Character.isLetter(uriStr.charAt(0)) && (uriStr.charAt(1) == ':') - && (uriStr.charAt(2) == '/') && (uriStr.charAt(3) != '/')) - || ((uriStr.charAt(0) == '/') && (uriStr.charAt(1) != '/'))) + && (uriStr.charAt(2) == '/') && (uriStr.length() == 3 || uriStr.charAt(3) != '/')) + || ((uriStr.charAt(0) == '/') && (uriStr.length() == 1 || uriStr.charAt(1) != '/'))) { uriStr = "file:///"+uriStr; } 83.161.120.155 +20 -3 xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java Index: TreeWalker.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/TreeWalker.java,v retrieving revision 1.14 retrieving revision 83.161.120.155 diff -u -r1.14 -r83.161.120.155 --- TreeWalker.java 11 Oct 2001 15:01:35 -0000 1.14 +++ TreeWalker.java 1 Aug 2002 19:55:31 -0000 83.161.120.155 @@ -71,6 +71,7 @@ * This class does a pre-order walk of the DOM tree, calling a ContentHandler * interface as it goes. */ + public class TreeWalker { @@ -167,8 +168,13 @@ } /** - * Perform a pre-order traversal non-recursive style. + * Perform a pre-order traversal non-recursive style. * + * Note that TreeWalker assumes that the subtree is intended to represent + * a complete (though not necessarily well-formed) document and, during a + * traversal, startDocument and endDocument will always be issued to the + * SAX listener. + * * @param pos Node in the tree where to start traversal * * @throws TransformerException @@ -176,6 +182,8 @@ public void traverse(Node pos) throws org.xml.sax.SAXException { + this.m_contentHandler.startDocument(); + Node top = pos; while (null != pos) @@ -211,10 +219,16 @@ pos = nextNode; } + this.m_contentHandler.endDocument(); } /** * Perform a pre-order traversal non-recursive style. + + * Note that TreeWalker assumes that the subtree is intended to represent + * a complete (though not necessarily well-formed) document and, during a + * traversal, startDocument and endDocument will always be issued to the + * SAX listener. * * @param pos Node in the tree where to start traversal * @param top Node in the tree where to end traversal @@ -224,6 +238,8 @@ public void traverse(Node pos, Node top) throws org.xml.sax.SAXException { + this.m_contentHandler.startDocument(); + while (null != pos) { startNode(pos); @@ -254,6 +270,7 @@ pos = nextNode; } + this.m_contentHandler.endDocument(); } /** Flag indicating whether following text to be processed is raw text */ @@ -325,7 +342,7 @@ // ??; break; case Node.DOCUMENT_NODE : - this.m_contentHandler.startDocument(); + break; case Node.ELEMENT_NODE : NamedNodeMap atts = ((Element) node).getAttributes(); @@ -454,8 +471,8 @@ switch (node.getNodeType()) { case Node.DOCUMENT_NODE : - this.m_contentHandler.endDocument(); break; + case Node.ELEMENT_NODE : String ns = m_dh.getNamespaceOfNode(node); if(null == ns) --------------------------------------------------------------------- To unsubscribe, e-mail: ejohnson@example.net For additional commands, e-mail: ejohnson@example.net From xalanejohnson@example.net Thu Aug 01 22:00:27 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 13279 invoked by uid 500); 1 Aug 2002 22:00:27 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 13268 invoked from network); 1 Aug 2002 22:00:27 -0000 Date: 1 Aug 2002 22:00:26 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/c/src Makefile.in X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dbertoni 2002/08/01 15:00:25 Modified: c/src Tag: LotusXSL4C_1_3_1 Makefile.in Log: Added support for Intel compiler. Revision Changes Path No revision No revision 83.161.120.155.2.1 +9 -4 xml-xalan/c/src/Makefile.in Index: Makefile.in =================================================================== RCS file: /home/cvs/xml-xalan/c/src/Makefile.in,v retrieving revision 83.161.120.155 retrieving revision 83.161.120.155.2.1 diff -u -r83.161.120.155 -r83.161.120.155.2.1 --- Makefile.in 1 Aug 2002 18:44:30 -0000 83.161.120.155 +++ Makefile.in 1 Aug 2002 22:00:25 -0000 83.161.120.155.2.1 @@ -144,17 +144,22 @@ SUPPORTED = TRUE ALLLIBS = ${LIBS} -L/usr/lib SHLIBSUFFIX=.so + PIC_OPTION= ifeq (${CXX}, icpc) - PLATFORM_COMPILE_OPTIONS = -w1 -Xa -mp -prec_div -KPIC -D${PLATFORM} -D_REENTRANT + PIC_OPTION=-KPIC + PLATFORM_COMPILE_OPTIONS = -w1 -Xa -mp -prec_div else - PLATFORM_COMPILE_OPTIONS = -fPIC -Wall -D${PLATFORM} -D_REENTRANT + PIC_OPTION=-fPIC + PLATFORM_COMPILE_OPTIONS = -Wall endif + PLATFORM_COMPILE_OPTIONS += ${PIC_OPTION} -D${PLATFORM} -D_REENTRANT + # We need the ICU library if we are using the ICUBridge ifdef XALAN_USE_ICU LD_RPATH_PRE= -Wl,-rpath, @@ -164,8 +169,8 @@ EXTRA_LINK_OPTIONS= CC1 = $(CXX) $(CXXFLAGS) $(PLATFORM_COMPILE_OPTIONS) CC4 = $(CC) $(CXXFLAGS) $(PLATFORM_COMPILE_OPTIONS) - MAKE_SHARED = ${CXX} $(CXXFLAGS) -D${PLATFORM} -shared -fPIC - LINK = $(CXX) -D${PLATFORM} -fpic + MAKE_SHARED = ${CXX} $(CXXFLAGS) -D${PLATFORM} -shared ${PIC_OPTION} + LINK = $(CXX) -D${PLATFORM} ${PIC_OPTION} endif --------------------------------------------------------------------- To unsubscribe, e-mail: ejohnson@example.net For additional commands, e-mail: ejohnson@example.net From xalanejohnson@example.net Fri Aug 02 18:46:46 2002 Return-Path: <xalanejohnson@example.net> Delivered-To: ejohnson@example.net Received: (qmail 59188 invoked by uid 500); 2 Aug 2002 18:46:46 -0000 Mailing-List: contact ejohnson@example.net; run by ezmlm Precedence: bulk list-help: <mailto:ejohnson@example.net> list-unsubscribe: <mailto:ejohnson@example.net> list-post: <mailto:ejohnson@example.net> Reply-To: <ejohnson@example.net> Delivered-To: mailing list ejohnson@example.net Received: (qmail 59175 invoked from network); 2 Aug 2002 18:46:45 -0000 Date: 2 Aug 2002 18:46:45 -0000 Message-ID: <ejohnson@example.net> From: ejohnson@example.net To: ejohnson@example.net Subject: cvs commit: xml-xalan/java/xdocs/sources/xalan xsltc_constraints.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N amiro 2002/08/02 11:46:45 Modified: java/xdocs/sources/xalan xsltc_constraints.xml Log: changed verbage to agree with new support of constructors and nonstatic external java functions Revision Changes Path 1.37 +40 -7 xml-xalan/java/xdocs/sources/xalan/xsltc_constraints.xml Index: xsltc_constraints.xml =================================================================== RCS file: /home/cvs/xml-xalan/java/xdocs/sources/xalan/xsltc_constraints.xml,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- xsltc_constraints.xml 25 Jul 2002 15:22:25 -0000 1.36 +++ xsltc_constraints.xml 2 Aug 2002 18:46:45 -0000 1.37 @@ -33,12 +33,11 @@ <p>XSLTC supports a number of features that are not required by the XSLT 1.0 specification, but which are supported by a number of other XSLT processors:</p> <ul> - <li><em>Calling external Java methods from a Translet.</em><br/> - At the time of writing, only static methods are supported. A call to a function - whose namespace is either <code>&lt;http://xml.apache.org/xslt/java</code> - or <code>&lt;http://xml.apache.org/xalan/xsltc/java</code> - is resolved by loading the appropriate class and calling a static method that - matches the signature of the function. The class can be specified as part + <li><em>Calling external Java functions from a Translet.</em><br/> + Constructors, static, and nonstatic functions are supported. You may use + either the <code>&lt;http://xml.apache.org/xslt/java</code> + or the <code>&lt;http://xml.apache.org/xalan/xsltc/java</code> namespace to + call your external function. The class can be specified as part of the namespace URI or as part of the function call as shown in the following example:<br/> <source> &lt;xsl:stylesheet version=&quot;1.0&quot; @@ -49,7 +48,41 @@ &lt;xsl:value-of select=&quot;java:java.lang.System.currentTimeMillis()&quot;/&gt; &lt;xsl:value-of select=&quot;java-system:currentTimeMillis()&quot;/&gt; &lt;/xsl:template&gt; -&lt;/xsl:stylesheet&gt;</source><br/></li> + &lt;/xsl:stylesheet&gt;</source><br/> + The following example shows you how to call constructors, static, and nonstatic functions<br/> + + <source>&lt;xsl:stylesheet version=&quot;1.0&quot; + xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; + xmlns:java=&quot;http://xml.apache.org/xslt/java&quot; + exclude-result-prefixes=&quot;java&quot;&gt; + + &lt;!-- + * test: construction of Date object using a parameter
{'source': 'Apache Software Foundation Public Mail Archives'}