aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorno-author <no-author@gcc.gnu.org>2003-07-21 13:54:25 +0000
committerno-author <no-author@gcc.gnu.org>2003-07-21 13:54:25 +0000
commit0a8ffdd9b53d023358a4d9728acb0dcf889b4cb4 (patch)
tree8a26bd67266a4b9cbe2d9c7384d4273f451972ed /libjava
parent98310d8b7f0e8cacf570435147c418c462ebe34d (diff)
This commit was manufactured by cvs2svn to create branch
'tree-ssa-20020619-branch'. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@69630 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/glib-2.0.m4212
-rw-r--r--libjava/gnu/java/awt/EmbeddedWindow.java62
-rw-r--r--libjava/gnu/java/awt/EmbeddedWindowSupport.java67
-rw-r--r--libjava/gnu/java/awt/natEmbeddedWindow.cc16
-rw-r--r--libjava/gtk-2.0.m4196
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java277
-rw-r--r--libjava/java/nio/channels/FileChannelImpl.java392
-rw-r--r--libjava/java/nio/channels/natFileChannelImpl.cc94
-rw-r--r--libjava/java/util/logging/Handler.java390
-rw-r--r--libjava/libgcj.pc.in10
-rw-r--r--libjava/testsuite/libjava.verify/README.verify10
-rw-r--r--libjava/testsuite/libjava.verify/verify.exp83
12 files changed, 1809 insertions, 0 deletions
diff --git a/libjava/glib-2.0.m4 b/libjava/glib-2.0.m4
new file mode 100644
index 00000000000..28ccef4a5f6
--- /dev/null
+++ b/libjava/glib-2.0.m4
@@ -0,0 +1,212 @@
+# Configure paths for GLIB
+# Owen Taylor 1997-2001
+
+dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
+dnl gthread is specified in MODULES, pass to pkg-config
+dnl
+AC_DEFUN(AM_PATH_GLIB_2_0,
+[dnl
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
+ , enable_glibtest=yes)
+
+ pkg_config_args=glib-2.0
+ for module in . $4
+ do
+ case "$module" in
+ gmodule)
+ pkg_config_args="$pkg_config_args gmodule-2.0"
+ ;;
+ gobject)
+ pkg_config_args="$pkg_config_args gobject-2.0"
+ ;;
+ gthread)
+ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ esac
+ done
+
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ no_glib=""
+
+ if test x$PKG_CONFIG != xno ; then
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_glib=yes
+ PKG_CONFIG=no
+ fi
+ else
+ no_glib=yes
+ fi
+
+ min_glib_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+ enable_glibtest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+ :
+ else
+ no_glib=yes
+ fi
+ fi
+
+ if test x"$no_glib" = x ; then
+ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+
+ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_glibtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$GLIB_LIBS $LIBS"
+dnl
+dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+ rm -f conf.glibtest
+ AC_TRY_RUN([
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.glibtest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = g_strdup("$min_glib_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_glib_version");
+ exit(1);
+ }
+
+ if ((glib_major_version != $glib_config_major_version) ||
+ (glib_minor_version != $glib_config_minor_version) ||
+ (glib_micro_version != $glib_config_micro_version))
+ {
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
+ }
+ else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+ (glib_minor_version != GLIB_MINOR_VERSION) ||
+ (glib_micro_version != GLIB_MICRO_VERSION))
+ {
+ printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+ GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+ printf("*** library (version %d.%d.%d)\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ }
+ else
+ {
+ if ((glib_major_version > major) ||
+ ((glib_major_version == major) && (glib_minor_version > minor)) ||
+ ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+ major, minor, micro);
+ printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+ printf("***\n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+ }
+ return 1;
+}
+],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_glib" = x ; then
+ AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ else
+ if test -f conf.glibtest ; then
+ :
+ else
+ echo "*** Could not run GLIB test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$LIBS $GLIB_LIBS"
+ AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+ echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GLIB_CFLAGS=""
+ GLIB_LIBS=""
+ GLIB_GENMARSHAL=""
+ GOBJECT_QUERY=""
+ GLIB_MKENUMS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+ AC_SUBST(GLIB_GENMARSHAL)
+ AC_SUBST(GOBJECT_QUERY)
+ AC_SUBST(GLIB_MKENUMS)
+ rm -f conf.glibtest
+])
diff --git a/libjava/gnu/java/awt/EmbeddedWindow.java b/libjava/gnu/java/awt/EmbeddedWindow.java
new file mode 100644
index 00000000000..607cc38518c
--- /dev/null
+++ b/libjava/gnu/java/awt/EmbeddedWindow.java
@@ -0,0 +1,62 @@
+/* EmbeddedWindow.java --
+ Copyright (C) 2003 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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. */
+
+
+package gnu.java.awt;
+
+import java.awt.Window;
+
+/**
+ * This class represents an AWT window embedded into another graphical
+ * toolkit or anther application.
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ */
+public class EmbeddedWindow extends Window
+{
+ /**
+ * Creates an window embedded into another application of graphical toolkit.
+ *
+ * @param window_id The native handle to the screen area where the AWT window
+ * should be embedded.
+ * @param width The width of the screen area.
+ * @param height The height of the screen area.
+ */
+ // This method is only made native to circumvent the package-privateness of
+ // an internal java.awt.Window constructor.
+ public static native Window create (int window_id, int width, int height);
+}
diff --git a/libjava/gnu/java/awt/EmbeddedWindowSupport.java b/libjava/gnu/java/awt/EmbeddedWindowSupport.java
new file mode 100644
index 00000000000..b29db278197
--- /dev/null
+++ b/libjava/gnu/java/awt/EmbeddedWindowSupport.java
@@ -0,0 +1,67 @@
+/* EmbeddedWindowSupport.java --
+ Copyright (C) 2003 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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. */
+
+
+package gnu.java.awt;
+
+import java.awt.peer.WindowPeer;
+
+/**
+ * This interface defines a method for creating embedded windows.
+ *
+ * All classes inherited from java.awt.Toolkit that implement this interface
+ * are assumed to support embedded windows. To embed the real embedded window
+ * you need to use gnu.java.awt.EmbeddedWindow.
+ *
+ * @see gnu.java.awt.EmbeddedWindow
+ * @see java.awt.Toolkit
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ */
+public interface EmbeddedWindowSupport
+{
+ /**
+ * This method creates an embedded window in an application.
+ *
+ * @param window_id The native handle of a screen area to display an
+ * AWT window in it.
+ * @param width The width of the screen area.
+ * @param height The height of the screen area.
+ */
+ public WindowPeer createEmbeddedWindow (int window_id,
+ int width, int height);
+}
diff --git a/libjava/gnu/java/awt/natEmbeddedWindow.cc b/libjava/gnu/java/awt/natEmbeddedWindow.cc
new file mode 100644
index 00000000000..0811d415482
--- /dev/null
+++ b/libjava/gnu/java/awt/natEmbeddedWindow.cc
@@ -0,0 +1,16 @@
+/* Copyright (C) 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <gnu/java/awt/EmbeddedWindow.h>
+#include <java/awt/Window.h>
+
+::java::awt::Window*
+gnu::java::awt::EmbeddedWindow::create (jint window_id, jint width, jint height)
+{
+ return new ::java::awt::Window (window_id, width, height);
+}
diff --git a/libjava/gtk-2.0.m4 b/libjava/gtk-2.0.m4
new file mode 100644
index 00000000000..a0c53ac11ff
--- /dev/null
+++ b/libjava/gtk-2.0.m4
@@ -0,0 +1,196 @@
+# Configure paths for GTK+
+# Owen Taylor 1997-2001
+
+dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
+dnl pass to pkg-config
+dnl
+AC_DEFUN(AM_PATH_GTK_2_0,
+[dnl
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
+ , enable_gtktest=yes)
+
+ pkg_config_args=gtk+-2.0
+ for module in . $4
+ do
+ case "$module" in
+ gthread)
+ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ esac
+ done
+
+ no_gtk=""
+
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ if test x$PKG_CONFIG != xno ; then
+ if pkg-config --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_gtk=yes
+ PKG_CONFIG=no
+ fi
+ else
+ no_gtk=yes
+ fi
+
+ min_gtk_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
+ enable_gtktest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
+ :
+ else
+ no_gtk=yes
+ fi
+ fi
+
+ if test x"$no_gtk" = x ; then
+ GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+ GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+ gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_gtktest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GTK_CFLAGS"
+ LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+ rm -f conf.gtktest
+ AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.gtktest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = g_strdup("$min_gtk_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_gtk_version");
+ exit(1);
+ }
+
+ if ((gtk_major_version != $gtk_config_major_version) ||
+ (gtk_minor_version != $gtk_config_minor_version) ||
+ (gtk_micro_version != $gtk_config_micro_version))
+ {
+ printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+ $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+ gtk_major_version, gtk_minor_version, gtk_micro_version);
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
+ }
+ else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+ (gtk_minor_version != GTK_MINOR_VERSION) ||
+ (gtk_micro_version != GTK_MICRO_VERSION))
+ {
+ printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+ GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+ printf("*** library (version %d.%d.%d)\n",
+ gtk_major_version, gtk_minor_version, gtk_micro_version);
+ }
+ else
+ {
+ if ((gtk_major_version > major) ||
+ ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+ ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+ gtk_major_version, gtk_minor_version, gtk_micro_version);
+ printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+ major, minor, micro);
+ printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+ printf("***\n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+ printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+ }
+ return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_gtk" = x ; then
+ AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://pkgconfig.sourceforge.net"
+ else
+ if test -f conf.gtktest ; then
+ :
+ else
+ echo "*** Could not run GTK+ test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GTK_CFLAGS"
+ LIBS="$LIBS $GTK_LIBS"
+ AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
+ echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GTK_CFLAGS=""
+ GTK_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+ rm -f conf.gtktest
+])
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
new file mode 100644
index 00000000000..f28f1137535
--- /dev/null
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -0,0 +1,277 @@
+/* MappedByteBufferImpl.java --
+ Copyright (C) 2002, 2003 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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. */
+
+
+package java.nio;
+
+import java.io.IOException;
+import java.nio.channels.FileChannelImpl;
+import gnu.gcj.RawData;
+
+public class MappedByteBufferImpl extends MappedByteBuffer
+{
+ boolean readOnly;
+ RawData map_address;
+ public FileChannelImpl ch;
+
+ public MappedByteBufferImpl (FileChannelImpl ch) throws IOException
+ {
+ super ((int) ch.size (), (int) ch.size (), 0, -1);
+
+ this.ch = ch;
+ map_address = ch.map_address;
+ long si = ch.size () / 1;
+ limit ((int) si);
+ }
+
+ public boolean isReadOnly ()
+ {
+ return readOnly;
+ }
+
+ public static byte getImpl (FileChannelImpl ch, int index,
+ int limit, RawData map_address)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public static void putImpl (FileChannelImpl ch, int index,
+ int limit, byte value, RawData map_address)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public byte get ()
+ {
+ byte result = get (position());
+ position (position() + 1);
+ return result;
+ }
+
+ public ByteBuffer put (byte value)
+ {
+ put (position(), value);
+ position (position() + 1);
+ return this;
+ }
+
+ public byte get (int index)
+ {
+ return getImpl (ch, index, limit (), map_address);
+ }
+
+ public ByteBuffer put (int index, byte value)
+ {
+ putImpl (ch, index, limit (), value, map_address);
+ return this;
+ }
+
+ public ByteBuffer compact ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public boolean isDirect ()
+ {
+ return true;
+ }
+
+ public ByteBuffer slice ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer duplicate ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer asReadOnlyBuffer ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public CharBuffer asCharBuffer ()
+ {
+ return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ }
+
+ public ShortBuffer asShortBuffer ()
+ {
+ return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ }
+
+ public IntBuffer asIntBuffer ()
+ {
+ return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ }
+
+ public LongBuffer asLongBuffer ()
+ {
+ return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ }
+
+ public FloatBuffer asFloatBuffer ()
+ {
+ return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ }
+
+ public DoubleBuffer asDoubleBuffer ()
+ {
+ return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ }
+
+ public char getChar ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public char getChar (int index)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putChar (char value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putChar (int index, char value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public double getDouble ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public double getDouble (int index)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putDouble (double value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putDouble (int index, double value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public float getFloat ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public float getFloat (int index)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putFloat (float value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putFloat (int index, float value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public int getInt ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public int getInt (int index)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putInt (int value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putInt (int index, int value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public long getLong ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public long getLong (int index)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putLong (long value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putLong (int index, long value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public short getShort ()
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public short getShort (int index)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putShort (short value)
+ {
+ throw new Error ("Not implemented");
+ }
+
+ public ByteBuffer putShort (int index, short value)
+ {
+ throw new Error ("Not implemented");
+ }
+}
diff --git a/libjava/java/nio/channels/FileChannelImpl.java b/libjava/java/nio/channels/FileChannelImpl.java
new file mode 100644
index 00000000000..9d610551a37
--- /dev/null
+++ b/libjava/java/nio/channels/FileChannelImpl.java
@@ -0,0 +1,392 @@
+/* FileChannelImpl.java --
+ Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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. */
+
+
+package java.nio.channels;
+
+import java.io.EOFException;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.MappedByteBufferImpl;
+import gnu.gcj.RawData;
+
+/**
+ * This file is not user visible !
+ * But alas, Java does not have a concept of friendly packages
+ * so this class is public.
+ * Instances of this class are created by invoking getChannel
+ * Upon a Input/Output/RandomAccessFile object.
+ */
+
+public class FileChannelImpl extends FileChannel
+{
+ public RawData map_address;
+
+ int length;
+ FileDescriptor fd;
+ MappedByteBuffer buf;
+ Object file_obj; // just to keep it live...
+
+ public FileChannelImpl (FileDescriptor fd, boolean write, Object obj)
+ {
+ if (!(obj instanceof RandomAccessFile)
+ && !(obj instanceof FileInputStream)
+ && !(obj instanceof FileOutputStream))
+ throw new InternalError ();
+
+ this.fd = fd;
+ this.file_obj = obj;
+ }
+
+ public FileChannelImpl ()
+ {
+ this (new FileDescriptor (), true, null);
+ }
+
+ private native long implPosition ();
+ private native FileChannel implPosition (long newPosition);
+ private native FileChannel implTruncate (long size);
+
+ private native RawData nio_mmap_file (long pos, long size, int mode);
+ private native void nio_unmmap_file (RawData map_address, int size);
+ private native void nio_msync (RawData map_address, int length);
+
+ public native long size () throws IOException;
+
+ protected void implCloseChannel() throws IOException
+ {
+ if (map_address != null)
+ {
+ nio_unmmap_file (map_address, (int) length);
+ map_address = null;
+ }
+
+ if (file_obj instanceof RandomAccessFile)
+ {
+ RandomAccessFile o = (RandomAccessFile) file_obj;
+ o.close();
+ }
+ else if (file_obj instanceof FileInputStream)
+ {
+ FileInputStream o = (FileInputStream) file_obj;
+ o.close();
+ }
+ else if (file_obj instanceof FileOutputStream)
+ {
+ FileOutputStream o = (FileOutputStream) file_obj;
+ o.close();
+ }
+ }
+
+ public int read (ByteBuffer dst) throws IOException
+ {
+ // Check if file is mapped into memory.
+ if (buf != null)
+ {
+ // FIXME: implement this
+ throw new Error ("Accessing mapped buffers not implemented.");
+ }
+
+ // File not mapped, access it directly.
+ return implRead (dst);
+ }
+
+ public int read (ByteBuffer dst, long position)
+ throws IOException
+ {
+ if (position < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ if (file_obj instanceof FileOutputStream)
+ throw new NonReadableChannelException ();
+
+ int result;
+ long oldPosition;
+
+ oldPosition = implPosition ();
+ result = implRead (dst);
+ implPosition (oldPosition);
+
+ return result;
+ }
+
+ private int implRead (ByteBuffer dst) throws IOException
+ {
+ int result;
+ byte[] buffer = new byte [dst.remaining ()];
+
+ result = implRead (buffer, 0, buffer.length);
+ dst.put (buffer, 0, result);
+
+ return result;
+ }
+
+ private native int implRead (byte[] buffer, int offset, int length)
+ throws IOException;
+
+ public long read (ByteBuffer[] dsts, int offset, int length)
+ throws IOException
+ {
+ long result = 0;
+
+ for (int i = offset; i < offset + length; i++)
+ {
+ result += read (dsts [i]);
+ }
+
+ return result;
+ }
+
+ public int write (ByteBuffer src) throws IOException
+ {
+ // Check if file is mapped into memory.
+ if (buf != null)
+ {
+ // FIXME: implement this
+ throw new Error ("Accessing mapped buffers not implemented.");
+ }
+
+ // File not mapped, access it directly.
+ return implWrite (src);
+ }
+
+ public int write (ByteBuffer src, long position)
+ throws IOException
+ {
+ if (position < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ if (file_obj instanceof FileInputStream)
+ throw new NonWritableChannelException ();
+
+ int result;
+ long oldPosition;
+
+ oldPosition = implPosition ();
+ result = implWrite (src);
+ implPosition (oldPosition);
+
+ return result;
+ }
+
+ private int implWrite (ByteBuffer src) throws IOException
+ {
+ byte[] buffer = new byte [src.remaining ()];
+
+ src.get (buffer, 0, buffer.length);
+ return implWrite (buffer, 0, buffer.length);
+ }
+
+ private native int implWrite (byte[] buffer, int offset, int length)
+ throws IOException;
+
+ public long write(ByteBuffer[] srcs, int offset, int length)
+ throws IOException
+ {
+ long result = 0;
+
+ for (int i = offset;i < offset + length;i++)
+ {
+ result += write (srcs[i]);
+ }
+
+ return result;
+ }
+
+ public MappedByteBuffer map (FileChannel.MapMode mode, long position,
+ long size)
+ throws IOException
+ {
+ if ((mode != MapMode.READ_ONLY
+ && mode != MapMode.READ_WRITE
+ && mode != MapMode.PRIVATE)
+ || position < 0
+ || size < 0
+ || size > Integer.MAX_VALUE)
+ throw new IllegalArgumentException ();
+
+ // FIXME: Make this working.
+ int cmode = mode.m;
+ map_address = nio_mmap_file (position, size, cmode);
+ length = (int) size;
+ buf = new MappedByteBufferImpl (this);
+ return buf;
+ }
+
+ static MappedByteBuffer create_direct_mapped_buffer (RawData map_address,
+ long length)
+ throws IOException
+ {
+ FileChannelImpl ch = new FileChannelImpl ();
+ ch.map_address = map_address;
+ ch.length = (int) length;
+ ch.buf = new MappedByteBufferImpl (ch);
+ return ch.buf;
+ }
+
+ /**
+ * msync with the disk
+ */
+ public void force (boolean metaData) throws IOException
+ {
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ // FIXME: What to do with metaData ?
+
+ nio_msync (map_address, length);
+ }
+
+ public long transferTo (long position, long count, WritableByteChannel target)
+ throws IOException
+ {
+ if (position < 0
+ || count < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ if (file_obj instanceof FileOutputStream)
+ throw new NonReadableChannelException ();
+
+ // XXX: count needs to be casted from long to int. Dataloss ?
+ ByteBuffer buffer = ByteBuffer.allocate ((int) count);
+ read (buffer, position);
+ return target.write (buffer);
+ }
+
+ public long transferFrom (ReadableByteChannel src, long position, long count)
+ throws IOException
+ {
+ if (position < 0
+ || count < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ if (file_obj instanceof FileInputStream)
+ throw new NonWritableChannelException ();
+
+ // XXX: count needs to be casted from long to int. Dataloss ?
+ ByteBuffer buffer = ByteBuffer.allocate ((int) count);
+ src.read (buffer);
+ return write (buffer, position);
+ }
+
+ public FileLock lock (long position, long size, boolean shared)
+ throws IOException
+ {
+ if (position < 0
+ || size < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ if (shared &&
+ file_obj instanceof FileOutputStream)
+ throw new NonReadableChannelException ();
+
+ if (!shared &&
+ file_obj instanceof FileInputStream)
+ throw new NonWritableChannelException ();
+
+ throw new Error ("Not implemented");
+ }
+
+ public FileLock tryLock (long position, long size, boolean shared)
+ throws IOException
+ {
+ if (position < 0
+ || size < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ throw new Error ("Not implemented");
+ }
+
+ public long position ()
+ throws IOException
+ {
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ return implPosition ();
+ }
+
+ public FileChannel position (long newPosition)
+ throws IOException
+ {
+ if (newPosition < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ return implPosition (newPosition);
+ }
+
+ public FileChannel truncate (long size)
+ throws IOException
+ {
+ if (size < 0)
+ throw new IllegalArgumentException ();
+
+ if (!isOpen ())
+ throw new ClosedChannelException ();
+
+ if (file_obj instanceof FileInputStream)
+ throw new NonWritableChannelException ();
+
+ return implTruncate (size);
+ }
+}
diff --git a/libjava/java/nio/channels/natFileChannelImpl.cc b/libjava/java/nio/channels/natFileChannelImpl.cc
new file mode 100644
index 00000000000..8dbbd141e60
--- /dev/null
+++ b/libjava/java/nio/channels/natFileChannelImpl.cc
@@ -0,0 +1,94 @@
+// natFileChannelImpl.cc
+
+/* Copyright (C) 2003 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+
+#include <jvm.h>
+
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include <gnu/gcj/RawData.h>
+#include <java/io/FileDescriptor.h>
+#include <java/io/IOException.h>
+#include <java/nio/ByteBuffer.h>
+#include <java/nio/channels/FileChannel.h>
+#include <java/nio/channels/FileChannelImpl.h>
+
+jlong
+java::nio::channels::FileChannelImpl::size ()
+{
+ return fd->getLength ();
+}
+
+jlong
+java::nio::channels::FileChannelImpl::implPosition ()
+{
+ return fd->getFilePointer ();
+}
+
+java::nio::channels::FileChannel*
+java::nio::channels::FileChannelImpl::implPosition (jlong newPosition)
+{
+ fd->seek (newPosition, ::java::io::FileDescriptor::SET, true);
+ return this;
+}
+
+jint
+java::nio::channels::FileChannelImpl::implRead (JArray<jbyte>* buffer,
+ jint offset, jint len)
+{
+ return fd->read (buffer, offset, len);
+}
+
+jint
+java::nio::channels::FileChannelImpl::implWrite (JArray<jbyte>* buffer,
+ jint offset, jint len)
+{
+ fd->write (buffer, offset, len);
+ return len;
+}
+
+java::nio::channels::FileChannel*
+java::nio::channels::FileChannelImpl::implTruncate (jlong size)
+{
+ fd->setLength (size);
+ return this;
+}
+
+gnu::gcj::RawData*
+java::nio::channels::FileChannelImpl::nio_mmap_file (jlong /*pos*/, jlong /*size*/,
+ jint /*mode*/)
+{
+ throw new ::java::io::IOException (JvNewStringUTF ("mmap not implemented"));
+}
+
+void
+java::nio::channels::FileChannelImpl::nio_unmmap_file (gnu::gcj::RawData* /*address*/,
+ jint /*size*/)
+{
+ throw new ::java::io::IOException (JvNewStringUTF ("munmap not implemented"));
+}
+
+void
+java::nio::channels::FileChannelImpl::nio_msync (gnu::gcj::RawData* /*map_address*/,
+ jint /*length*/)
+{
+ throw new ::java::io::IOException (JvNewStringUTF ("msync not implemented"));
+}
diff --git a/libjava/java/util/logging/Handler.java b/libjava/java/util/logging/Handler.java
new file mode 100644
index 00000000000..c0fb1cd653a
--- /dev/null
+++ b/libjava/java/util/logging/Handler.java
@@ -0,0 +1,390 @@
+/* Handler.java
+ -- a class for publishing log messages
+
+Copyright (C) 2002 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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.
+
+*/
+
+
+package java.util.logging;
+
+import java.io.UnsupportedEncodingException;
+import java.security.AccessController;
+
+/**
+ * A <code>Handler</code> publishes <code>LogRecords</code> to
+ * a sink, for example a file, the console or a network socket.
+ * There are different subclasses of <code>Handler</code>
+ * to deal with different kinds of sinks.
+ *
+ * <p>FIXME: Are handlers thread-safe, or is the assumption that only
+ * loggers are, and a handler can belong only to one single logger? If
+ * the latter, should we enforce it? (Spec not clear). In any
+ * case, it needs documentation.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public abstract class Handler
+{
+ Formatter formatter;
+ Filter filter;
+ Level level;
+ ErrorManager errorManager;
+ String encoding;
+
+ /**
+ * Constructs a Handler with a logging severity level of
+ * <code>Level.ALL</code>, no formatter, no filter, and
+ * an instance of <code>ErrorManager</code> managing errors.
+ *
+ * <p><strong>Specification Note:</strong> The specification of the
+ * Java<sup>TM</sup> Logging API does not mention which character
+ * encoding is to be used by freshly constructed Handlers. The GNU
+ * implementation uses the default platform encoding, but other
+ * Java implementations might behave differently.
+ *
+ * <p><strong>Specification Note:</strong> While a freshly constructed
+ * Handler is required to have <em>no filter</em> according to the
+ * specification, <code>null</code> is not a valid parameter for
+ * <code>Handler.setFormatter</code>. Therefore, the following
+ * code will throw a <code>java.lang.NullPointerException</code>:
+ *
+ * <p><pre>Handler h = new MyConcreteSubclassOfHandler();
+h.setFormatter(h.getFormatter());</pre>
+ *
+ * It seems strange that a freshly constructed Handler is not
+ * supposed to provide a Formatter, but this is what the specification
+ * says.
+ */
+ {
+ level = Level.ALL;
+ }
+
+
+ /**
+ * Publishes a <code>LogRecord</code> to an appropriate sink,
+ * provided the record passes all tests for being loggable. The
+ * <code>Handler</code> will localize the message of the log
+ * record and substitute any message parameters.
+ *
+ * <p>Most applications do not need to call this method directly.
+ * Instead, they will use use a {@link Logger}, which will
+ * create LogRecords and distribute them to registered handlers.
+ *
+ * <p>In case of an I/O failure, the <code>ErrorManager</code>
+ * of this <code>Handler</code> will be informed, but the caller
+ * of this method will not receive an exception.
+ *
+ * @param record the log event to be published.
+ */
+ public abstract void publish(LogRecord record);
+
+
+ /**
+ * Forces any data that may have been buffered to the underlying
+ * output device.
+ *
+ * <p>In case of an I/O failure, the <code>ErrorManager</code>
+ * of this <code>Handler</code> will be informed, but the caller
+ * of this method will not receive an exception.
+ */
+ public abstract void flush();
+
+
+ /**
+ * Closes this <code>Handler</code> after having flushed
+ * the buffers. As soon as <code>close</code> has been called,
+ * a <code>Handler</code> should not be used anymore. Attempts
+ * to publish log records, to flush buffers, or to modify the
+ * <code>Handler</code> in any other way may throw runtime
+ * exceptions after calling <code>close</code>.
+ *
+ * <p>In case of an I/O failure, the <code>ErrorManager</code>
+ * of this <code>Handler</code> will be informed, but the caller
+ * of this method will not receive an exception.
+ *
+ * @throws SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure.
+ */
+ public abstract void close()
+ throws SecurityException;
+
+
+ /**
+ * Returns the <code>Formatter</code> which will be used to
+ * localize the text of log messages and to substitute
+ * message parameters. A <code>Handler</code> is encouraged,
+ * but not required to actually use an assigned
+ * <code>Formatter</code>.
+ *
+ * @return the <code>Formatter</code> being used, or
+ * <code>null</code> if this <code>Handler</code>
+ * does not use formatters and no formatter has
+ * ever been set by calling <code>setFormatter</code>.
+ */
+ public Formatter getFormatter()
+ {
+ return formatter;
+ }
+
+
+ /**
+ * Sets the <code>Formatter</code> which will be used to
+ * localize the text of log messages and to substitute
+ * message parameters. A <code>Handler</code> is encouraged,
+ * but not required to actually use an assigned
+ * <code>Formatter</code>.
+ *
+ * @param formatter the new <code>Formatter</code> to use.
+ *
+ * @throws SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure.
+ *
+ * @throws NullPointerException if <code>formatter</code> is
+ * <code>null</code>.
+ */
+ public void setFormatter(Formatter formatter)
+ throws SecurityException
+ {
+ LogManager.getLogManager().checkAccess();
+
+ /* Throws a NullPointerException if formatter is null. */
+ formatter.getClass();
+
+ this.formatter = formatter;
+ }
+
+
+ /**
+ * Returns the character encoding which this handler uses for publishing
+ * log records.
+ *
+ * @param encoding the name of a character encoding, or <code>null</code>
+ * for the default platform encoding.
+ */
+ public String getEncoding()
+ {
+ return encoding;
+ }
+
+
+ /**
+ * Sets the character encoding which this handler uses for publishing
+ * log records. The encoding of a <code>Handler</code> must be
+ * set before any log records have been published.
+ *
+ * @param encoding the name of a character encoding, or <code>null</code>
+ * for the default encoding.
+ *
+ * @exception SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure.
+ *
+ */
+ public void setEncoding(String encoding)
+ throws SecurityException, UnsupportedEncodingException
+ {
+ /* Should any developer ever change this implementation, they are
+ * advised to have a look at StreamHandler.setEncoding(String),
+ * which overrides this method without calling super.setEncoding.
+ */
+ LogManager.getLogManager().checkAccess();
+
+ /* Simple check for supported encodings. This is more expensive
+ * than it could be, but this method is overwritten by StreamHandler
+ * anyway.
+ */
+ if (encoding != null)
+ new String(new byte[0], encoding);
+
+ this.encoding = encoding;
+ }
+
+
+ /**
+ * Returns the <code>Filter</code> that currently controls which
+ * log records are being published by this <code>Handler</code>.
+ *
+ * @return the currently active <code>Filter</code>, or
+ * <code>null</code> if no filter has been associated.
+ * In the latter case, log records are filtered purely
+ * based on their severity level.
+ */
+ public Filter getFilter()
+ {
+ return filter;
+ }
+
+
+ /**
+ * Sets the <code>Filter</code> for controlling which
+ * log records will be published by this <code>Handler</code>.
+ *
+ * @return the <code>Filter</code> to use, or
+ * <code>null</code> to filter log records purely based
+ * on their severity level.
+ */
+ public void setFilter(Filter filter)
+ throws SecurityException
+ {
+ LogManager.getLogManager().checkAccess();
+ this.filter = filter;
+ }
+
+
+ /**
+ * Returns the <code>ErrorManager</code> that currently deals
+ * with errors originating from this Handler.
+ *
+ * @exception SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure.
+ */
+ public ErrorManager getErrorManager()
+ {
+ LogManager.getLogManager().checkAccess();
+
+ /* Developers wanting to change the subsequent code should
+ * have a look at Handler.reportError -- it also can create
+ * an ErrorManager, but does so without checking permissions
+ * to control the logging infrastructure.
+ */
+ if (errorManager == null)
+ errorManager = new ErrorManager();
+
+ return errorManager;
+ }
+
+
+ public void setErrorManager(ErrorManager manager)
+ {
+ LogManager.getLogManager().checkAccess();
+
+ /* Make sure manager is not null. */
+ manager.getClass();
+
+ this.errorManager = manager;
+ }
+
+
+ protected void reportError(String message, Exception ex, int code)
+ {
+ if (errorManager == null)
+ errorManager = new ErrorManager();
+
+ errorManager.error(message, ex, code);
+ }
+
+
+ /**
+ * Returns the severity level threshold for this <code>Handler</code>
+ * All log records with a lower severity level will be discarded;
+ * a log record of the same or a higher level will be published
+ * unless an installed <code>Filter</code> decides to discard it.
+ *
+ * @return the severity level below which all log messages
+ * will be discarded.
+ */
+ public Level getLevel()
+ {
+ return level;
+ }
+
+
+ /**
+ * Sets the severity level threshold for this <code>Handler</code>.
+ * All log records with a lower severity level will be discarded;
+ * a log record of the same or a higher level will be published
+ * unless an installed <code>Filter</code> decides to discard it.
+ *
+ * @param level the severity level below which all log messages
+ * will be discarded.
+ *
+ * @exception SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure.
+ *
+ * @exception NullPointerException if <code>level</code> is
+ * <code>null</code>.
+ */
+ public void setLevel(Level level)
+ {
+ LogManager.getLogManager().checkAccess();
+
+ /* Throw NullPointerException if level is null. */
+ level.getClass();
+ this.level = level;
+ }
+
+
+ /**
+ * Checks whether a <code>LogRecord</code> would be logged
+ * if it was passed to this <code>Handler</code> for publication.
+ *
+ * <p>The <code>Handler</code> implementation considers a record as
+ * loggable if its level is greater than or equal to the severity
+ * level threshold. In a second step, if a {@link Filter} has
+ * been installed, its {@link Filter#isLoggable(LogRecord) isLoggable}
+ * method is invoked. Subclasses of <code>Handler</code> can override
+ * this method to impose their own constraints.
+ *
+ * @param record the <code>LogRecord</code> to be checked.
+ *
+ * @return <code>true</code> if <code>record</code> would
+ * be published by {@link #publish(LogRecord) publish},
+ * <code>false</code> if it would be discarded.
+ *
+ * @see #setLevel(Level)
+ * @see #setFilter(Filter)
+ * @see Filter#isLoggable(LogRecord)
+ *
+ * @throws NullPointerException if <code>record</code>
+ * is <code>null</code>.
+ */
+ public boolean isLoggable(LogRecord record)
+ {
+ if (record.getLevel().intValue() <= level.intValue())
+ return false;
+
+ if (filter != null)
+ return filter.isLoggable(record);
+ else
+ return true;
+ }
+}
diff --git a/libjava/libgcj.pc.in b/libjava/libgcj.pc.in
new file mode 100644
index 00000000000..34381cc4c42
--- /dev/null
+++ b/libjava/libgcj.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libgcj
+Description: libgcj
+Version: @GCJVERSION@
+Libs: -L${libdir} -lgcj
+Cflags: -I${includedir}
diff --git a/libjava/testsuite/libjava.verify/README.verify b/libjava/testsuite/libjava.verify/README.verify
new file mode 100644
index 00000000000..d28cdf82ca3
--- /dev/null
+++ b/libjava/testsuite/libjava.verify/README.verify
@@ -0,0 +1,10 @@
+The verifier tests come from Mauve.
+See http://sources.redhat.com/mauve
+
+You want the "verify" module in the Mauve cvs repository.
+
+In Mauve, only the sources are checked in. However, these need
+jasmin to be compiled to bytecode. Since jasmin would require either
+another VM or gcj itself to already be working and installed (just to
+compile it), we've chose to precompile all the .j files to .class
+files and then import the result.
diff --git a/libjava/testsuite/libjava.verify/verify.exp b/libjava/testsuite/libjava.verify/verify.exp
new file mode 100644
index 00000000000..76c9b00d4bf
--- /dev/null
+++ b/libjava/testsuite/libjava.verify/verify.exp
@@ -0,0 +1,83 @@
+# Tests for class verifier.
+
+global gcj_verify_xfail
+set {gcj_verify_xfail(gij verify of call.fail.Static)} 1
+set {gcj_verify_xfail(gij verify of simple.fail.dupfield)} 1
+set {gcj_verify_xfail(gij verify of simple.fail.dupinterface)} 1
+set {gcj_verify_xfail(gij verify of simple.fail.dupmethod)} 1
+set {gcj_verify_xfail(gij verify of subr.fail.jsr10)} 1
+set {gcj_verify_xfail(gij verify of subr.fail.jsr8)} 1
+
+
+proc gcj_verify_list_tests {srcdir} {
+ set result {}
+ if {[file exists $srcdir]} {
+ set here [pwd]
+ cd $srcdir
+ foreach item [lsort [glob -nocomplain */*/*.class]] {
+ lappend result [file rootname $item]
+ }
+ cd $here
+ }
+ return $result
+}
+
+proc gcj_verify_test_gij {gij srcdir test shouldfail} {
+ global gcj_verify_xfail
+
+ set testname "gij verify of $test"
+ verbose "invoking gij $test - shouldfail=$shouldfail"
+ set result [libjava_load $gij [list --cp $srcdir $test] ""]
+ set status [lindex $result 0]
+ set output [lindex $result 1]
+
+ if {$shouldfail} {
+ # We match the few exceptions that are allowed. This may need
+ # updating from time to time. We do this rather than check the
+ # exit status because we want to catch the case where gij dies in
+ # some inappropriate way.
+ if {[string match *VerifyError* $output]
+ || [string match *AbstractMethodError* $output]
+ || [string match *IncompatibleClassChangeError* $output]} {
+ set cmd pass
+ } else {
+ set cmd fail
+ }
+ if {[info exists gcj_verify_xfail($testname)]} {
+ setup_xfail *-*-*
+ }
+ } else {
+ if {$status == "pass"} {
+ set cmd pass
+ } else {
+ set cmd fail
+ }
+ }
+ $cmd $testname
+}
+
+proc gcj_verify_run {} {
+ global INTERPRETER srcdir
+
+ set gij [libjava_find_gij]
+ set interpret 1
+ # libjava_find_gij will return `gij' if it couldn't find the
+ # program; in this case we want to skip the test.
+ if {$INTERPRETER != "yes" || $gij == "gij"} {
+ set interpret 0
+ }
+
+ set testsdir $srcdir/libjava.verify/verify
+ foreach test [gcj_verify_list_tests $testsdir] {
+ set shouldfail [string match */fail/* $test]
+
+ if {$interpret} {
+ regsub -all -- / $test . gijname
+ gcj_verify_test_gij $gij $testsdir $gijname $shouldfail
+ }
+
+ # FIXME: run gcj --syntax-only here.
+ }
+}
+
+gcj_verify_run