From c8875fb97fc03779a5bba09872227b1d08e5d52a Mon Sep 17 00:00:00 2001 From: tromey Date: Sat, 16 Jul 2005 00:30:23 +0000 Subject: Initial revision git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102074 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/classpath/scripts/.cvsignore | 3 + libjava/classpath/scripts/Makefile.am | 2 + libjava/classpath/scripts/check_jni_methods.sh | 46 ++ libjava/classpath/scripts/checkstyle-config.xml | 132 +++++ libjava/classpath/scripts/checkstyle-header.regex | 38 ++ .../classpath/scripts/checkstyle-suppressions.xml | 34 ++ libjava/classpath/scripts/checkstyle.css | 42 ++ libjava/classpath/scripts/checkstyle2html.xsl | 102 ++++ libjava/classpath/scripts/classpath-build | 68 +++ libjava/classpath/scripts/classpath-daily | 17 + libjava/classpath/scripts/classpath.spec.in | 66 +++ libjava/classpath/scripts/eclipse-gnu.xml | 186 ++++++ libjava/classpath/scripts/generate-locale-list.sh | 57 ++ libjava/classpath/scripts/jalopy-gnu.xml | 378 ++++++++++++ libjava/classpath/scripts/japi | 135 +++++ libjava/classpath/scripts/kissme-mauve | 346 +++++++++++ libjava/classpath/scripts/patches.pl | 164 ++++++ libjava/classpath/scripts/timezones.pl | 366 ++++++++++++ libjava/classpath/scripts/tzabbrevs | 40 ++ libjava/classpath/scripts/unicode-blocks.pl | 210 +++++++ libjava/classpath/scripts/unicode-muncher.pl | 639 +++++++++++++++++++++ 21 files changed, 3071 insertions(+) create mode 100644 libjava/classpath/scripts/.cvsignore create mode 100644 libjava/classpath/scripts/Makefile.am create mode 100755 libjava/classpath/scripts/check_jni_methods.sh create mode 100644 libjava/classpath/scripts/checkstyle-config.xml create mode 100644 libjava/classpath/scripts/checkstyle-header.regex create mode 100644 libjava/classpath/scripts/checkstyle-suppressions.xml create mode 100644 libjava/classpath/scripts/checkstyle.css create mode 100644 libjava/classpath/scripts/checkstyle2html.xsl create mode 100755 libjava/classpath/scripts/classpath-build create mode 100755 libjava/classpath/scripts/classpath-daily create mode 100644 libjava/classpath/scripts/classpath.spec.in create mode 100644 libjava/classpath/scripts/eclipse-gnu.xml create mode 100755 libjava/classpath/scripts/generate-locale-list.sh create mode 100644 libjava/classpath/scripts/jalopy-gnu.xml create mode 100755 libjava/classpath/scripts/japi create mode 100755 libjava/classpath/scripts/kissme-mauve create mode 100755 libjava/classpath/scripts/patches.pl create mode 100755 libjava/classpath/scripts/timezones.pl create mode 100644 libjava/classpath/scripts/tzabbrevs create mode 100755 libjava/classpath/scripts/unicode-blocks.pl create mode 100755 libjava/classpath/scripts/unicode-muncher.pl (limited to 'libjava/classpath/scripts') diff --git a/libjava/classpath/scripts/.cvsignore b/libjava/classpath/scripts/.cvsignore new file mode 100644 index 00000000000..190036bb1ae --- /dev/null +++ b/libjava/classpath/scripts/.cvsignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in +classpath.spec diff --git a/libjava/classpath/scripts/Makefile.am b/libjava/classpath/scripts/Makefile.am new file mode 100644 index 00000000000..a0861661830 --- /dev/null +++ b/libjava/classpath/scripts/Makefile.am @@ -0,0 +1,2 @@ + +EXTRA_DIST = check_jni_methods.sh generate-locale-list.sh diff --git a/libjava/classpath/scripts/check_jni_methods.sh b/libjava/classpath/scripts/check_jni_methods.sh new file mode 100755 index 00000000000..587b8792bb5 --- /dev/null +++ b/libjava/classpath/scripts/check_jni_methods.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +TMPFILE=check-jni-methods.$$.1 +TMPFILE2=check-jni-methods.$$.2 +TMPFILE3=check-jni-methods.$$.3 + +# Find all methods defined in the header files generated +# from the java source files. +grep -h '^JNIEXPORT .* Java_' include/*.h | \ + LC_ALL=C sed -e 's,.*JNICALL \(Java_[a-z_A-Z0-9]*\).*$,\1,' | \ + sort > $TMPFILE + +# Find all methods in the JNI C source files. +find native/jni -name \*.c | \ + xargs grep -h '^Java_' | \ + LC_ALL=C sed -e 's,^\(Java_[a-z_A-Z0-9]*\) *(.*$,\1,' | \ + sort > $TMPFILE2 + +# Write temporary ignore file. +cat > $TMPFILE3 << EOF +-Java_gnu_java_awt_peer_gtk_GtkMenuComponentPeer_dispose +-Java_java_lang_VMSystem_arraycopy +-Java_java_lang_VMSystem_identityHashCode +EOF + +# Compare again silently. +diff -ub -0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -q -v -f $TMPFILE3 +RESULT=$? + +if test "$RESULT" = "0" ; then + echo "Found a problem with the JNI methods declared and implemented." + echo "(-) missing in implementation, (+) missing in header files" + + # Compare the found method lists. + diff -ub -0 $TMPFILE $TMPFILE2 | grep '^[+-]Java' | grep -v -f $TMPFILE3 +fi + +# Cleanup. +rm -f $TMPFILE $TMPFILE2 $TMPFILE3 + +if test "$RESULT" = "0" ; then + exit 1 +fi + +exit 0 + diff --git a/libjava/classpath/scripts/checkstyle-config.xml b/libjava/classpath/scripts/checkstyle-config.xml new file mode 100644 index 00000000000..498e7faddd3 --- /dev/null +++ b/libjava/classpath/scripts/checkstyle-config.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libjava/classpath/scripts/checkstyle-header.regex b/libjava/classpath/scripts/checkstyle-header.regex new file mode 100644 index 00000000000..15eb29a5092 --- /dev/null +++ b/libjava/classpath/scripts/checkstyle-header.regex @@ -0,0 +1,38 @@ +^/\* .*$ +^ .*$ +^ (Copyright \(C\) .*|Free Software Foundation, Inc.)$ +^$ +^This file is part of GNU Classpath.$ +^$ +^GNU Classpath is free software; you can redistribute it and/or modify$ +^it under the terms of the GNU General Public License as published by$ +^the Free Software Foundation; either version 2, or \(at your option\)$ +^any later version.$ +^ *$ +^GNU Classpath is distributed in the hope that it will be useful, but$ +^WITHOUT ANY WARRANTY; without even the implied warranty of$ +^MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU$ +^General Public License for more details.$ +^$ +^You should have received a copy of the GNU General Public License$ +^along with GNU Classpath; see the file COPYING. If not, write to the$ +^Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA$ +^02110-1301 USA.$ +^$ +^Linking this library statically or dynamically with other modules is$ +^making a combined work based on this library. Thus, the terms and$ +^conditions of the GNU General Public License cover the whole$ +^combination.$ +^$ +^As a special exception, the copyright holders of this library give you$ +^permission to link this library with independent modules to produce an$ +^executable, regardless of the license terms of these independent$ +^modules, and to copy and distribute the resulting executable under$ +^terms of your choice, provided that you also meet, for each linked$ +^independent module, the terms and conditions of the license of that$ +^module. An independent module is a module which is not derived from$ +^or based on this library. If you modify this library, you may extend$ +^this exception to your version of the library, but you are not$ +^obligated to do so. If you do not wish to do so, delete this$ +^exception statement from your version. \*/$ +^ *$ diff --git a/libjava/classpath/scripts/checkstyle-suppressions.xml b/libjava/classpath/scripts/checkstyle-suppressions.xml new file mode 100644 index 00000000000..68c620ce958 --- /dev/null +++ b/libjava/classpath/scripts/checkstyle-suppressions.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/libjava/classpath/scripts/checkstyle.css b/libjava/classpath/scripts/checkstyle.css new file mode 100644 index 00000000000..9d1fd8b7460 --- /dev/null +++ b/libjava/classpath/scripts/checkstyle.css @@ -0,0 +1,42 @@ +body { + color: black; + font-family: sans-serif; +} +h1 { + color: #990000; + border-width: 1px; + border-style: solid; + border-color: black; + padding: 0.2em; + background-color: #cccccc; + width: 100%; +} +h2 { + color: #990000; + border-width: 1px; + border-style: solid; + border-color: black; + padding: 0.2em; + background-color: #cccccc; + width: 100%; +} +h3 { + color: #990000; + border-width: 1px; + border-style: solid; + border-color: black; + padding: 0.2em; + background-color: #cccccc; + width: 100%; +} +table { + width: 100%; +} +th { + color: white; + background-color: #999999; + text-align: left; +} +td { + background-color: #cccccc; +} diff --git a/libjava/classpath/scripts/checkstyle2html.xsl b/libjava/classpath/scripts/checkstyle2html.xsl new file mode 100644 index 00000000000..89639876ad6 --- /dev/null +++ b/libjava/classpath/scripts/checkstyle2html.xsl @@ -0,0 +1,102 @@ + + + + + + + + + + + + Checkstyle results + + + +

Checkstyle results

+
The following document contains the results of + Checkstyle.
+ +

Summary

+ + + + + + + + + + +
FilesInfosWarningsErrors
+ +

Files

+ + + + + + + + +
FileIWE
+ + + + + + + +
+ + + + + + + + + # + + + + + + + + + + + + + + +

+ + + + + + +

+ + + + + +
ErrorLine
+
+
+ + + + + + + + + +
diff --git a/libjava/classpath/scripts/classpath-build b/libjava/classpath/scripts/classpath-build new file mode 100755 index 00000000000..cd0e7d63e24 --- /dev/null +++ b/libjava/classpath/scripts/classpath-build @@ -0,0 +1,68 @@ +#!/bin/sh + +# cvs may timeout ... +set -e + +export CVS_RSH=ssh + +CLASSPATH_CVSSRCDIR=$HOME/src/cvs/classpath +CLASSPATH_SRCDIR=$HOME/src/classpath +CLASSPATH_BUILDDIR=$HOME/src/classpath/build + +DATE=`date +"%Y%m%d"` +OUTPUTDIR=$HOME/public_html/classpath/daily +LOGFILE=$OUTPUTDIR/classpath-$DATE.log + +echo -n > $LOGFILE + +if [ -d $CLASSPATH_CVSSRCDIR ] ; then + echo "update cvs source tree" >> $LOGFILE + cd $CLASSPATH_CVSSRCDIR + cvs -z 3 update >> $LOGFILE 2>&1 +fi + +if [ -d $CLASSPATH_SRCDIR ] ; then + + # delete old sources + echo "delete old source tree" >> $LOGFILE + + # workaround for automake safety behaviour with umask + chmod u+w -R $CLASSPATH_SRCDIR + + rm -rf $CLASSPATH_SRCDIR + +fi + +echo "copy cvs tree to source tree" >> $LOGFILE +cp -a $CLASSPATH_CVSSRCDIR $CLASSPATH_SRCDIR +cd $CLASSPATH_SRCDIR + +# patch version in configure.ac +if [ -f configure.ac ] ; then + mv configure.ac configure.ac.orig + sed "s/, \[.*cvs\]/, [$DATE]/" < configure.ac.orig > configure.ac +fi + +# generate autofriends stuff +./autogen.sh >> $LOGFILE 2>&1 + +# create build directory +mkdir build +cd build + +# configure and build classpath +export LD_LIBRARY_PATH=/usr/local/lib +../configure --prefix=$HOME/local/classpath --with-jikes=/usr/bin/jikes --enable-glibj=both --enable-jni --enable-gtk-peer --enable-regen-headers >> $LOGFILE 2>&1 +make >> $LOGFILE 2>&1 +make install >> $LOGFILE 2>&1 + +make dist >> $LOGFILE 2>&1 +#make distcheck >> $LOGFILE 2>&1 +cp classpath-$DATE.tar.gz $OUTPUTDIR + +cd $OUTPUTDIR +ln -sf classpath-$DATE.tar.gz LATEST-SNAPSHOT +ln -sf classpath-$DATE.log LATEST-BUILDLOG + +exit 0 + diff --git a/libjava/classpath/scripts/classpath-daily b/libjava/classpath/scripts/classpath-daily new file mode 100755 index 00000000000..c7405277346 --- /dev/null +++ b/libjava/classpath/scripts/classpath-daily @@ -0,0 +1,17 @@ +#!/bin/sh + +DATE=`date +"%Y%m%d"` +OUTPUTDIR=$HOME/public_html/classpath/daily +LOGFILE=$OUTPUTDIR/classpath-$DATE.log +FAILEDLOG=$OUTPUTDIR/classpath-failed-$DATE.log +MAIL="konqueror@gmx.de" + +/home/mkoch/bin/classpath-build + +if test "$?" = "1" ; then + tail --lines=100 $LOGFILE > $FAILEDLOG + + mail $MAIL -s "classpath daily snapshot $DATE FAILED" < $FAILEDLOG +else + mail $MAIL -s "classpath daily snapshot $DATE SUCCESSFUL" < /dev/null > /dev/null +fi diff --git a/libjava/classpath/scripts/classpath.spec.in b/libjava/classpath/scripts/classpath.spec.in new file mode 100644 index 00000000000..80522748d6e --- /dev/null +++ b/libjava/classpath/scripts/classpath.spec.in @@ -0,0 +1,66 @@ +# $Id: classpath.spec.in,v 1.2 2005/07/04 14:31:01 ziga Exp $ + +%define version_num @PACKAGE_VERSION@ +%define release_num 1 + +Summary: GNU Classpath Java class libraries +Name: classpath +Version: %{version_num} +Release: %{release_num} +Group: Development/Tools +Copyright: GPL+exception +URL: http://www.classpath.org/ +BuildRoot: %{_tmppath}/%{name}-root +BuildRequires: jikes, zip +Packager: GNU Classpath +Source: ftp://ftp.gnu.org/pub/gnu/classpath/classpath-%{version_num}.tar.gz + +%description +GNU Classpath, Essential Libraries for Java, is a GNU project to create +free core class libraries for use with virtual machines and compilers +for the Java programming language. + +%prep +%setup -n classpath-%{version_num} + +%build +pushd ${RPM_BUILD_DIR}/classpath-%{version_num} +# Determine if we can build the GTK stuff +GTKPEER='disable' +if pkg-config --exists 'gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0'; then + GTKPEER='enable' +fi +%configure --with-jikes --enable-jni --${GTKPEER}-gtk-peer +make +popd + +%install +pushd ${RPM_BUILD_DIR}/classpath-%{version_num} +%{makeinstall} +popd + +pushd ${RPM_BUILD_ROOT}/%{_infodir} +rm -f dir +for i in *; do + mv $i classpath-$i +done +popd + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%files +%defattr(-,root,root) +%doc AUTHORS COPYING LICENSE README THANKYOU +%{_libdir}/classpath +%dir %{_datadir}/classpath +%{_libdir}/security/classpath.security +%{_datadir}/classpath/glibj.zip +%doc %{_datadir}/classpath/api +%doc %{_datadir}/classpath/examples +%doc %{_infodir}/* + diff --git a/libjava/classpath/scripts/eclipse-gnu.xml b/libjava/classpath/scripts/eclipse-gnu.xml new file mode 100644 index 00000000000..8d04e08e15f --- /dev/null +++ b/libjava/classpath/scripts/eclipse-gnu.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libjava/classpath/scripts/generate-locale-list.sh b/libjava/classpath/scripts/generate-locale-list.sh new file mode 100755 index 00000000000..fb55c1c2838 --- /dev/null +++ b/libjava/classpath/scripts/generate-locale-list.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +CLASSPATH_SRCDIR=`dirname $0`/.. + +echo "/* LocaleData.java --" +echo " Copyright (C) 2004, 2005 Free Software Foundation, Inc." +echo +echo "This file is part of GNU Classpath." +echo +echo "GNU Classpath is free software; you can redistribute it and/or modify" +echo "it under the terms of the GNU General Public License as published by" +echo "the Free Software Foundation; either version 2, or (at your option)" +echo "any later version." +echo +echo "GNU Classpath is distributed in the hope that it will be useful, but" +echo "WITHOUT ANY WARRANTY; without even the implied warranty of" +echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU" +echo "General Public License for more details." +echo +echo "You should have received a copy of the GNU General Public License" +echo "along with GNU Classpath; see the file COPYING. If not, write to the" +echo "Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA" +echo "02110-1301 USA." +echo +echo "Linking this library statically or dynamically with other modules is" +echo "making a combined work based on this library. Thus, the terms and" +echo "conditions of the GNU General Public License cover the whole" +echo "combination." +echo +echo "As a special exception, the copyright holders of this library give you" +echo "permission to link this library with independent modules to produce an" +echo "executable, regardless of the license terms of these independent" +echo "modules, and to copy and distribute the resulting executable under" +echo "terms of your choice, provided that you also meet, for each linked" +echo "independent module, the terms and conditions of the license of that" +echo "module. An independent module is a module which is not derived from" +echo "or based on this library. If you modify this library, you may extend" +echo "this exception to your version of the library, but you are not" +echo "obligated to do so. If you do not wish to do so, delete this" +echo "exception statement from your version. */" +echo +echo +echo "package java.util;" +echo +echo "// This file was automatically generated by scripts/generate-locale-list.sh" +echo +echo +echo "class LocaleData" +echo "{" +echo " public static String[] localeNames =" +echo " {" + +( cd $CLASSPATH_SRCDIR/resource/gnu/java/locale ; ls LocaleInformation_*.properties ) | xargs -n 1 echo | sed -e 's/LocaleInformation_\(.*\)\.properties/\1/' | +while read locale ; do echo " \"$locale\"," ; done + +echo " };" +echo "}" diff --git a/libjava/classpath/scripts/jalopy-gnu.xml b/libjava/classpath/scripts/jalopy-gnu.xml new file mode 100644 index 00000000000..ad5c5abdffe --- /dev/null +++ b/libjava/classpath/scripts/jalopy-gnu.xml @@ -0,0 +1,378 @@ + + + + + 14 + + + + + false + + + [A-Z][a-zA-Z0-9]+ + [A-Z][a-zA-Z0-9]+ + + + [a-z][\w]+ + [a-z][\w]+ + [a-zA-Z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-zA-Z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-zA-Z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-zA-Z][\w]+ + + [A-Z][a-zA-Z0-9]+ + \w+ + + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + [a-z][\w]+ + + [a-z]+(?:\.[a-z]+)* + + [a-z][\w]+ + [a-z][\w]+ + + [a-z][\w]* + + + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + 6 + + + + 30000 + 30000 + 30000 + 30000 + 30000 + 30000 + + true + + + 1 + + + + true + false + true + false + false + + + bak + 0 + + + + 0 + 0 + 1 + 0 +
1
+
1
+ 1 + 1 + 1 + 1 +
+ + 0 + 0 + 0 + + 1 + 0 + 0 + + 0 + 0 +
0
+
0
+ 2 +
+ 1 +
+ + + false + false + + + false + false + false + false + + + true + true + true + true + true + + + true + false + + + + true + true + + + + false + + + + false + false + false + + false + + 0 + 0 + 0 + 0 + + false + + + + + + + */ + * @throws $exceptionType$ DOCUMENT ME! + * @param $paramType$ DOCUMENT ME! + * @return DOCUMENT ME! + /**| * DOCUMENT ME! + + + + + false + false + false + + + - + false + false + + Inner Classes + Constructors + Instance fields + Instance initializers + Inner Interfaces + Methods + Static fields/initializers + + + + +
+ + 0 + false +
+
+ + 0 + false +
+ + disabled + + + + 1 + *:0|gnu:1|java:1|javax:1|org:1 + + disabled + true + + + true + + true + true + + false + + + true + + + 1 + 2 + 2 + 0 + 0 + 55 + -1 + 2 + -1 + 0 + 8 + 2 + 1 + + + true + true + + + + false + false + false + false + true + false + + + + false + false + false + false + false + static|field|initializer|constructor|method|interface|class + false + + + true + public|protected|private|abstract|static|final|synchronized|transient|volatile|native|strictfp + + + + + true + true + true + + + true + false + false + false + + true + + + false + false + true + + + + true + false + + true + true + true + true + true + true + + false + false + + + + + + 0 + true + false + false + + false + + false + false + + false + + + true + false + false + false + + + false + false + false + + + + true + true + 79 + + + + false + false + false + + false + false + false + + + + false + + false + + +
+
+ diff --git a/libjava/classpath/scripts/japi b/libjava/classpath/scripts/japi new file mode 100755 index 00000000000..52bcbc472a5 --- /dev/null +++ b/libjava/classpath/scripts/japi @@ -0,0 +1,135 @@ +#!/bin/sh + +CLASSPATH_CVS=~/japi/classpath +JAPIZE_DIR=~/japitools-0.9 +FTPROOT=~alpha/pub/gnu/classpath/nightly/tests +LOG=/tmp/japi.log +export PATH=${PATH}:/usr/java/j2sdk1.4.1/bin + +rm -f /tmp/japi.log > /dev/null 2>&1 + +classpath_checkout () +{ + if [ ! -d "${CLASSPATH_CVS}" ]; then + mkdir --parents ${CLASSPATH_CVS} + local dir=`dirname "${CLASSPATH_CVS}"` + cd "${dir}" + cvs -z3 -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/classpath co classpath >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out classpath" + exit 1 + fi + fi +} + +classpath_update () +{ + cd "${CLASSPATH_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out classpath" + exit 1 + fi +} + +classpath_clean () +{ + if [ -d "${CLASSPATH_CVS}/build" ]; then + rm -rf "${CLASSPATH_CVS}/build" + fi +# if [ -d "${CLASSPATH_PREFIX}" ]; then +# rm -rf "${CLASSPATH_PREFIX}" +# fi + mkdir --parents "${CLASSPATH_CVS}/build" +# mkdir --parents "${CLASSPATH_PREFIX}" +} + +classpath_configure () +{ + cd "${CLASSPATH_CVS}" + aclocal >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running aclocal" + exit 1 + fi + autoheader >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running autoheader" + exit 1 + fi + automake >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running automake" + exit 1 + fi + autoconf >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running autoconf" + exit 1 + fi + cd "${CLASSPATH_CVS}/build" && ../configure --with-gcj >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error configuring" + exit 1 + fi +} + +classpath_build () +{ + cd "${CLASSPATH_CVS}/build" && make >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error during make" + exit 1 + fi +} + + +japize_classpath () +{ + cd "${JAPIZE_DIR}/bin" && ./japize as classpath packages "${CLASSPATH_CVS}/build/lib/glibj.zip" +java +javax +org -java.awt.dnd.peer -java.awt.peer -org.apache -org.w3c.dom.css -org.w3c.dom.events -org.w3c.dom.html -org.w3c.dom.stylesheets -org.w3c.dom.traversal -org.w3c.dom.views -java.text.resources >> /tmp/japi.log 2>&1 + if [ $? -ne 0 ]; then + echo "Error running japize" + exit 1 + fi + cp -f "${JAPIZE_DIR}/bin/classpath.japi.gz" /tmp +} + +japicompat_classpath () +{ + today=`date` + echo "${today}" > /tmp/classpath-jdk11-compare.txt + cd "${JAPIZE_DIR}/bin" && ./japicompat -q jdk11.japi.gz classpath.japi.gz >> /tmp/classpath-jdk11-compare.txt + if [ $? -ne 0 ]; then + echo "Error running japicompat" + exit 1 + fi + echo "${today}" > /tmp/classpath-jdk13-compare.txt + cd "${JAPIZE_DIR}/bin" && ./japicompat -q jdk13.japi.gz classpath.japi.gz >> /tmp/classpath-jdk13-compare.txt + if [ $? -ne 0 ]; then + echo "Error running japicompat" + exit 1 + fi +} + +#-------------------------------------------------------------------- +# Update Classpath CVS +#-------------------------------------------------------------------- +classpath_checkout +classpath_update + +#-------------------------------------------------------------------- +# Build Classpath with GCJ 3.2 +#-------------------------------------------------------------------- +classpath_clean +classpath_configure +classpath_build + +#-------------------------------------------------------------------- +# Run japize on glibj.zip +#-------------------------------------------------------------------- +japize_classpath + +#-------------------------------------------------------------------- +# Run japicompat against jdk13 +#-------------------------------------------------------------------- +japicompat_classpath + diff --git a/libjava/classpath/scripts/kissme-mauve b/libjava/classpath/scripts/kissme-mauve new file mode 100755 index 00000000000..8a6ee22db66 --- /dev/null +++ b/libjava/classpath/scripts/kissme-mauve @@ -0,0 +1,346 @@ +#!/bin/sh + +CLASSPATH_CVS=~/mauve/classpath +CLASSPATH_PREFIX=~/mauve/root/classpath +MAUVE_CVS=~/mauve/mauve +KISSME_CVS=~/mauve/kissme +KISSME_PREFIX=~/mauve/root/kissme +KISSME_BIN=~/mauve/kissme/useful_scripts/kissme +LOG=/tmp/mauve.log +RESULTS=/tmp/kissme-mauve.txt +REPORT=/tmp/kissme-mauve-report.txt +TIMEOUT=30 + +rm -f ${LOG} > /dev/null 2>&1 +rm -f ${RESULTS} > /dev/null 2>&1 +today=`date` +echo "${today}" > ${LOG} +touch ${RESULTS} + + +_aclocal () +{ + aclocal "$@" >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running aclocal" + exit 1 + fi +} + +_autoheader () +{ + autoheader "$@" >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running autoheader" + exit 1 + fi +} + +_automake () +{ + automake "$@" >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running automake" + exit 1 + fi +} + +_autoconf () +{ + autoconf "$@" >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error running autoconf" + exit 1 + fi +} + +classpath_checkout () +{ + if [ ! -d "${CLASSPATH_CVS}" ]; then + mkdir --parents ${CLASSPATH_CVS} + local dir=`dirname "${CLASSPATH_CVS}"` + cd "${dir}" + cvs -z3 -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/classpath co classpath >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out classpath" + exit 1 + fi + fi +} + +classpath_update () +{ + cd "${CLASSPATH_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out classpath" + exit 1 + fi +} + +classpath_clean () +{ + if [ -d "${CLASSPATH_CVS}/build" ]; then + rm -rf "${CLASSPATH_CVS}/build" + fi + if [ -d "${CLASSPATH_PREFIX}" ]; then + rm -rf "${CLASSPATH_PREFIX}" + fi + mkdir --parents "${CLASSPATH_CVS}/build" + mkdir --parents "${CLASSPATH_PREFIX}" +} + +classpath_configure () +{ + cd "${CLASSPATH_CVS}" + + _aclocal + _autoheader + _automake + _autoconf + + cd "${CLASSPATH_CVS}/build" && ../configure --prefix=${CLASSPATH_PREFIX} --with-gcj --enable-jni >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error configuring" + exit 1 + fi +} + +classpath_build () +{ + cd "${CLASSPATH_CVS}/build" && make >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error during make" + exit 1 + fi +} + +classpath_install () +{ + cd "${CLASSPATH_CVS}/build" && make install >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error during make" + exit 1 + fi +} + +kissme_checkout () +{ + if [ ! -d "${KISSME_CVS}" ]; then + mkdir --parents ${KISSME_CVS} + local dir=`dirname "${KISSME_CVS}"` + cd "${KISSME_CVS}" + cvs -z3 -d :pserver:anonymous@cvs.kissme.sourceforge.net:/cvsroot/kissme co . >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out kissme" + exit 1 + fi + fi +} + +kissme_update () +{ + cd "${KISSME_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out kissme" + exit 1 + fi +} + +kissme_clean () +{ + if [ -d "${KISSME_CVS}/build" ]; then + rm -rf "${KISSME_CVS}/build" + fi + if [ -d "${KISSME_PREFIX}" ]; then + rm -rf "${KISSME_PREFIX}" + fi + mkdir --parents "${KISSME_CVS}/build" + mkdir --parents "${KISSME_PREFIX}" +} + +kissme_configure () +{ + cd "${KISSME_CVS}" + + _aclocal + _autoheader + _automake -a + _autoconf + + cd "${KISSME_CVS}" && ./configure --prefix=${KISSME_PREFIX} \ + --enable-use-zips --with-gnu-classpath=${CLASSPATH_CVS} \ + --with-gnu-classpath-build=${CLASSPATH_CVS}/build \ + --with-classpath-install-dir=${CLASSPATH_PREFIX} >> ${LOG} 2>&1 + + if [ $? -ne 0 ]; then + echo "Error configuring" + exit 1 + fi +} + +kissme_build () +{ + cd "${KISSME_CVS}" && make >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error during make" + exit 1 + fi +} + +kissme_install () +{ + cd "${KISSME_CVS}" && make install >> ${LOG} 2>&1 + if [ $? -ne 0 ]; then + echo "Error during make" + exit 1 + fi +} + +mauve_checkout () +{ + if [ ! -d "${MAUVE_CVS}" ]; then + mkdir --parents ${MAUVE_CVS} + local dir=`dirname "${MAUVE_CVS}"` + cd "${dir}" + cvs -z3 -d :pserver:anoncvs@sources.redhat.com:/cvs/mauve co mauve >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out mauve" + exit 1 + fi + fi +} + +mauve_update () +{ + cd "${MAUVE_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null + if [ $? -ne 0 ]; then + echo "Error checking out mauve" + exit 1 + fi +} + +kissme_mauve () +{ + export JAVAC="jikes -bootclasspath ${CLASSPATH_PREFIX}/share/classpath/glibj.zip" + export JAVA="${KISSME_BIN}" + +# if [ -f "${KISSME_CVS}/useful_scripts/mauve-kissme" ]; then +# cp -f "${KISSME_CVS}/useful_scripts/mauve-kissme" "${MAUVE_CVS}" +# fi + + if [ -f "${CLASSPATH_CVS}/mauve-classpath" ]; then + cp -f "${CLASSPATH_CVS}/mauve-classpath" "${MAUVE_CVS}" + fi + + cd "${MAUVE_CVS}" + if [ $? -ne 0 ]; then + echo "Error configuring mauve" + exit 1 + fi + + _aclocal + _automake + _autoconf + + ./configure >> "${LOG}" 2>&1 + if [ $? -ne 0 ]; then + echo "Error configuring mauve" + exit 1 + fi + + # create class choices from key file + if [ -f classes ]; then + rm -f classes 2>/dev/null + fi + if [ -f choices ]; then + rm -f choices 2>/dev/null + fi + /bin/sh choose "${MAUVE_CVS}" classpath + if [ $? -ne 0 ]; then + echo "Error during choose for mauve" + exit 1 + fi + + # compile classes + compile=`cat "${MAUVE_CVS}/classes" | tr '.' '/' | awk '{print $1".java"}' | xargs` + ${JAVAC} -classpath "${MAUVE_CVS}" -d "${MAUVE_CVS}" ${compile} >> "${LOG}" 2>&1 + if [ $? -ne 0 ]; then + echo "Error during compile for mauve" + exit 1 + fi + + set -m + for i in `cat "${MAUVE_CVS}/classes"`; do + echo "$i" | ${JAVA} gnu.testlet.SimpleTestHarness -verbose >> "${RESULTS}" 2>&1 & + + vm_pid=$! + sleep ${TIMEOUT} && kill -9 $vm_pid > /dev/null 2>&1 && echo "FAIL: $i execution aborted" >> "${RESULTS}" & + kill_pid=$! + fg %- 2>/dev/null + kill -9 $kill_pid >/dev/null 2>&1 # && echo Test did not time out + done +} + +mauve_summary () +{ + if [ ! -f "${RESULTS}" ]; then + echo "Error creating summary" + exit 1 + fi + + pass_cnt=`grep PASS "${RESULTS}" | wc -l` + fail_cnt=`grep FAIL "${RESULTS}" | wc -l` + total_cnt=`expr $pass_cnt + $fail_cnt` + + today=`date` + echo "Mauve test results for Kissme" > "${REPORT}" + echo "Report generated on ${today}" >> "${REPORT}" + echo "" >> "${REPORT}" + echo "${fail_cnt} of ${total_cnt} tests failed." >> "${REPORT}" + echo "" >> "${REPORT}" + cat "${RESULTS}" >> "${REPORT}" +} + +#-------------------------------------------------------------------- +# Update Classpath CVS +#-------------------------------------------------------------------- +classpath_checkout +classpath_update + +#-------------------------------------------------------------------- +# Build Classpath with GCJ 3.2 +#-------------------------------------------------------------------- +classpath_clean +classpath_configure +classpath_build +classpath_install + +#-------------------------------------------------------------------- +# Update Kissme CVS +#-------------------------------------------------------------------- +kissme_checkout +kissme_update + +#-------------------------------------------------------------------- +# Build Kissme +#-------------------------------------------------------------------- +kissme_clean +kissme_configure +kissme_build +#kissme_install + +#-------------------------------------------------------------------- +# Update Mauve CVS +#-------------------------------------------------------------------- +mauve_checkout +mauve_update + +#-------------------------------------------------------------------- +# Execute Mauve +#-------------------------------------------------------------------- +kissme_mauve + +#-------------------------------------------------------------------- +# Create report +#-------------------------------------------------------------------- +mauve_summary diff --git a/libjava/classpath/scripts/patches.pl b/libjava/classpath/scripts/patches.pl new file mode 100755 index 00000000000..57f134d9201 --- /dev/null +++ b/libjava/classpath/scripts/patches.pl @@ -0,0 +1,164 @@ +#!/usr/bin/perl -w +# Purpose is to move patches from upload directory to +# public patches directory. Any file not matching the correct +# pattern is deleted. Any patch file without a README and the +# file was last modified more than 120 minutes ago is deleted. +# Any README file without a patch file which was last modified +# more than 120 minutes ago is deleted. +# +# notes to self: as long as this runs as root do not worry +# about quota problems or disk space + +use strict; + +my ($upload_dir) = "/home/ftp/classpath/incoming"; +my ($public_dir) = "/home/ftp/classpath/pub/patches"; +my ($user) = "classpath"; +my ($group) = "classpath"; +my ($mode_dir) = "775"; +my ($mode_file) = "664"; +my (@patches) = (); + +use vars qw($upload_dir $public_dir @patches $user $group + $mode_dir $mode_file); + +# main +{ + @patches = &getPatches(); + &movePatches(@patches); +} + +#--------------------------------------------------------------- +# Purpose: To remove files not matching the correct pattern. +# To remove README files without patches (last modified greater +# than 2 hours). To remove patches without README files (last +# modified greater than 2 hours). +#--------------------------------------------------------------- +sub getPatches +{ + my (@patches) = (); + my (@entries) = (); + my (%maybe) = (); + my ($entry, $debug, $prefix, $junk, $file, $patch, $readme) = ""; + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, + $mtime, $ctime, $blksize, $blocks) = ""; + + $debug = 1; + + opendir(INCOMING, "$upload_dir") || die "could not open $upload_dir\n"; + @entries = grep( !/^\.\S+/, readdir(INCOMING)); # no .* + closedir(INCOMING); + foreach $entry (sort @entries) + { + if (($entry eq ".") || ($entry eq "..")) { next; } + if (-d "$upload_dir/$entry") + { + print "Directory: $upload_dir/$entry/\n"; + } + elsif (-e "$upload_dir/$entry") + { + if ($entry eq ".message") { next; } + if ($entry eq "README") { next; } + if ($entry !~ /^\w+-\d\d\d\d\d\d-\d+\.patch\.(gz|README)$/) + { + print "REGEX FAILED: $entry\n"; + unlink("$upload_dir/$entry"); + } + else + { + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, + $ctime,$blksize,$blocks) = stat("$upload_dir/$entry"); + if ($size > 512000) + { + print "LARGE PATCH: $entry\n"; + unlink("$upload_dir/$entry"); + } + else + { + ($prefix,$junk) = split(/(\.gz|\.README)/, $entry, 2); + $maybe{$prefix} += 1; + } + } + } + } + + foreach $entry (keys(%maybe)) + { + if ($maybe{$entry} == 2) + { + $patch = "$entry.gz"; + $readme = "$entry.README"; + + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, + $ctime,$blksize,$blocks) = stat($patch); + if (time-$mtime > 900) + { + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime, + $ctime,$blksize,$blocks) = stat($readme); + if (time-$mtime > 900) + { + $patches[$#patches+1] = $entry; + } + } + } + else + { + if (-e "$upload_dir/$entry.gz") + { + unlink("$upload_dir/$entry.gz"); + print "STALE PATCH: $entry.gz\n"; + } + elsif (-e "$upload_dir/$entry.README") + { + unlink("$upload_dir/$entry.README"); + print "STALE README: $entry.README\n"; + } + } + } + return (@patches); +} + +#--------------------------------------------------------------- +# Purpose: To move the patches to the proper directory and set +# the permissions correctly. +#--------------------------------------------------------------- +sub movePatches +{ + my (@patches) = @_; + my ($patch) = ""; + my ($fail) = 0; + + if (!(-d "$public_dir")) + { + system("mkdir -p $public_dir"); + system("chown $user.$group $public_dir"); + system("chmod $mode_dir $public_dir"); + } + foreach $patch (@patches) + { + if (-e "$public_dir/$patch.gz") + { + print "Patch exists: $public_dir/$patch.gz\n"; + $fail = 1; + } + if (-e "$public_dir/$patch.README") + { + print "README exists: $public_dir/$patch.README\n"; + $fail = 1; + } + if ($fail == 0) + { + system("mv $upload_dir/$patch.gz $public_dir/$patch.gz"); + system("mv $upload_dir/$patch.README $public_dir/$patch.README"); + system("chown $user.$group $public_dir/*"); + system("chmod $mode_file $public_dir/*"); + open(MAIL, "|mail -s \"Classpath: $patch uploaded\" core\@classpath.org") || die "could not open mail\n"; + print MAIL "GNU Classpath FTP Maintenance\n"; + print MAIL "\n"; + print MAIL "Added Files:\n"; + print MAIL "ftp://ftp.classpath.org/pub/patches/$patch.gz\n"; + print MAIL "ftp://ftp.classpath.org/pub/patches/$patch.README\n\n"; + close(MAIL); + } + } +} diff --git a/libjava/classpath/scripts/timezones.pl b/libjava/classpath/scripts/timezones.pl new file mode 100755 index 00000000000..47f71370ccf --- /dev/null +++ b/libjava/classpath/scripts/timezones.pl @@ -0,0 +1,366 @@ +#!/usr/bin/perl -w +# Create the timezone tables for java/util/TimeZone from the +# standard timezone sources by Arthur David Olson (as used by glibc) +# +# This needs the files from the package tzdata2000h which may be found +# at ftp://ftp.cs.mu.oz.au/pub/. + +$TIMEZONEDIR = "tzdata"; +@TIMEZONEFILES = ("africa", "antarctica", "asia", "australasia", + "europe", "northamerica", "pacificnew", "southamerica", + "../tzabbrevs"); + +# rules hash table: +# key is a rule name +# value is either "-" (no daylight savings) or a list of three elements: +# $value[0] = end savings rule (list containing MONTH, DAY and TIME) +# $value[1] = start savings rule (ditto) +# $value[2] = daylight offset in milliseconds +my %rules = ("-" => "-"); + +# timezones list, list of pairs: +# $timezones[$i][0] is a timezone name +# $timezones[$i][1] = raw offset in milliseconds +# $timezones[$i][2] = rule in the same format as the value of +# the rules table, but TIME in milliseconds +# $timezones[$i][3] = list of timezone names with this rule (aliases) +my @timezones = ( [ "GMT", 0, "-", [ "GMT", "UTC" ] ]); + + +# parse the offset of form +/-hh:mm:ss (:ss is optional) and return it +# in milliseconds against UTC +sub parseOffset($) { + my $offset = $_[0]; + $offset =~ /^([+-]?)(\d+)(:(\d+)(:(\d+))?)?$/ + or die "Can't parse offset $offset"; + my $seconds = $2 * 3600; + $seconds += $4 * 60 if ($3); + $seconds += $6 if ($3 && $5); + if ($1 eq "-") { + $seconds = - $seconds; + } + return $seconds * 1000; +} + +# parse the time of form +/-hh:mm:ss[swguz] (:ss is optional) and return it +# in milliseconds since midnight in local standard time + my $timezonename; +sub parseTime($$$) { + my ($rawoffset, $stdoffset, $time) = @_; + $time =~ /^([+-]?)(\d+):(\d+)(:(\d+))?([swguz]?)$/ + or die "Can't parse time $time"; + my ($hour, $min) = ($2, $3); + my $sec = ($4) ? $5 : 0; + my $millis = ((($hour * 60) + $min) * 60 + $sec) * 1000; + if ($1 eq "-") { + $millis = -$millis; + } + if ($6 =~ /[guz]/) { + $millis += $rawoffset; + } elsif ($6 =~ /w/) { + print STDERR "$timezonename not in standard time\n" if $stdoffset; + $millis -= $stdoffset; + } + return $millis; +} + +my %monthnames = + ( "Jan" => "1", + "Feb" => "2", + "Mar" => "3", + "Apr" => "4", + "May" => "5", + "Jun" => "6", + "Jul" => "7", + "Aug" => "8", + "Sep" => "9", + "Oct" => "10", + "Nov" => "11", + "Dec" => "12" ); +sub parseMonth($) { + my $month = $monthnames{"$_[0]"} or die "Unknown month $_[0]"; + return $month; +} + +my %weekdaynames = + ( "Sun" => "7", + "Mon" => "1", + "Tue" => "2", + "Wed" => "3", + "Thu" => "4", + "Fri" => "5", + "Sat" => "6" ); +sub parseWeekday($) { + my $weekday = $weekdaynames{"$_[0]"} or die "Unknown weekday $_[0]"; + return $weekday; +} + +my @weekdayjavanames = + ( "Calendar.SUNDAY", + "Calendar.MONDAY", + "Calendar.TUESDAY", + "Calendar.WEDNESDAY", + "Calendar.THURSDAY", + "Calendar.FRIDAY", + "Calendar.SATURDAY" ); +my @daysInMonths = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); +sub parseDay($$$) { + my ($dayoffset, $month, $day) = @_; + if ($day =~ /^\d+$/) { + return "$day, 0"; + } elsif ($day =~ /^last([A-Z][a-z][a-z])$/) { + my $weekday = ( parseWeekday($1) + $dayoffset + 7 ) % 7; + if ($dayoffset) { + my $day = $daysInMonths[$month - 1] + $dayoffset; + warn "Can only approximate $day with dayoffset in $file" + if ($month == 2); + return "$day, -$weekdayjavanames[$weekday]"; + } else { + return "-1, $weekdayjavanames[$weekday]"; + } + } elsif ($day =~ /^([A-Z][a-z][a-z])>=(\d+)$/) { + my $start = $2 + $dayoffset; + my $weekday = ( parseWeekday($1) + $dayoffset + 7 ) % 7; + if (($start % 7) == 1) { + $start = ($start + 6) / 7; + return "$start, $weekdayjavanames[$weekday]"; + } else { + return "$start, -$weekdayjavanames[$weekday]"; + } + } else { + die "Unknown day $day"; + } +} + +my @monthjavanames = + ( "Calendar.JANUARY", + "Calendar.FEBRUARY", + "Calendar.MARCH", + "Calendar.APRIL", + "Calendar.MAY", + "Calendar.JUNE", + "Calendar.JULY", + "Calendar.AUGUST", + "Calendar.SEPTEMBER", + "Calendar.OCTOBER", + "Calendar.NOVEMBER", + "Calendar.DECEMBER" ); + +sub parseRule($$$) { + my ($rawoffset, $stdoffset, $rule) = @_; + my $monthnr = parseMonth($rule->[0]); + my $time = parseTime($rawoffset, $stdoffset, $rule->[2]); + my $dayoffset = 0; + while ($time < 0) { + $time += 24*3600*1000; + $dayoffset--; + } + while ($time >= 24*3600*1000) { + $time -= 24*3600*1000; + $dayoffset++; + } + $day = parseDay($dayoffset, $monthnr, $rule->[1]); + return [ $monthjavanames[$monthnr-1], $day, $time ]; +} + + +sub ruleEquals($$) { + my ($rule1, $rule2) = @_; + # check month names + return (($rule1->[0] eq $rule2->[0]) + && ($rule1->[1] eq $rule2->[1]) + && ($rule1->[2] == $rule2->[2])); +} + +sub findAlias($$) { + my ($rawoffset, $rule) = @_; + foreach $tz (@timezones) { + my ($key, $tzoffset, $tzrule, $aliaslist) = @{$tz}; + next if ($tzoffset != $rawoffset); + if ($rule eq "-") { + return $tz if ($tzrule eq "-"); + } elsif ($tzrule ne "-") { + next if $rule->[2] != $tzrule->[2]; + if (ruleEquals($rule->[0], $tzrule->[0]) + && ruleEquals($rule->[1], $tzrule->[1])) { + return $tz; + } + } + } + return ""; +} + +sub makePretty($) { + my ($offset) = @_; + if (($offset % 3600) == 0) { + $offset /= 3600; + return "$offset * 3600"; + } else { + return "$offset"; + } +} + +sub tzcompare($$) { + my ($a, $b) = @_; + if (($a =~ /\//) != ($b =~ /\//)) { + return ($a =~ /\//) ? 1 : -1; + } else { + return $a cmp $b; + } +} + +foreach $file (@TIMEZONEFILES) { +# print STDERR "$file\n"; + open INPUT, "$TIMEZONEDIR/$file" or die "Can't open $TIMEZONEDIR/$file"; + my $in_time_zone = 0; + while () { + $_ = $1 if /^([^\#]*)\#/; + next if /^\s*$/; + my @entries = split; +# $, = ","; print "'$_' -> [",@entries,"]\n"; + if (!$in_time_zone) { + if ($entries[0] eq "Rule") { + # check if rule still applies + # column 3 is TO entry. + if ($entries[3] eq "max") { + my $rulename = $entries[1]; + my $month = $entries[5]; + my $day = $entries[6]; + my $time = $entries[7]; + if ($entries[8] eq "0") { + # This is the end time rule + $rules{"$rulename"}[0] = [ $month, $day, $time ]; + } else { + # This is the start time rule + $rules{"$rulename"}[1] = [ $month, $day, $time ]; + $rules{"$rulename"}[2] = parseOffset($entries[8]); + } + } + } elsif ($entries[0] eq "Zone") { + $in_time_zone = 1; + shift @entries; + $timezonename = shift @entries; + } elsif ($entries[0] eq "Remove") { + my $found = 0; + foreach $tz (@timezones) { + my @newaliases; + foreach $tzname (@{$tz->[3]}) { + if ($tzname eq $entries[1]) { + $found = 1; + } else { + push @newaliases, $tzname; + } + } + if ($found) { + if ($tz->[0] eq $entries[1]) { + $tz->[0] = $newaliases[0]; + } + $tz->[3] = \@newaliases; + last; + } + } + + die "Unknown link $_" if ! $found; + } elsif ($entries[0] eq "Link") { + my $alias = 0; + foreach $tz (@timezones) { + foreach $tzname (@{$tz->[3]}) { + if ($tzname eq $entries[1]) { + $alias = $tz; + last; + } + } + } + + die "Unknown link $_" if ! $alias; + die "@entries" if $entries[1] =~ /^\d+$/; + push @{$alias->[3]}, $entries[2]; + } else { + die "Unknown command: $_"; + } + } + if ($in_time_zone) { + die "early end of Zone: $_" if ($entries[0] =~ /^[A-Za-z]+/); + if (@entries <= 3) { +# print "found ZONE $timezonename $entries[0] $entries[1] $entries[2]\n"; + # This is the last line and the only we look at. + # other lines are for historic time zones. + my $rawoffset = parseOffset($entries[0]); + my $rule = $rules{"$entries[1]"} || "-"; + if ($rule ne "-") { + if (!defined($rule->[2])) { + $rule = "-"; + } else { + # now we can parse the time since we know raw offset. + my $savings = $rule->[2]; + my $endrule = parseRule($rawoffset, $savings, + $rule->[0]); + my $startrule = parseRule($rawoffset, $savings, + $rule->[1]); + $rule = [ $endrule, $startrule, $savings ]; +# print "start",@{$rule->[1]}, "end", @{$rule->[0]}, +# "offset", $rule->[2],"\n"; + } + } + my $alias = findAlias($rawoffset, $rule); + if ($alias) { + if (($alias->[0] =~ /\//) + && ($timezonename !~ /\//)) { + # alias is of Country/City form, timezonename not + # make timezonename the real zone name + $alias->[0] = $timezonename; + } + push @{$alias->[3]}, $timezonename; + } else { + push @timezones, [ $timezonename, $rawoffset, $rule, + [ $timezonename ] ]; + } + $in_time_zone = 0; + } + } + } + close INPUT; +} + +@timezones = sort { if ($a->[1] != $b->[1]) { $a->[1] <=> $b->[1] } + else { $a->[0] cmp $b->[0] } } @timezones; +for (@timezones) { + my ($name, $rawoffset, $rule, $aliaslist) = @{$_}; + my @aliases = sort { tzcompare($a, $b); } @{$aliaslist}; + $name = $aliases[0]; + $rawoffset = makePretty($rawoffset); + if ($rule eq "-") { + print <[0]}; + my ($startmonth, $startday, $starttime) = @{$rule->[1]}; + $endtime = makePretty($endtime); + $starttime = makePretty($starttime); + my $savings = $rule->[2]; + if ($savings == 3600 * 1000) { + print < +# +# usage: unicode-blocks.pl +# where is obtained from www.unicode.org (named Blocks-3.txt +# for Unicode version 3.0.0). + + +die "Usage: $0 " unless @ARGV == 1; +open (BLOCKS, $ARGV[0]) || die "Can't open Unicode block file: $!\n"; + +# A hash of added fields and the JDK they were added in, to automatically +# print @since tags. Maintaining this is optional (and tedious), but nice. +my %additions = ("SYRIAC" => "1.4", + "THAANA" => "1.4", + "SINHALA" => "1.4", + "MYANMAR" => "1.4", + "ETHIOPIC" => "1.4", + "CHEROKEE" => "1.4", + "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS" => "1.4", + "OGHAM" => "1.4", + "RUNIC" => "1.4", + "KHMER" => "1.4", + "MONGOLIAN" => "1.4", + "BRAILLE_PATTERNS" => "1.4", + "CJK_RADICALS_SUPPLEMENT" => "1.4", + "KANGXI_RADICALS" => "1.4", + "IDEOGRAPHIC_DESCRIPTION_CHARACTERS" => "1.4", + "BOPOMOFO_EXTENDED" => "1.4", + "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A" => "1.4", + "YI_SYLLABLES" => "1.4", + "YI_RADICALS" => "1.4", + ); + +print <<'EOF'; + /** + * A family of character subsets in the Unicode specification. A character + * is in at most one of these blocks. + * + * This inner class was generated automatically from + * $ARGV[0], by some perl scripts. + * This Unicode definition file can be found on the + * http://www.unicode.org website. + * JDK 1.4 uses Unicode version 3.0.0. + * + * @author scripts/unicode-blocks.pl (written by Eric Blake) + * @since 1.2 + */ + public static final class UnicodeBlock extends Subset + { + /** The start of the subset. */ + private final char start; + + /** The end of the subset. */ + private final char end; + + /** + * Constructor for strictly defined blocks. + * + * @param start the start character of the range + * @param end the end character of the range + * @param name the block name + */ + private UnicodeBlock(char start, char end, String name) + { + super(name); + this.start = start; + this.end = end; + } + + /** + * Returns the Unicode character block which a character belongs to. + * + * @param ch the character to look up + * @return the set it belongs to, or null if it is not in one + */ + public static UnicodeBlock of(char ch) + { + // Special case, since SPECIALS contains two ranges. + if (ch == '\uFEFF') + return SPECIALS; + // Simple binary search for the correct block. + int low = 0; + int hi = sets.length - 1; + while (low <= hi) + { + int mid = (low + hi) >> 1; + UnicodeBlock b = sets[mid]; + if (ch < b.start) + hi = mid - 1; + else if (ch > b.end) + low = mid + 1; + else + return b; + } + return null; + } +EOF + +my $seenSpecials = 0; +my $seenSurrogates = 0; +my $surrogateStart = 0; +my @names = (); +while () { + next if /^\#/; + my ($start, $end, $block) = split(/; /); + next unless defined $block; + chomp $block; + $block =~ s/ *$//; + if (! $seenSpecials and $block =~ /Specials/) { + # Special case SPECIALS, since it is two disjoint ranges + $seenSpecials = 1; + next; + } + if ($block =~ /Surrogates/) { + # Special case SURROGATES_AREA, since it one range, not three + # consecutive, in Java + $seenSurrogates++; + if ($seenSurrogates == 1) { + $surrogateStart = $start; + next; + } elsif ($seenSurrogates == 2) { + next; + } else { + $start = $surrogateStart; + $block = "Surrogates Area"; + } + } + # Special case the name of PRIVATE_USE_AREA. + $block =~ s/(Private Use)/$1 Area/; + + (my $name = $block) =~ tr/a-z -/A-Z__/; + push @names, $name; + my $since = (defined $additions{$name} + ? "\n * \@since $additions{$name}" : ""); + my $extra = ($block =~ /Specials/ ? "'\\uFEFF', " : ""); + print < +# +# Usage: ./unicode-muncher +# where and are .txt files obtained from +# www.unicode.org (named UnicodeData-3.0.0.txt and SpecialCasing-2.txt for +# Unicode version 3.0.0), and is the final location for the +# Java interface gnu.java.lang.CharData. +# As of JDK 1.4, use Unicode version 3.0.0 for best results. + +## +## Convert a 16-bit integer to a Java source code String literal character +## +sub javaChar($) { + my ($char) = @_; + die "Out of range: $char\n" if $char < -0x8000 or $char > 0xffff; + $char += 0x10000 if $char < 0; + # Special case characters that must be escaped, or are shorter as ASCII + return sprintf("\\%03o", $char) if $char < 0x20; + return "\\\"" if $char == 0x22; + return "\\\\" if $char == 0x5c; + return pack("C", $char) if $char < 0x7f; + return sprintf("\\u%04x", $char); +} + +## +## Convert the text UnicodeData file from www.unicode.org into a Java +## interface with string constants holding the compressed information. +## +my @TYPECODES = qw(Cn Lu Ll Lt Lm Lo Mn Me Mc Nd Nl No Zs Zl Zp Cc Cf + SKIPPED Co Cs Pd Ps Pe Pc Po Sm Sc Sk So Pi Pf); +my @DIRCODES = qw(L R AL EN ES ET AN CS NSM BN B S WS ON LRE LRO RLE RLO PDF); + +my $NOBREAK_FLAG = 32; +my $MIRRORED_FLAG = 64; + +my %special = (); +my @info = (); +my $titlecase = ""; +my $count = 0; +my $range = 0; + +die "Usage: $0 " + unless @ARGV == 3; +$| = 1; +print "GNU Classpath Unicode Attribute Database Generator 2.1\n"; +print "Copyright (C) 1998, 2002 Free Software Foundation, Inc.\n"; + +# Stage 0: Parse the special casing file +print "Parsing special casing file\n"; +open (SPECIAL, "< $ARGV[1]") || die "Can't open special casing file: $!\n"; +while () { + next if /^\#/; + my ($ch, undef, undef, $upper) = split / *; */; + + # This grabs only the special casing for multi-char uppercase. Note that + # there are no multi-char lowercase, and that Sun ignores multi-char + # titlecase rules. This script omits 3 special cases in Unicode 3.0.0, + # which must be hardcoded in java.lang.String: + # \u03a3 (Sun ignores this special case) + # \u0049 - lowercases to \u0131, but only in Turkish locale + # \u0069 - uppercases to \u0130, but only in Turkish locale + next unless defined $upper and $upper =~ / /; + $special{hex $ch} = [map {hex} split ' ', $upper]; +} + +close SPECIAL; + +# Stage 1: Parse the attribute file +print "Parsing attributes file"; +open (UNICODE, "< $ARGV[0]") || die "Can't open Unicode attribute file: $!\n"; +while () { + print "." unless $count++ % 1000; + chomp; + s/\r//g; + my ($ch, $name, $category, undef, $bidir, $decomp, undef, undef, $numeric, + $mirrored, undef, undef, $upcase, $lowcase, $title) = split ';'; + $ch = hex($ch); + next if $ch > 0xffff; # Ignore surrogate pairs, since Java does + + my ($type, $numValue, $upperchar, $lowerchar, $direction); + + $type = 0; + while ($category !~ /^$TYPECODES[$type]$/) { + if (++$type == @TYPECODES) { + die "$ch: Unknown type: $category"; + } + } + $type |= $NOBREAK_FLAG if ($decomp =~ /noBreak/); + $type |= $MIRRORED_FLAG if ($mirrored =~ /Y/); + + if ($numeric =~ /^[0-9]+$/) { + $numValue = $numeric; + die "numValue too big: $ch, $numValue\n" if $numValue >= 0x7fff; + } elsif ($numeric eq "") { + # Special case sequences of 'a'-'z' + if ($ch >= 0x0041 && $ch <= 0x005a) { + $numValue = $ch - 0x0037; + } elsif ($ch >= 0x0061 && $ch <= 0x007a) { + $numValue = $ch - 0x0057; + } elsif ($ch >= 0xff21 && $ch <= 0xff3a) { + $numValue = $ch - 0xff17; + } elsif ($ch >= 0xff41 && $ch <= 0xff5a) { + $numValue = $ch - 0xff37; + } else { + $numValue = -1; + } + } else { + $numValue = -2; + } + + $upperchar = $upcase ? hex($upcase) - $ch : 0; + $lowerchar = $lowcase ? hex($lowcase) - $ch : 0; + if ($title ne $upcase) { + my $titlechar = $title ? hex($title) : $ch; + $titlecase .= pack("n2", $ch, $titlechar); + } + + $direction = 0; + while ($bidir !~ /^$DIRCODES[$direction]$/) { + if (++$direction == @DIRCODES) { + $direction = -1; + last; + } + } + $direction <<= 2; + $direction += $#{$special{$ch}} if defined $special{$ch}; + + if ($range) { + die "Expecting end of range at $ch\n" unless $name =~ /Last>$/; + for ($range + 1 .. $ch - 1) { + $info[$_] = pack("n5", $type, $numValue, $upperchar, + $lowerchar, $direction); + } + $range = 0; + } elsif ($name =~ /First>$/) { + $range = $ch; + } + $info[$ch] = pack("n5", $type, $numValue, $upperchar, $lowerchar, + $direction); +} +close UNICODE; + +# Stage 2: Compress the data structures +printf "\nCompressing data structures"; +$count = 0; +my $info = (); +my %charhash = (); +my @charinfo = (); + +for my $ch (0 .. 0xffff) { + print "." unless $count++ % 0x1000; + $info[$ch] = pack("n5", 0, -1, 0, 0, -4) unless defined $info[$ch]; + + my ($type, $numVal, $upper, $lower, $direction) = unpack("n5", $info[$ch]); + if (! exists $charhash{$info[$ch]}) { + push @charinfo, [ $numVal, $upper, $lower, $direction ]; + $charhash{$info[$ch]} = $#charinfo; + } + $info .= pack("n", ($charhash{$info[$ch]} << 7) | $type); +} + +my $charlen = @charinfo; +my $bestshift; +my $bestest = 1000000; +my $bestblkstr; +die "Too many unique character entries: $charlen\n" if $charlen > 512; +print "\nUnique character entries: $charlen\n"; + +for my $i (3 .. 8) { + my $blksize = 1 << $i; + my %blocks = (); + my @blkarray = (); + my ($j, $k); + print "shift: $i"; + + for ($j = 0; $j < 0x10000; $j += $blksize) { + my $blkkey = substr $info, 2 * $j, 2 * $blksize; + if (! exists $blocks{$blkkey}) { + push @blkarray, $blkkey; + $blocks{$blkkey} = $#blkarray; + } + } + my $blknum = @blkarray; + my $blocklen = $blknum * $blksize; + printf " before %5d", $blocklen; + + # Now we try to pack the blkarray as tight as possible by finding matching + # heads and tails. + for ($j = $blksize - 1; $j > 0; $j--) { + my %tails = (); + for $k (0 .. $#blkarray) { + next unless defined $blkarray[$k]; + my $len = length $blkarray[$k]; + my $tail = substr $blkarray[$k], $len - $j * 2; + if (exists $tails{$tail}) { + push @{$tails{$tail}}, $k; + } else { + $tails{$tail} = [ $k ]; + } + } + + # tails are calculated, now calculate the heads and merge. + BLOCK: + for $k (0 .. $#blkarray) { + next unless defined $blkarray[$k]; + my $tomerge = $k; + while (1) { + my $head = substr($blkarray[$tomerge], 0, $j * 2); + my $entry = $tails{$head}; + next BLOCK unless defined $entry; + + my $other = shift @{$entry}; + if ($other == $tomerge) { + if (@{$entry}) { + push @{$entry}, $other; + $other = shift @{$entry}; + } else { + push @{$entry}, $other; + next BLOCK; + } + } + if (@{$entry} == 0) { + delete $tails{$head}; + } + + # a match was found + my $merge = $blkarray[$other] + . substr($blkarray[$tomerge], $j * 2); + $blocklen -= $j; + $blknum--; + + if ($other < $tomerge) { + $blkarray[$tomerge] = undef; + $blkarray[$other] = $merge; + my $len = length $merge; + my $tail = substr $merge, $len - $j * 2; + $tails{$tail} = [ map { $_ == $tomerge ? $other : $_ } + @{$tails{$tail}} ]; + next BLOCK; + } + $blkarray[$tomerge] = $merge; + $blkarray[$other] = undef; + } + } + } + my $blockstr; + for $k (0 .. $#blkarray) { + $blockstr .= $blkarray[$k] if defined $blkarray[$k]; + } + + die "Unexpected $blocklen" if length($blockstr) != 2 * $blocklen; + my $estimate = 2 * $blocklen + (0x20000 >> $i); + + printf " after merge %5d: %6d bytes\n", $blocklen, $estimate; + if ($estimate < $bestest) { + $bestest = $estimate; + $bestshift = $i; + $bestblkstr = $blockstr; + } +} + +my @blocks; +my $blksize = 1 << $bestshift; +for (my $j = 0; $j < 0x10000; $j += $blksize) { + my $blkkey = substr $info, 2 * $j, 2 * $blksize; + my $index = index $bestblkstr, $blkkey; + while ($index & 1) { + die "not found: $j" if $index == -1; + $index = index $bestblkstr, $blkkey, $index + 1; + } + push @blocks, ($index / 2 - $j) & 0xffff; +} + +# Phase 3: Generate the file +die "UTF-8 limit of blocks may be exceeded: " . scalar(@blocks) . "\n" + if @blocks > 0xffff / 3; +die "UTF-8 limit of data may be exceeded: " . length($bestblkstr) . "\n" + if length($bestblkstr) > 0xffff / 3; +{ + print "Generating $ARGV[2] with shift of $bestshift"; + my ($i, $j); + + open OUTPUT, "> $ARGV[2]" or die "Failed creating output file: $!\n"; + print OUTPUT <$ARGV[0] and + * $ARGV[1], by some + * perl scripts. These Unicode definition files can be found on the + * http://www.unicode.org website. + * JDK 1.4 uses Unicode version 3.0.0. + * + * The data is stored as string constants, but Character will convert these + * Strings to their respective char[] components. The field + * BLOCKS stores the offset of a block of 2SHIFT + * characters within DATA. The DATA field, in turn, stores + * information about each character in the low order bits, and an offset + * into the attribute tables UPPER, LOWER, + * NUM_VALUE, and DIRECTION. Notice that the + * attribute tables are much smaller than 0xffff entries; as many characters + * in Unicode share common attributes. The DIRECTION table also contains + * a field for detecting characters with multi-character uppercase expansions. + * Next, there is a listing for TITLE exceptions (most characters + * just have the same title case as upper case). Finally, there are two + * tables for multi-character capitalization, UPPER_SPECIAL + * which lists the characters which are special cased, and + * UPPER_EXPAND, which lists their expansion. + * + * \@author scripts/unicode-muncher.pl (written by Jochen Hoenicke, + * Eric Blake) + * \@see Character + * \@see String + */ +public interface CharData +{ + /** + * The Unicode definition file that was parsed to build this database. + */ + String SOURCE = \"$ARGV[0]\"; + + /** + * The character shift amount to look up the block offset. In other words, + * (char) (BLOCKS.value[ch >> SHIFT] + ch) is the index where + * ch is described in DATA. + */ + int SHIFT = $bestshift; + + /** + * The mapping of character blocks to their location in DATA. + * Each entry has been adjusted so that the 16-bit sum with the desired + * character gives the actual index into DATA. + */ + String BLOCKS +EOF + + for ($i = 0; $i < @blocks / 11; $i++) { + print OUTPUT $i ? "\n + \"" : " = \""; + for $j (0 .. 10) { + last if @blocks <= $i * 11 + $j; + my $val = $blocks[$i * 11 + $j]; + print OUTPUT javaChar($val); + } + print OUTPUT "\""; + } + + print OUTPUT <UPPER to determine their titlecase). The listing + * is a sorted sequence of character pairs; converting the first character + * of the pair to titlecase produces the second character. + */ + String TITLE +EOF + + $len = length($titlecase) / 2; + for ($i = 0; $i < $len / 11; $i++) { + print OUTPUT $i ? "\n + \"" : " = \""; + for $j (0 .. 10) { + last if $len <= $i * 11 + $j; + my $val = unpack "n", substr($titlecase, 2 * ($i * 11 + $j), 2); + print OUTPUT javaChar($val); + } + print OUTPUT "\""; + } + + print OUTPUT < $b} keys %special; + my $expansion = ""; + my $offset = 0; + $len = @list; + for ($i = 0; $i < $len / 5; $i++) { + print OUTPUT $i ? "\n + \"" : " = \""; + for $j (0 .. 4) { + last if $len <= $i * 5 + $j; + my $ch = $list[$i * 5 + $j]; + print OUTPUT javaChar($ch); + print OUTPUT javaChar($offset); + $offset += @{$special{$ch}}; + $expansion .= pack "n*", @{$special{$ch}}; + } + print OUTPUT "\""; + } + + print OUTPUT <