Makefile.am: Added rules for libgcjx library.
authorRolf W. Rasmussen <rolfwr@ii.uib.no>
Sun, 22 Oct 2000 17:46:09 +0000 (19:46 +0200)
committerRolf Rasmussen <rolfwr@gcc.gnu.org>
Sun, 22 Oct 2000 17:46:09 +0000 (17:46 +0000)
* Makefile.am: Added rules for libgcjx library.
* Makefile.in: Rebuilt.
* configure.in: Added check for X.
* configure: Rebuilt.
* gnu/awt/LightweightRedirector.java: New file.
* gnu/awt/j2d/AbstractGraphicsState.java: New file.
* gnu/awt/j2d/DirectRasterGraphics.java: New file.
* gnu/awt/j2d/Graphics2DImpl.java: New file.
* gnu/awt/j2d/IntegerGraphicsState.java: New file.
* gnu/awt/j2d/MappedRaster.java: New file.
* gnu/awt/xlib/XCanvasPeer.java: New file.
* gnu/awt/xlib/XEventLoop.java: New file.
* gnu/awt/xlib/XEventQueue.java: New file.
* gnu/awt/xlib/XFontMetrics.java: New file.
* gnu/awt/xlib/XFramePeer.java: New file.
* gnu/awt/xlib/XGraphics.java: New file.
* gnu/awt/xlib/XGraphicsConfiguration.java: New file.
* gnu/awt/xlib/XPanelPeer.java: New file.
* gnu/awt/xlib/XToolkit.java: New file.
* gnu/gcj/xlib/Clip.java: New file.
* gnu/gcj/xlib/Colormap.java: New file.
* gnu/gcj/xlib/Display.java: New file.
* gnu/gcj/xlib/Drawable.java: New file.
* gnu/gcj/xlib/Font.java: New file.
* gnu/gcj/xlib/GC.java: New file.
* gnu/gcj/xlib/Pixmap.java: New file.
* gnu/gcj/xlib/Screen.java: New file.
* gnu/gcj/xlib/Visual.java: New file.
* gnu/gcj/xlib/WMSizeHints.java: New file.
* gnu/gcj/xlib/Window.java: New file.
* gnu/gcj/xlib/WindowAttributes.java: New file.
* gnu/gcj/xlib/XAnyEvent.java: New file.
* gnu/gcj/xlib/XButtonEvent.java: New file.
* gnu/gcj/xlib/XColor.java: New file.
* gnu/gcj/xlib/XConfigureEvent.java: New file.
* gnu/gcj/xlib/XConnectException.java: New file.
* gnu/gcj/xlib/XEvent.java: New file.
* gnu/gcj/xlib/XException.java: New file.
* gnu/gcj/xlib/XExposeEvent.java: New file.
* gnu/gcj/xlib/XID.java: New file.
* gnu/gcj/xlib/XImage.java: New file.
* gnu/gcj/xlib/XUnmapEvent.java: New file.
* gnu/gcj/xlib/natClip.cc: New file.
* gnu/gcj/xlib/natColormap.cc: New file.
* gnu/gcj/xlib/natDisplay.cc: New file.
* gnu/gcj/xlib/natDrawable.cc: New file.
* gnu/gcj/xlib/natFont.cc: New file.
* gnu/gcj/xlib/natGC.cc: New file.
* gnu/gcj/xlib/natPixmap.cc: New file.
* gnu/gcj/xlib/natScreen.cc: New file.
* gnu/gcj/xlib/natVisual.cc: New file.
* gnu/gcj/xlib/natWMSizeHints.cc: New file.
* gnu/gcj/xlib/natWindow.cc: New file.
* gnu/gcj/xlib/natWindowAttributes.cc: New file.
* gnu/gcj/xlib/natXAnyEvent.cc: New file.
* gnu/gcj/xlib/natXButtonEvent.cc: New file.
* gnu/gcj/xlib/natXColor.cc: New file.
* gnu/gcj/xlib/natXConfigureEvent.cc: New file.
* gnu/gcj/xlib/natXException.cc: New file.
* gnu/gcj/xlib/natXExposeEvent.cc: New file.
* gnu/gcj/xlib/natXImage.cc: New file.
* gnu/gcj/xlib/natXUnmapEvent.cc: New file.
* java/awt/EventDispatchThread.java: Start thead on creation.

From-SVN: r37005

64 files changed:
libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/configure
libjava/configure.in
libjava/gnu/awt/LightweightRedirector.java [new file with mode: 0644]
libjava/gnu/awt/j2d/AbstractGraphicsState.java [new file with mode: 0644]
libjava/gnu/awt/j2d/DirectRasterGraphics.java [new file with mode: 0644]
libjava/gnu/awt/j2d/Graphics2DImpl.java [new file with mode: 0644]
libjava/gnu/awt/j2d/IntegerGraphicsState.java [new file with mode: 0644]
libjava/gnu/awt/j2d/MappedRaster.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XCanvasPeer.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XEventLoop.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XEventQueue.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XFontMetrics.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XFramePeer.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XGraphics.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XGraphicsConfiguration.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XPanelPeer.java [new file with mode: 0644]
libjava/gnu/awt/xlib/XToolkit.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Clip.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Colormap.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Display.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Drawable.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Font.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/GC.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Pixmap.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Screen.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Visual.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/WMSizeHints.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/Window.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/WindowAttributes.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XAnyEvent.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XButtonEvent.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XColor.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XConfigureEvent.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XConnectException.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XEvent.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XException.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XExposeEvent.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XID.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XImage.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/XUnmapEvent.java [new file with mode: 0644]
libjava/gnu/gcj/xlib/natClip.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natColormap.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natDisplay.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natDrawable.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natFont.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natGC.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natPixmap.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natScreen.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natVisual.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natWMSizeHints.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natWindow.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natWindowAttributes.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXAnyEvent.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXButtonEvent.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXColor.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXConfigureEvent.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXException.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXExposeEvent.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXImage.cc [new file with mode: 0644]
libjava/gnu/gcj/xlib/natXUnmapEvent.cc [new file with mode: 0644]
libjava/java/awt/EventDispatchThread.java

index ad629ec434f5836f8f1687e8eed101012aa78c7e..785a36ee61bc7169a6d15cc064395095f034a6ac 100644 (file)
@@ -1,3 +1,69 @@
+2000-10-22  Rolf W. Rasmussen  <rolfwr@ii.uib.no>
+
+       * Makefile.am: Added rules for libgcjx library.
+       * Makefile.in: Rebuilt.
+       * configure.in: Added check for X.
+       * configure: Rebuilt.
+       * gnu/awt/LightweightRedirector.java: New file.
+       * gnu/awt/j2d/AbstractGraphicsState.java: New file.
+       * gnu/awt/j2d/DirectRasterGraphics.java: New file.
+       * gnu/awt/j2d/Graphics2DImpl.java: New file.
+       * gnu/awt/j2d/IntegerGraphicsState.java: New file.
+       * gnu/awt/j2d/MappedRaster.java: New file.
+       * gnu/awt/xlib/XCanvasPeer.java: New file.
+       * gnu/awt/xlib/XEventLoop.java: New file.
+       * gnu/awt/xlib/XEventQueue.java: New file.
+       * gnu/awt/xlib/XFontMetrics.java: New file.
+       * gnu/awt/xlib/XFramePeer.java: New file.
+       * gnu/awt/xlib/XGraphics.java: New file.
+       * gnu/awt/xlib/XGraphicsConfiguration.java: New file.
+       * gnu/awt/xlib/XPanelPeer.java: New file.
+       * gnu/awt/xlib/XToolkit.java: New file.
+       * gnu/gcj/xlib/Clip.java: New file.
+       * gnu/gcj/xlib/Colormap.java: New file.
+       * gnu/gcj/xlib/Display.java: New file.
+       * gnu/gcj/xlib/Drawable.java: New file.
+       * gnu/gcj/xlib/Font.java: New file.
+       * gnu/gcj/xlib/GC.java: New file.
+       * gnu/gcj/xlib/Pixmap.java: New file.
+       * gnu/gcj/xlib/Screen.java: New file.
+       * gnu/gcj/xlib/Visual.java: New file.
+       * gnu/gcj/xlib/WMSizeHints.java: New file.
+       * gnu/gcj/xlib/Window.java: New file.
+       * gnu/gcj/xlib/WindowAttributes.java: New file.
+       * gnu/gcj/xlib/XAnyEvent.java: New file.
+       * gnu/gcj/xlib/XButtonEvent.java: New file.
+       * gnu/gcj/xlib/XColor.java: New file.
+       * gnu/gcj/xlib/XConfigureEvent.java: New file.
+       * gnu/gcj/xlib/XConnectException.java: New file.
+       * gnu/gcj/xlib/XEvent.java: New file.
+       * gnu/gcj/xlib/XException.java: New file.
+       * gnu/gcj/xlib/XExposeEvent.java: New file.
+       * gnu/gcj/xlib/XID.java: New file.
+       * gnu/gcj/xlib/XImage.java: New file.
+       * gnu/gcj/xlib/XUnmapEvent.java: New file.
+       * gnu/gcj/xlib/natClip.cc: New file.
+       * gnu/gcj/xlib/natColormap.cc: New file.
+       * gnu/gcj/xlib/natDisplay.cc: New file.
+       * gnu/gcj/xlib/natDrawable.cc: New file.
+       * gnu/gcj/xlib/natFont.cc: New file.
+       * gnu/gcj/xlib/natGC.cc: New file.
+       * gnu/gcj/xlib/natPixmap.cc: New file.
+       * gnu/gcj/xlib/natScreen.cc: New file.
+       * gnu/gcj/xlib/natVisual.cc: New file.
+       * gnu/gcj/xlib/natWMSizeHints.cc: New file.
+       * gnu/gcj/xlib/natWindow.cc: New file.
+       * gnu/gcj/xlib/natWindowAttributes.cc: New file.
+       * gnu/gcj/xlib/natXAnyEvent.cc: New file.
+       * gnu/gcj/xlib/natXButtonEvent.cc: New file.
+       * gnu/gcj/xlib/natXColor.cc: New file.
+       * gnu/gcj/xlib/natXConfigureEvent.cc: New file.
+       * gnu/gcj/xlib/natXException.cc: New file.
+       * gnu/gcj/xlib/natXExposeEvent.cc: New file.
+       * gnu/gcj/xlib/natXImage.cc: New file.
+       * gnu/gcj/xlib/natXUnmapEvent.cc: New file.
+       * java/awt/EventDispatchThread.java: Start thead on creation.
+
 2000-10-20  Tom Tromey  <tromey@cygnus.com>
 
        From Arno J. Klaassen:
index cf045fe6a63313c1cf47016a95cfa2b9d9bd2588..d3e5a706527e86fa30f5dabd85a64b6a8c19f83d 100644 (file)
@@ -23,7 +23,13 @@ toolexecdir = $(exec_prefix)/$(target_alias)
 toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
 endif
 
-toolexeclib_LTLIBRARIES = libgcj.la
+if NO_X
+cond_x_ltlibrary =
+else
+cond_x_ltlibrary = libgcjx.la
+endif
+
+toolexeclib_LTLIBRARIES = libgcj.la $(cond_x_ltlibrary)
 toolexeclib_DATA = libgcj.spec
 data_DATA = libgcj.zip
 
@@ -82,7 +88,7 @@ WARNINGS = -W -Wall
 AM_CXXFLAGS = -fno-rtti -fvtable-thunks -fasynchronous-exceptions \
 ## Some systems don't allow `$' in identifiers by default, so we force it.
        -fdollars-in-identifiers \
-       @LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ $(WARNINGS) -D_GNU_SOURCE
+       @LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ @X_CFLAGS@ $(WARNINGS) -D_GNU_SOURCE
 if USING_GCC
 AM_CFLAGS = @LIBGCJ_CFLAGS@ $(WARNINGS)
 else
@@ -107,11 +113,13 @@ INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
 
 ## Objects from C++ sources in subdirs.
 nat_files = $(nat_source_files:.cc=.lo)
+x_nat_files = $(x_nat_source_files:.cc=.lo)
 ## Objects from C sources in subdirs.
 c_files = $(c_source_files:.c=.lo)
 ## Objects from Java sources in subdirs.
 javao_files = $(java_source_files:.java=.lo) \
        $(built_java_source_files:.java=.lo)
+x_javao_files = $(x_java_source_files:.java=.lo)
 
 ## Extract the libffi object file names.
 libffi_files = `$(AR) t ../libffi/.libs/libffi.a 2>/dev/null | sed 's/\.o/\.lo/g' | sed 's/^/..\/libffi\//g'`
@@ -130,6 +138,15 @@ libgcj_la_LDFLAGS = -lsupc++ -rpath $(toolexeclibdir) \
        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
 libgcj_la_LINK = $(LIBLINK)
 
+libgcjx_la_SOURCES = $(x_nat_source_files)
+EXTRA_libgcjx_la_SOURCES = $(x_java_source_files)
+libgcjx_la_DEPENDENCIES = libgcj.zip $(x_javao_files)
+libgcjx_la_LIBADD = $(x_javao_files)
+libgcjx_la_LDFLAGS = @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
+        -lsupc++ -rpath $(toolexeclibdir) \
+## The mysterious backslash is consumed by make.
+        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+libgcjx_la_LINK = $(LIBLINK)
 
 ## Make the .class files depend on the .zip file.  This seems
 ## backwards, but is right.  This doesn't catch all the .class files,
@@ -139,6 +156,11 @@ libgcj_la_LINK = $(LIBLINK)
 ## hand-maintained headers.
 $(java_source_files:.java=.class): libgcj.zip
 
+## The .class files for X will not be included in libgcj.zip, but the
+## rule for libgcj.zip will cause all out-of-date .class files to be
+## built. We need this to generate headers for the nat-files.
+$(x_java_source_files:.java=.class): libgcj.zip
+
 ## FIXME: this isn't really correct.
 $(built_java_source_files:.java=.class): $(built_java_source_files)
 ## This little nastiness is here so that the backquoted stuff in the
@@ -156,7 +178,7 @@ $(built_java_source_files:.java=.class): $(built_java_source_files)
 ## up-to-date, and foo.class is removed, and bar.java is touched, then
 ## `make libgcj.zip' will not rebuilt foo.class.  That's because
 ## libgcj.zip is not out-of-date with respect to foo.java.
-libgcj.zip: $(java_source_files)
+libgcj.zip: $(java_source_files) $(x_java_source_files)
 ## Create a list of all Java sources, without exceeding any shell limits.
        @: $(shell echo Creating list of files to compile...) $(shell rm -f tmp-list || :) $(shell touch tmp-list) $(foreach source,$(subst $(srcdir)/,,$?),$(shell echo $(source) >> tmp-list))
 ## FIXME: this ought to depend on built_java_source_files, but right
@@ -171,9 +193,11 @@ libgcj.zip: $(java_source_files)
        done
        -@rm -f tmp-list libgcj.zip
 ## Note that we explicitly want to include directory information.
-       $(ZIP) -r libgcj java gnu -n .class -i '*.class' -i '*/'
+       find java gnu -type d -o -type f -name '*.class' | \
+         sed -e '/\/\./d' -e '/\/xlib/d' | \
+         $(ZIP) libgcj -@ -n .class
 
-MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files)
+MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files) $(x_javao_files) $(x_nat_files) $(x_nat_headers)
 CLEANFILES = tmp-list libgcj.zip
 
 clean-local:
@@ -192,7 +216,7 @@ SUFFIXES = .class .java .h
 ## special rule.  The standard automake rule can't be overridden (this
 ## is a bug in automake), and it also won't put the .o files into
 ## subdirs.  FIXME.
-$(nat_files): %.lo: %.cc
+$(nat_files) $(x_nat_files): %.lo: %.cc
        @echo '$(LTCXXCOMPILE) -c -o $@ $<'; \
        $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c -o $@ $<
        @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
@@ -209,7 +233,7 @@ $(c_files): %.lo: %.c
 $(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
 
 ## FIXME: GNU make.
-$(javao_files): %.lo: %.java
+$(javao_files) $(x_javao_files): %.lo: %.java
        $(GCJCOMPILE) -o $@ $<
 
 ## ################################################################
@@ -228,6 +252,8 @@ nat_headers = $(ordinary_java_source_files:.java=.h) \
        java/io/ObjectOutputStream$$PutField.h \
        java/io/ObjectInputStream$$GetField.h
 
+x_nat_headers = $(x_java_source_files:.java=.h)
+
 java/lang/ClassLoader.h: java/lang/ClassLoader.class libgcj.zip
        $(GCJH) -classpath $(top_builddir) \
                -friend 'jclass _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader);' \
@@ -491,6 +517,16 @@ gnu/gcj/convert/UnicodeToBytes.java
 special_java_source_files = java/lang/Class.java java/lang/Object.java
 
 awt_java_source_files =        \
+gnu/awt/LightweightRedirector.java \
+gnu/awt/j2d/AbstractGraphicsState.java \
+gnu/awt/j2d/DirectRasterGraphics.java \
+gnu/awt/j2d/Graphics2DImpl.java \
+gnu/awt/j2d/IntegerGraphicsState.java \
+gnu/awt/j2d/MappedRaster.java \
+gnu/gcj/awt/BitMaskExtent.java \
+gnu/gcj/awt/Buffers.java \
+gnu/gcj/awt/ComponentDataBlitOp.java \
+gnu/gcj/awt/GLightweightPeer.java \
 gnu/java/beans/editors/ColorEditor.java        \
 gnu/java/beans/editors/FontEditor.java \
 gnu/java/beans/editors/NativeBooleanEditor.java        \
@@ -506,10 +542,6 @@ gnu/java/beans/BeanInfoEmbryo.java \
 gnu/java/beans/EmptyBeanInfo.java \
 gnu/java/beans/ExplicitBeanInfo.java \
 gnu/java/beans/IntrospectionIncubator.java \
-gnu/gcj/awt/BitMaskExtent.java \
-gnu/gcj/awt/Buffers.java \
-gnu/gcj/awt/ComponentDataBlitOp.java \
-gnu/gcj/awt/GLightweightPeer.java \
 java/applet/Applet.java \
 java/applet/AppletStub.java \
 java/applet/AppletContext.java \
@@ -1168,6 +1200,62 @@ java/util/natGregorianCalendar.cc \
 java/util/zip/natDeflater.cc \
 java/util/zip/natInflater.cc
 
+x_java_source_files = \
+gnu/gcj/xlib/Clip.java \
+gnu/gcj/xlib/Colormap.java \
+gnu/gcj/xlib/Display.java \
+gnu/gcj/xlib/Drawable.java \
+gnu/gcj/xlib/Font.java \
+gnu/gcj/xlib/GC.java \
+gnu/gcj/xlib/Pixmap.java \
+gnu/gcj/xlib/Screen.java \
+gnu/gcj/xlib/Visual.java \
+gnu/gcj/xlib/WMSizeHints.java \
+gnu/gcj/xlib/Window.java \
+gnu/gcj/xlib/WindowAttributes.java \
+gnu/gcj/xlib/XAnyEvent.java \
+gnu/gcj/xlib/XButtonEvent.java \
+gnu/gcj/xlib/XColor.java \
+gnu/gcj/xlib/XConfigureEvent.java \
+gnu/gcj/xlib/XConnectException.java \
+gnu/gcj/xlib/XEvent.java \
+gnu/gcj/xlib/XException.java \
+gnu/gcj/xlib/XExposeEvent.java \
+gnu/gcj/xlib/XID.java \
+gnu/gcj/xlib/XImage.java \
+gnu/gcj/xlib/XUnmapEvent.java \
+gnu/awt/xlib/XCanvasPeer.java \
+gnu/awt/xlib/XEventLoop.java \
+gnu/awt/xlib/XEventQueue.java \
+gnu/awt/xlib/XFontMetrics.java \
+gnu/awt/xlib/XFramePeer.java \
+gnu/awt/xlib/XGraphics.java \
+gnu/awt/xlib/XGraphicsConfiguration.java \
+gnu/awt/xlib/XPanelPeer.java \
+gnu/awt/xlib/XToolkit.java
+
+x_nat_source_files = \
+gnu/gcj/xlib/natClip.cc \
+gnu/gcj/xlib/natColormap.cc \
+gnu/gcj/xlib/natDisplay.cc \
+gnu/gcj/xlib/natDrawable.cc \
+gnu/gcj/xlib/natFont.cc \
+gnu/gcj/xlib/natGC.cc \
+gnu/gcj/xlib/natPixmap.cc \
+gnu/gcj/xlib/natScreen.cc \
+gnu/gcj/xlib/natVisual.cc \
+gnu/gcj/xlib/natWMSizeHints.cc \
+gnu/gcj/xlib/natWindow.cc \
+gnu/gcj/xlib/natWindowAttributes.cc \
+gnu/gcj/xlib/natXAnyEvent.cc \
+gnu/gcj/xlib/natXButtonEvent.cc \
+gnu/gcj/xlib/natXColor.cc \
+gnu/gcj/xlib/natXConfigureEvent.cc \
+gnu/gcj/xlib/natXException.cc \
+gnu/gcj/xlib/natXExposeEvent.cc \
+gnu/gcj/xlib/natXImage.cc \
+gnu/gcj/xlib/natXUnmapEvent.cc
+
 ## ################################################################
 
 ##
@@ -1182,7 +1270,7 @@ java/util/zip/natInflater.cc
 ## compile the C++ sources, but we can't make the .o files depend on
 ## the headers, because in that case we'll force a complete rebuild of
 ## the C++ code whenever any .java file is touched.
-all-recursive: $(nat_headers)
+all-recursive: $(nat_headers) $(x_nat_headers)
 
 ## ################################################################
 
index f5df4428d6f24358de9f65fe57462cbb7d2a66f1..536d29683eb171e0e89e60ef6c1e679f820f01b9 100644 (file)
@@ -119,40 +119,29 @@ here = @here@
 libgcj_basedir = @libgcj_basedir@
 
 AUTOMAKE_OPTIONS = foreign no-installinfo
-@TESTSUBDIR_TRUE@SUBDIRS = \
-@TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
-@TESTSUBDIR_FALSE@SUBDIRS = \
-@TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
-@USE_LIBDIR_TRUE@toolexeclibdir = \
-@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexeclibdir = \
-@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexecdir = \
-@USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
-
-toolexeclib_LTLIBRARIES = libgcj.la
+@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
+@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
+@USE_LIBDIR_TRUE@toolexeclibdir = @USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexeclibdir = @USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
+@NO_X_TRUE@cond_x_ltlibrary = 
+@NO_X_FALSE@cond_x_ltlibrary = @NO_X_FALSE@libgcjx.la
+
+toolexeclib_LTLIBRARIES = libgcj.la $(cond_x_ltlibrary)
 toolexeclib_DATA = libgcj.spec
 data_DATA = libgcj.zip
 
-@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = \
-@NEEDS_DATA_START_TRUE@libgcjdata.a
-@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = \
-@NEEDS_DATA_START_TRUE@libgcjdata.c
+@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = @NEEDS_DATA_START_TRUE@libgcjdata.a
+@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = @NEEDS_DATA_START_TRUE@libgcjdata.c
 
-@NATIVE_TRUE@bin_PROGRAMS = \
-@NATIVE_TRUE@jv-convert gij
+@NATIVE_TRUE@bin_PROGRAMS = @NATIVE_TRUE@jv-convert gij
 
 bin_SCRIPTS = addr2name.awk
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = \
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = \
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
-@CANADIAN_FALSE@ZIP = \
-@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
-@CANADIAN_TRUE@GCJH = \
-@CANADIAN_TRUE@gcjh
-@CANADIAN_FALSE@GCJH = \
-@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
+@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
+@CANADIAN_TRUE@GCJH = @CANADIAN_TRUE@gcjh
+@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
 
 GCJCOMPILE = $(LIBTOOL) --mode=compile $(GCJ) -fassume-compiled -fclasspath=$(here) -L$(here) $(JC1FLAGS) -MD -MT $@ -MF $(@:.lo=.d) -c
 GCJLINK = $(LIBTOOL) --mode=link $(GCJ) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
@@ -165,12 +154,10 @@ EH_COMMON_INCLUDE = @EH_COMMON_INCLUDE@
 WARNINGS = -W -Wall
 AM_CXXFLAGS = -fno-rtti -fvtable-thunks -fasynchronous-exceptions \
        -fdollars-in-identifiers \
-       @LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ $(WARNINGS) -D_GNU_SOURCE
+       @LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ @X_CFLAGS@ $(WARNINGS) -D_GNU_SOURCE
 
-@USING_GCC_TRUE@AM_CFLAGS = \
-@USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
-@USING_GCC_FALSE@AM_CFLAGS = \
-@USING_GCC_FALSE@@LIBGCJ_CFLAGS@
+@USING_GCC_TRUE@AM_CFLAGS = @USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
+@USING_GCC_FALSE@AM_CFLAGS = @USING_GCC_FALSE@@LIBGCJ_CFLAGS@
 
 JCFLAGS = -g
 JC1FLAGS = -g @LIBGCJ_JAVAFLAGS@
@@ -183,10 +170,12 @@ INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
 
 
 nat_files = $(nat_source_files:.cc=.lo)
+x_nat_files = $(x_nat_source_files:.cc=.lo)
 c_files = $(c_source_files:.c=.lo)
 javao_files = $(java_source_files:.java=.lo) \
        $(built_java_source_files:.java=.lo)
 
+x_javao_files = $(x_java_source_files:.java=.lo)
 
 libffi_files = `$(AR) t ../libffi/.libs/libffi.a 2>/dev/null | sed 's/\.o/\.lo/g' | sed 's/^/..\/libffi\//g'`
 
@@ -208,7 +197,17 @@ libgcj_la_LDFLAGS = -lsupc++ -rpath $(toolexeclibdir) \
 
 libgcj_la_LINK = $(LIBLINK)
 
-MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files)
+libgcjx_la_SOURCES = $(x_nat_source_files)
+EXTRA_libgcjx_la_SOURCES = $(x_java_source_files)
+libgcjx_la_DEPENDENCIES = libgcj.zip $(x_javao_files)
+libgcjx_la_LIBADD = $(x_javao_files)
+libgcjx_la_LDFLAGS = @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
+        -lsupc++ -rpath $(toolexeclibdir) \
+        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+
+libgcjx_la_LINK = $(LIBLINK)
+
+MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files) $(x_javao_files) $(x_nat_files) $(x_nat_headers)
 CLEANFILES = tmp-list libgcj.zip
 
 SUFFIXES = .class .java .h
@@ -219,12 +218,13 @@ nat_headers = $(ordinary_java_source_files:.java=.h) \
        java/io/ObjectInputStream$$GetField.h
 
 
+x_nat_headers = $(x_java_source_files:.java=.h)
+
 extra_headers = java/lang/Object.h java/lang/Class.h
 
 NM = nm
 
-@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = \
-@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
+@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
 
 CONVERT_DIR = gnu/gcj/convert
 
@@ -281,6 +281,16 @@ gnu/gcj/convert/UnicodeToBytes.java
 special_java_source_files = java/lang/Class.java java/lang/Object.java
 
 awt_java_source_files = \
+gnu/awt/LightweightRedirector.java \
+gnu/awt/j2d/AbstractGraphicsState.java \
+gnu/awt/j2d/DirectRasterGraphics.java \
+gnu/awt/j2d/Graphics2DImpl.java \
+gnu/awt/j2d/IntegerGraphicsState.java \
+gnu/awt/j2d/MappedRaster.java \
+gnu/gcj/awt/BitMaskExtent.java \
+gnu/gcj/awt/Buffers.java \
+gnu/gcj/awt/ComponentDataBlitOp.java \
+gnu/gcj/awt/GLightweightPeer.java \
 gnu/java/beans/editors/ColorEditor.java        \
 gnu/java/beans/editors/FontEditor.java \
 gnu/java/beans/editors/NativeBooleanEditor.java        \
@@ -296,10 +306,6 @@ gnu/java/beans/BeanInfoEmbryo.java \
 gnu/java/beans/EmptyBeanInfo.java \
 gnu/java/beans/ExplicitBeanInfo.java \
 gnu/java/beans/IntrospectionIncubator.java \
-gnu/gcj/awt/BitMaskExtent.java \
-gnu/gcj/awt/Buffers.java \
-gnu/gcj/awt/ComponentDataBlitOp.java \
-gnu/gcj/awt/GLightweightPeer.java \
 java/applet/Applet.java \
 java/applet/AppletStub.java \
 java/applet/AppletContext.java \
@@ -953,6 +959,64 @@ java/util/zip/natDeflater.cc \
 java/util/zip/natInflater.cc
 
 
+x_java_source_files = \
+gnu/gcj/xlib/Clip.java \
+gnu/gcj/xlib/Colormap.java \
+gnu/gcj/xlib/Display.java \
+gnu/gcj/xlib/Drawable.java \
+gnu/gcj/xlib/Font.java \
+gnu/gcj/xlib/GC.java \
+gnu/gcj/xlib/Pixmap.java \
+gnu/gcj/xlib/Screen.java \
+gnu/gcj/xlib/Visual.java \
+gnu/gcj/xlib/WMSizeHints.java \
+gnu/gcj/xlib/Window.java \
+gnu/gcj/xlib/WindowAttributes.java \
+gnu/gcj/xlib/XAnyEvent.java \
+gnu/gcj/xlib/XButtonEvent.java \
+gnu/gcj/xlib/XColor.java \
+gnu/gcj/xlib/XConfigureEvent.java \
+gnu/gcj/xlib/XConnectException.java \
+gnu/gcj/xlib/XEvent.java \
+gnu/gcj/xlib/XException.java \
+gnu/gcj/xlib/XExposeEvent.java \
+gnu/gcj/xlib/XID.java \
+gnu/gcj/xlib/XImage.java \
+gnu/gcj/xlib/XUnmapEvent.java \
+gnu/awt/xlib/XCanvasPeer.java \
+gnu/awt/xlib/XEventLoop.java \
+gnu/awt/xlib/XEventQueue.java \
+gnu/awt/xlib/XFontMetrics.java \
+gnu/awt/xlib/XFramePeer.java \
+gnu/awt/xlib/XGraphics.java \
+gnu/awt/xlib/XGraphicsConfiguration.java \
+gnu/awt/xlib/XPanelPeer.java \
+gnu/awt/xlib/XToolkit.java
+
+
+x_nat_source_files = \
+gnu/gcj/xlib/natClip.cc \
+gnu/gcj/xlib/natColormap.cc \
+gnu/gcj/xlib/natDisplay.cc \
+gnu/gcj/xlib/natDrawable.cc \
+gnu/gcj/xlib/natFont.cc \
+gnu/gcj/xlib/natGC.cc \
+gnu/gcj/xlib/natPixmap.cc \
+gnu/gcj/xlib/natScreen.cc \
+gnu/gcj/xlib/natVisual.cc \
+gnu/gcj/xlib/natWMSizeHints.cc \
+gnu/gcj/xlib/natWindow.cc \
+gnu/gcj/xlib/natWindowAttributes.cc \
+gnu/gcj/xlib/natXAnyEvent.cc \
+gnu/gcj/xlib/natXButtonEvent.cc \
+gnu/gcj/xlib/natXColor.cc \
+gnu/gcj/xlib/natXConfigureEvent.cc \
+gnu/gcj/xlib/natXException.cc \
+gnu/gcj/xlib/natXExposeEvent.cc \
+gnu/gcj/xlib/natXImage.cc \
+gnu/gcj/xlib/natXUnmapEvent.cc
+
+
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
 # friends when we are called from the top level Makefile.
@@ -1014,6 +1078,10 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I./include
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_LIBS = @X_LIBS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
 libgcjdata_a_LIBADD = 
 @NEEDS_DATA_START_TRUE@libgcjdata_a_OBJECTS =  libgcjdata.$(OBJEXT)
 LTLIBRARIES =  $(toolexeclib_LTLIBRARIES)
@@ -1040,6 +1108,17 @@ java/net/natInetAddress.lo java/net/natPlainDatagramSocketImpl.lo \
 java/net/natPlainSocketImpl.lo java/text/natCollator.lo \
 java/util/natGregorianCalendar.lo java/util/zip/natDeflater.lo \
 java/util/zip/natInflater.lo
+libgcjx_la_OBJECTS =  gnu/gcj/xlib/natClip.lo \
+gnu/gcj/xlib/natColormap.lo gnu/gcj/xlib/natDisplay.lo \
+gnu/gcj/xlib/natDrawable.lo gnu/gcj/xlib/natFont.lo \
+gnu/gcj/xlib/natGC.lo gnu/gcj/xlib/natPixmap.lo \
+gnu/gcj/xlib/natScreen.lo gnu/gcj/xlib/natVisual.lo \
+gnu/gcj/xlib/natWMSizeHints.lo gnu/gcj/xlib/natWindow.lo \
+gnu/gcj/xlib/natWindowAttributes.lo gnu/gcj/xlib/natXAnyEvent.lo \
+gnu/gcj/xlib/natXButtonEvent.lo gnu/gcj/xlib/natXColor.lo \
+gnu/gcj/xlib/natXConfigureEvent.lo gnu/gcj/xlib/natXException.lo \
+gnu/gcj/xlib/natXExposeEvent.lo gnu/gcj/xlib/natXImage.lo \
+gnu/gcj/xlib/natXUnmapEvent.lo
 @NATIVE_TRUE@bin_PROGRAMS =  jv-convert$(EXEEXT) gij$(EXEEXT)
 @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS =  \
 @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS$(EXEEXT)
@@ -1076,6 +1155,17 @@ DIST_SUBDIRS =  @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include
 DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/$(srcdir)/$(CONVERT_DIR)/make-trie.P .deps/boehm.P \
 .deps/defineclass.P .deps/exception.P .deps/gij.P \
+.deps/gnu/awt/LightweightRedirector.P \
+.deps/gnu/awt/j2d/AbstractGraphicsState.P \
+.deps/gnu/awt/j2d/DirectRasterGraphics.P \
+.deps/gnu/awt/j2d/Graphics2DImpl.P \
+.deps/gnu/awt/j2d/IntegerGraphicsState.P \
+.deps/gnu/awt/j2d/MappedRaster.P .deps/gnu/awt/xlib/XCanvasPeer.P \
+.deps/gnu/awt/xlib/XEventLoop.P .deps/gnu/awt/xlib/XEventQueue.P \
+.deps/gnu/awt/xlib/XFontMetrics.P .deps/gnu/awt/xlib/XFramePeer.P \
+.deps/gnu/awt/xlib/XGraphics.P \
+.deps/gnu/awt/xlib/XGraphicsConfiguration.P \
+.deps/gnu/awt/xlib/XPanelPeer.P .deps/gnu/awt/xlib/XToolkit.P \
 .deps/gnu/gcj/RawData.P .deps/gnu/gcj/awt/BitMaskExtent.P \
 .deps/gnu/gcj/awt/Buffers.P .deps/gnu/gcj/awt/ComponentDataBlitOp.P \
 .deps/gnu/gcj/awt/GLightweightPeer.P \
@@ -1119,7 +1209,29 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/gnu/gcj/text/LocaleData_en_US.P \
 .deps/gnu/gcj/text/SentenceBreakIterator.P \
 .deps/gnu/gcj/text/WordBreakIterator.P \
-.deps/gnu/gcj/util/EnumerationChain.P \
+.deps/gnu/gcj/util/EnumerationChain.P .deps/gnu/gcj/xlib/Clip.P \
+.deps/gnu/gcj/xlib/Colormap.P .deps/gnu/gcj/xlib/Display.P \
+.deps/gnu/gcj/xlib/Drawable.P .deps/gnu/gcj/xlib/Font.P \
+.deps/gnu/gcj/xlib/GC.P .deps/gnu/gcj/xlib/Pixmap.P \
+.deps/gnu/gcj/xlib/Screen.P .deps/gnu/gcj/xlib/Visual.P \
+.deps/gnu/gcj/xlib/WMSizeHints.P .deps/gnu/gcj/xlib/Window.P \
+.deps/gnu/gcj/xlib/WindowAttributes.P .deps/gnu/gcj/xlib/XAnyEvent.P \
+.deps/gnu/gcj/xlib/XButtonEvent.P .deps/gnu/gcj/xlib/XColor.P \
+.deps/gnu/gcj/xlib/XConfigureEvent.P \
+.deps/gnu/gcj/xlib/XConnectException.P .deps/gnu/gcj/xlib/XEvent.P \
+.deps/gnu/gcj/xlib/XException.P .deps/gnu/gcj/xlib/XExposeEvent.P \
+.deps/gnu/gcj/xlib/XID.P .deps/gnu/gcj/xlib/XImage.P \
+.deps/gnu/gcj/xlib/XUnmapEvent.P .deps/gnu/gcj/xlib/natClip.P \
+.deps/gnu/gcj/xlib/natColormap.P .deps/gnu/gcj/xlib/natDisplay.P \
+.deps/gnu/gcj/xlib/natDrawable.P .deps/gnu/gcj/xlib/natFont.P \
+.deps/gnu/gcj/xlib/natGC.P .deps/gnu/gcj/xlib/natPixmap.P \
+.deps/gnu/gcj/xlib/natScreen.P .deps/gnu/gcj/xlib/natVisual.P \
+.deps/gnu/gcj/xlib/natWMSizeHints.P .deps/gnu/gcj/xlib/natWindow.P \
+.deps/gnu/gcj/xlib/natWindowAttributes.P \
+.deps/gnu/gcj/xlib/natXAnyEvent.P .deps/gnu/gcj/xlib/natXButtonEvent.P \
+.deps/gnu/gcj/xlib/natXColor.P .deps/gnu/gcj/xlib/natXConfigureEvent.P \
+.deps/gnu/gcj/xlib/natXException.P .deps/gnu/gcj/xlib/natXExposeEvent.P \
+.deps/gnu/gcj/xlib/natXImage.P .deps/gnu/gcj/xlib/natXUnmapEvent.P \
 .deps/gnu/java/beans/BeanInfoEmbryo.P \
 .deps/gnu/java/beans/EmptyBeanInfo.P \
 .deps/gnu/java/beans/ExplicitBeanInfo.P \
@@ -1544,8 +1656,8 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/java/util/zip/natInflater.P .deps/jni.P .deps/libgcjdata.P \
 .deps/name-finder.P .deps/no-threads.P .deps/nogc.P \
 .deps/posix-threads.P .deps/posix.P .deps/prims.P .deps/resolve.P
-SOURCES = $(libgcjdata_a_SOURCES) $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
-OBJECTS = $(libgcjdata_a_OBJECTS) $(libgcj_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(gen_from_JIS_OBJECTS)
+SOURCES = $(libgcjdata_a_SOURCES) $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(libgcjx_la_SOURCES) $(EXTRA_libgcjx_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
+OBJECTS = $(libgcjdata_a_OBJECTS) $(libgcj_la_OBJECTS) $(libgcjx_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(gen_from_JIS_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
@@ -1672,6 +1784,9 @@ uninstall-toolexeclibLTLIBRARIES:
 libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
        $(libgcj_la_LINK) -rpath $(toolexeclibdir) $(libgcj_la_LDFLAGS) $(libgcj_la_OBJECTS) $(libgcj_la_LIBADD) $(LIBS)
 
+libgcjx.la: $(libgcjx_la_OBJECTS) $(libgcjx_la_DEPENDENCIES)
+       $(libgcjx_la_LINK) -rpath $(toolexeclibdir) $(libgcjx_la_LDFLAGS) $(libgcjx_la_OBJECTS) $(libgcjx_la_LIBADD) $(LIBS)
+
 mostlyclean-binPROGRAMS:
 
 clean-binPROGRAMS:
@@ -1916,7 +2031,7 @@ distdir: $(DISTFILES)
        @for file in $(DISTFILES); do \
          d=$(srcdir); \
          if test -d $$d/$$file; then \
-           cp -pr $$/$$file $(distdir)/$$file; \
+           cp -pr $$d/$$file $(distdir)/$$file; \
          else \
            test -f $(distdir)/$$file \
            || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -2104,6 +2219,8 @@ mostlyclean distclean maintainer-clean
 
 $(java_source_files:.java=.class): libgcj.zip
 
+$(x_java_source_files:.java=.class): libgcj.zip
+
 $(built_java_source_files:.java=.class): $(built_java_source_files)
        @javac="$(JAVAC)"; \
        for f in $?; do \
@@ -2112,7 +2229,7 @@ $(built_java_source_files:.java=.class): $(built_java_source_files)
          -d $(here) $$f; \
        done
 
-libgcj.zip: $(java_source_files)
+libgcj.zip: $(java_source_files) $(x_java_source_files)
        @: $(shell echo Creating list of files to compile...) $(shell rm -f tmp-list || :) $(shell touch tmp-list) $(foreach source,$(subst $(srcdir)/,,$?),$(shell echo $(source) >> tmp-list))
        $(MAKE) $(built_java_source_files:.java=.class)
        @javac="$(JAVAC)"; dir=`/bin/pwd`; cd $(srcdir); \
@@ -2121,7 +2238,9 @@ libgcj.zip: $(java_source_files)
            $$javac $(JCFLAGS) -classpath $(here):`/bin/pwd` -d $(here) $$f; \
        done
        -@rm -f tmp-list libgcj.zip
-       $(ZIP) -r libgcj java gnu -n .class -i '*.class' -i '*/'
+       find java gnu -type d -o -type f -name '*.class' | \
+         sed -e '/\/\./d' -e '/\/xlib/d' | \
+         $(ZIP) libgcj -@ -n .class
 
 clean-local:
        find . -name '*.class' -print | xargs rm -f
@@ -2132,7 +2251,7 @@ clean-local:
 .java.lo:
        $(GCJCOMPILE) -o $@ $<
 
-$(nat_files): %.lo: %.cc
+$(nat_files) $(x_nat_files): %.lo: %.cc
        @echo '$(LTCXXCOMPILE) -c -o $@ $<'; \
        $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c -o $@ $<
        @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
@@ -2147,7 +2266,7 @@ $(c_files): %.lo: %.c
 
 $(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
 
-$(javao_files): %.lo: %.java
+$(javao_files) $(x_javao_files): %.lo: %.java
        $(GCJCOMPILE) -o $@ $<
 
 .class.h:
@@ -2295,7 +2414,7 @@ $(CONVERT_DIR)/make-trie.o: $(srcdir)/$(CONVERT_DIR)/make-trie.c
 
 -include deps.mk
 
-all-recursive: $(nat_headers)
+all-recursive: $(nat_headers) $(x_nat_headers)
 
 # Multilib support.
 .PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
index d2f0f7a78ab93e04adf8080f04b6d27da2cd4ae1..a0effe75743b9271781e45b8aab8d97013faea3d 100755 (executable)
@@ -56,6 +56,8 @@ ac_help="$ac_help
   --enable-java-gc=TYPE   choose garbage collector [boehm]"
 ac_help="$ac_help
   --enable-threads=TYPE   choose threading package"
+ac_help="$ac_help
+  --with-x                use the X Window System"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -73,7 +75,6 @@ program_suffix=NONE
 program_transform_name=s,x,x,
 silent=
 site=
-sitefile=
 srcdir=
 target=NONE
 verbose=
@@ -188,7 +189,6 @@ Configuration:
   --help                  print this message
   --no-create             do not create output files
   --quiet, --silent       do not print \`checking...' messages
-  --site-file=FILE        use FILE as the site file
   --version               print the version of autoconf that created configure
 Directory and file names:
   --prefix=PREFIX         install architecture-independent files in PREFIX
@@ -359,11 +359,6 @@ EOF
   -site=* | --site=* | --sit=*)
     site="$ac_optarg" ;;
 
-  -site-file | --site-file | --site-fil | --site-fi | --site-f)
-    ac_prev=sitefile ;;
-  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
-    sitefile="$ac_optarg" ;;
-
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -529,16 +524,12 @@ fi
 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
 
 # Prefer explicitly selected file to automatically selected ones.
-if test -z "$sitefile"; then
-  if test -z "$CONFIG_SITE"; then
-    if test "x$prefix" != xNONE; then
-      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-    else
-      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-    fi
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
   fi
-else
-  CONFIG_SITE="$sitefile"
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
@@ -626,7 +617,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:630: checking host system type" >&5
+echo "configure:621: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -647,7 +638,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:651: checking target system type" >&5
+echo "configure:642: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -665,7 +656,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:669: checking build system type" >&5
+echo "configure:660: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -713,7 +704,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:717: checking for a BSD compatible install" >&5
+echo "configure:708: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -766,7 +757,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:770: checking whether build environment is sane" >&5
+echo "configure:761: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -823,7 +814,7 @@ test "$program_suffix" != NONE &&
 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:827: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:818: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -856,12 +847,12 @@ else
 fi
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:860: checking for Cygwin environment" >&5
+echo "configure:851: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 865 "configure"
+#line 856 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -872,7 +863,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -889,19 +880,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:893: checking for mingw32 environment" >&5
+echo "configure:884: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 898 "configure"
+#line 889 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -949,7 +940,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:953: checking host system type" >&5
+echo "configure:944: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -976,7 +967,7 @@ echo "$ac_t""$host" 1>&6
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:980: checking for $ac_word" >&5
+echo "configure:971: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1006,7 +997,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1010: checking for $ac_word" >&5
+echo "configure:1001: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1057,7 +1048,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1061: checking for $ac_word" >&5
+echo "configure:1052: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1090,7 +1081,7 @@ fi
 
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1094: checking whether we are using GNU C" >&5
+echo "configure:1085: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1099,7 +1090,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1103: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1094: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1118,7 +1109,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1122: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1113: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1154,7 +1145,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1158: checking for $ac_word" >&5
+echo "configure:1149: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1187,7 +1178,7 @@ test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1191: checking whether we are using GNU C++" >&5
+echo "configure:1182: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1196,7 +1187,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -1215,7 +1206,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1219: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1210: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1268,7 +1259,7 @@ EOF
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1272: checking for working aclocal" >&5
+echo "configure:1263: checking for working aclocal" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1281,7 +1272,7 @@ else
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1285: checking for working autoconf" >&5
+echo "configure:1276: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1294,7 +1285,7 @@ else
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1298: checking for working automake" >&5
+echo "configure:1289: checking for working automake" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1307,7 +1298,7 @@ else
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1311: checking for working autoheader" >&5
+echo "configure:1302: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1320,7 +1311,7 @@ else
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1324: checking for working makeinfo" >&5
+echo "configure:1315: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1339,7 +1330,7 @@ fi
 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
 # be run before AC_CANONICAL_HOST.
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1343: checking build system type" >&5
+echo "configure:1334: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1360,7 +1351,7 @@ echo "$ac_t""$build" 1>&6
 # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
 set dummy ${ac_tool_prefix}as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1364: checking for $ac_word" >&5
+echo "configure:1355: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1392,7 +1383,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1396: checking for $ac_word" >&5
+echo "configure:1387: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1424,7 +1415,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1428: checking for $ac_word" >&5
+echo "configure:1419: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1456,7 +1447,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1460: checking for $ac_word" >&5
+echo "configure:1451: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1501,7 +1492,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1505: checking for a BSD compatible install" >&5
+echo "configure:1496: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1555,7 +1546,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1559: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1550: checking whether to enable maintainer-specific portions of Makefiles" >&5
     # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then
   enableval="$enable_maintainer_mode"
@@ -1589,7 +1580,7 @@ if false; then
   
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1593: checking for executable suffix" >&5
+echo "configure:1584: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1599,10 +1590,10 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:1603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+      *.c | *.o | *.obj) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -1752,7 +1743,7 @@ ac_prog=ld
 if test "$ac_cv_prog_gcc" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
   echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1756: checking for ld used by GCC" >&5
+echo "configure:1747: checking for ld used by GCC" >&5
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -1782,10 +1773,10 @@ echo "configure:1756: checking for ld used by GCC" >&5
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1786: checking for GNU ld" >&5
+echo "configure:1777: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1789: checking for non-GNU ld" >&5
+echo "configure:1780: checking for non-GNU ld" >&5
 fi
 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1820,7 +1811,7 @@ else
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1824: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1815: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1837,7 +1828,7 @@ with_gnu_ld=$ac_cv_prog_gnu_ld
 
 
 echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1841: checking for $LD option to reload object files" >&5
+echo "configure:1832: checking for $LD option to reload object files" >&5
 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1849,7 +1840,7 @@ reload_flag=$lt_cv_ld_reload_flag
 test -n "$reload_flag" && reload_flag=" $reload_flag"
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1853: checking for BSD-compatible nm" >&5
+echo "configure:1844: checking for BSD-compatible nm" >&5
 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1887,7 +1878,7 @@ NM="$ac_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1891: checking whether ln -s works" >&5
+echo "configure:1882: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1908,7 +1899,7 @@ else
 fi
 
 echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1912: checking how to recognise dependant libraries" >&5
+echo "configure:1903: checking how to recognise dependant libraries" >&5
 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2051,13 +2042,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:2055: checking for object suffix" >&5
+echo "configure:2046: checking for object suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftest*
 echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:2061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -2081,7 +2072,7 @@ case "$deplibs_check_method" in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:2085: checking for ${ac_tool_prefix}file" >&5
+echo "configure:2076: checking for ${ac_tool_prefix}file" >&5
 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2143,7 +2134,7 @@ fi
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:2147: checking for file" >&5
+echo "configure:2138: checking for file" >&5
 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2214,7 +2205,7 @@ esac
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2218: checking for $ac_word" >&5
+echo "configure:2209: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2246,7 +2237,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2250: checking for $ac_word" >&5
+echo "configure:2241: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2281,7 +2272,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2285: checking for $ac_word" >&5
+echo "configure:2276: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2313,7 +2304,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2317: checking for $ac_word" >&5
+echo "configure:2308: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2380,8 +2371,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
 case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 2384 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:2385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 2375 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:2376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -2402,7 +2393,7 @@ case "$host" in
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2406: checking whether the C compiler needs -belf" >&5
+echo "configure:2397: checking whether the C compiler needs -belf" >&5
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2415,14 +2406,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
 cross_compiling=$ac_cv_prog_cc_cross
 
      cat > conftest.$ac_ext <<EOF
-#line 2419 "configure"
+#line 2410 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -2452,7 +2443,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
 esac
 
 echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:2456: checking how to run the C++ preprocessor" >&5
+echo "configure:2447: checking how to run the C++ preprocessor" >&5
 if test -z "$CXXCPP"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2465,12 +2456,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
 cross_compiling=$ac_cv_prog_cxx_cross
   CXXCPP="${CXX-g++} -E"
   cat > conftest.$ac_ext <<EOF
-#line 2469 "configure"
+#line 2460 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2465: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2710,18 +2701,18 @@ if test "$ac_cv_prog_gnu_ld" = yes; then
 fi   
 
 echo $ac_n "checking for data_start""... $ac_c" 1>&6
-echo "configure:2714: checking for data_start" >&5
+echo "configure:2705: checking for data_start" >&5
 LIBDATASTARTSPEC=
 NEEDS_DATA_START=
 cat > conftest.$ac_ext <<EOF
-#line 2718 "configure"
+#line 2709 "configure"
 #include "confdefs.h"
 extern int data_start;
 int main() {
 return ((int) &data_start);
 ; return 0; }
 EOF
-if { (eval echo configure:2725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""found it" 1>&6
 else
@@ -2791,7 +2782,7 @@ EOF
 esac
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2795: checking how to run the C preprocessor" >&5
+echo "configure:2786: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2806,13 +2797,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2810 "configure"
+#line 2801 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2823,13 +2814,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2827 "configure"
+#line 2818 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2840,13 +2831,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 2844 "configure"
+#line 2835 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2871,7 +2862,7 @@ fi
 echo "$ac_t""$CPP" 1>&6
 
 cat > conftest.$ac_ext <<EOF
-#line 2875 "configure"
+#line 2866 "configure"
 #include "confdefs.h"
 #include <stdint.h>
 EOF
@@ -2886,7 +2877,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 2890 "configure"
+#line 2881 "configure"
 #include "confdefs.h"
 #include <inttypes.h>
 EOF
@@ -2901,7 +2892,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 2905 "configure"
+#line 2896 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -2916,7 +2907,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 2920 "configure"
+#line 2911 "configure"
 #include "confdefs.h"
 #include <sys/config.h>
 EOF
@@ -2933,7 +2924,7 @@ rm -f conftest*
 
 
 cat > conftest.$ac_ext <<EOF
-#line 2937 "configure"
+#line 2928 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -2948,7 +2939,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 2952 "configure"
+#line 2943 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -2991,7 +2982,7 @@ ZLIBTESTSPEC=
 libsubdir=.libs
 
 echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
-echo "configure:2995: checking for garbage collector to use" >&5
+echo "configure:2986: checking for garbage collector to use" >&5
 # Check whether --enable-java-gc or --disable-java-gc was given.
 if test "${enable_java_gc+set}" = set; then
   enableval="$enable_java_gc"
@@ -3047,7 +3038,7 @@ esac
 
 
 echo $ac_n "checking for threads package to use""... $ac_c" 1>&6
-echo "configure:3051: checking for threads package to use" >&5
+echo "configure:3042: checking for threads package to use" >&5
 # Check whether --enable-threads or --disable-threads was given.
 if test "${enable_threads+set}" = set; then
   enableval="$enable_threads"
@@ -3241,12 +3232,12 @@ else
    for ac_func in strerror ioctl select fstat open fsync sleep
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3245: checking for $ac_func" >&5
+echo "configure:3236: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3250 "configure"
+#line 3241 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3269,7 +3260,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3296,12 +3287,12 @@ done
    for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3300: checking for $ac_func" >&5
+echo "configure:3291: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3305 "configure"
+#line 3296 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3324,7 +3315,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3351,12 +3342,12 @@ done
    for ac_func in access stat mkdir rename rmdir unlink realpath
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3355: checking for $ac_func" >&5
+echo "configure:3346: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3360 "configure"
+#line 3351 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3379,7 +3370,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3406,12 +3397,12 @@ done
    for ac_func in iconv nl_langinfo
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3410: checking for $ac_func" >&5
+echo "configure:3401: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3415 "configure"
+#line 3406 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3434,7 +3425,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3461,12 +3452,12 @@ done
    for ac_func in inet_aton inet_addr
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3465: checking for $ac_func" >&5
+echo "configure:3456: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3470 "configure"
+#line 3461 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3489,7 +3480,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3516,12 +3507,12 @@ done
    for ac_func in inet_pton uname inet_ntoa
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3520: checking for $ac_func" >&5
+echo "configure:3511: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3525 "configure"
+#line 3516 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3544,7 +3535,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3571,12 +3562,12 @@ done
    for ac_func in backtrace fork execvp pipe
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3575: checking for $ac_func" >&5
+echo "configure:3566: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3580 "configure"
+#line 3571 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3599,7 +3590,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3627,17 +3618,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3631: checking for $ac_hdr" >&5
+echo "configure:3622: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3636 "configure"
+#line 3627 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3641: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3664,7 +3655,7 @@ fi
 done
  
    echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6
-echo "configure:3668: checking for dladdr in -ldl" >&5
+echo "configure:3659: checking for dladdr in -ldl" >&5
 ac_lib_var=`echo dl'_'dladdr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3672,7 +3663,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3676 "configure"
+#line 3667 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3683,7 +3674,7 @@ int main() {
 dladdr()
 ; return 0; }
 EOF
-if { (eval echo configure:3687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3712,7 +3703,7 @@ do
 
 ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
-echo "configure:3716: checking for $ac_file" >&5
+echo "configure:3707: checking for $ac_file" >&5
 if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3747,12 +3738,12 @@ done
    for ac_func in gethostbyname_r
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3751: checking for $ac_func" >&5
+echo "configure:3742: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3756 "configure"
+#line 3747 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3775,7 +3766,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3802,7 +3793,7 @@ EOF
      # We look for the one that returns `int'.
      # Hopefully this check is robust enough.
      cat > conftest.$ac_ext <<EOF
-#line 3806 "configure"
+#line 3797 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 EOF
@@ -3822,7 +3813,7 @@ rm -f conftest*
      *" -D_REENTRANT "*) ;;
      *)
                echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
-echo "configure:3826: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+echo "configure:3817: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
 if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3835,14 +3826,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
 cross_compiling=$ac_cv_prog_cxx_cross
 
          cat > conftest.$ac_ext <<EOF
-#line 3839 "configure"
+#line 3830 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 int main() {
 gethostbyname_r("", 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:3846: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3837: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libjava_cv_gethostbyname_r_needs_reentrant=no
 else
@@ -3852,14 +3843,14 @@ else
                CPPFLAGS_SAVE="$CPPFLAGS"
                CPPFLAGS="$CPPFLAGS -D_REENTRANT"
                cat > conftest.$ac_ext <<EOF
-#line 3856 "configure"
+#line 3847 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 int main() {
 gethostbyname_r("", 0, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:3863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libjava_cv_gethostbyname_r_needs_reentrant=yes
 else
@@ -3894,12 +3885,12 @@ EOF
      esac
 
      echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
-echo "configure:3898: checking for struct hostent_data" >&5
+echo "configure:3889: checking for struct hostent_data" >&5
 if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        cat > conftest.$ac_ext <<EOF
-#line 3903 "configure"
+#line 3894 "configure"
 #include "confdefs.h"
 
 #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
@@ -3910,7 +3901,7 @@ int main() {
 struct hostent_data data;
 ; return 0; }
 EOF
-if { (eval echo configure:3914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libjava_cv_struct_hostent_data=yes
 else
@@ -3939,12 +3930,12 @@ done
    for ac_func in gethostbyaddr_r
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3943: checking for $ac_func" >&5
+echo "configure:3934: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3948 "configure"
+#line 3939 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3967,7 +3958,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3994,7 +3985,7 @@ EOF
      # We look for the one that returns `int'.
      # Hopefully this check is robust enough.
      cat > conftest.$ac_ext <<EOF
-#line 3998 "configure"
+#line 3989 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 EOF
@@ -4018,12 +4009,12 @@ done
    for ac_func in gethostname
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4022: checking for $ac_func" >&5
+echo "configure:4013: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4027 "configure"
+#line 4018 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4046,7 +4037,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4070,7 +4061,7 @@ EOF
 EOF
 
      cat > conftest.$ac_ext <<EOF
-#line 4074 "configure"
+#line 4065 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -4101,12 +4092,12 @@ done
       for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4105: checking for $ac_func" >&5
+echo "configure:4096: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4110 "configure"
+#line 4101 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4129,7 +4120,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4159,12 +4150,12 @@ done
       for ac_func in sched_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4163: checking for $ac_func" >&5
+echo "configure:4154: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4168 "configure"
+#line 4159 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4187,7 +4178,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4209,7 +4200,7 @@ EOF
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:4213: checking for sched_yield in -lrt" >&5
+echo "configure:4204: checking for sched_yield in -lrt" >&5
 ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4217,7 +4208,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4221 "configure"
+#line 4212 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4228,7 +4219,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:4232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4254,7 +4245,7 @@ else
   echo "$ac_t""no" 1>&6
 
          echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:4258: checking for sched_yield in -lposix4" >&5
+echo "configure:4249: checking for sched_yield in -lposix4" >&5
 ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4262,7 +4253,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4266 "configure"
+#line 4257 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4273,7 +4264,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:4277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4309,7 +4300,7 @@ done
       # We can save a little space at runtime if the mutex has m_count
       # or __m_count.  This is a nice hack for Linux.
       cat > conftest.$ac_ext <<EOF
-#line 4313 "configure"
+#line 4304 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 int main() {
@@ -4318,7 +4309,7 @@ int main() {
         
 ; return 0; }
 EOF
-if { (eval echo configure:4322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define PTHREAD_MUTEX_HAVE_M_COUNT 1
@@ -4330,7 +4321,7 @@ else
   rm -rf conftest*
   
        cat > conftest.$ac_ext <<EOF
-#line 4334 "configure"
+#line 4325 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 int main() {
@@ -4339,7 +4330,7 @@ int main() {
          
 ; return 0; }
 EOF
-if { (eval echo configure:4343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4334: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define PTHREAD_MUTEX_HAVE___M_COUNT 1
@@ -4359,12 +4350,12 @@ rm -f conftest*
    for ac_func in gettimeofday time ftime
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4363: checking for $ac_func" >&5
+echo "configure:4354: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4368 "configure"
+#line 4359 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4387,7 +4378,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4418,12 +4409,12 @@ done
    for ac_func in memmove
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4422: checking for $ac_func" >&5
+echo "configure:4413: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4427 "configure"
+#line 4418 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4446,7 +4437,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4476,12 +4467,12 @@ done
    for ac_func in memcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4480: checking for $ac_func" >&5
+echo "configure:4471: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4485 "configure"
+#line 4476 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4504,7 +4495,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4552,7 +4543,7 @@ done
    #--------------------------------------------------------------------
 
    echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:4556: checking for socket libraries" >&5
+echo "configure:4547: checking for socket libraries" >&5
 if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4560,12 +4551,12 @@ else
      gcj_checkBoth=0
      unset ac_cv_func_connect
      echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:4564: checking for connect" >&5
+echo "configure:4555: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4569 "configure"
+#line 4560 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -4588,7 +4579,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -4611,7 +4602,7 @@ fi
      if test "$gcj_checkSocket" = 1; then
         unset ac_cv_func_connect
         echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:4615: checking for main in -lsocket" >&5
+echo "configure:4606: checking for main in -lsocket" >&5
 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4619,14 +4610,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4623 "configure"
+#line 4614 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4653,12 +4644,12 @@ fi
         LIBS="$LIBS -lsocket -lnsl"
         unset ac_cv_func_accept
         echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:4657: checking for accept" >&5
+echo "configure:4648: checking for accept" >&5
 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4662 "configure"
+#line 4653 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char accept(); below.  */
@@ -4681,7 +4672,7 @@ accept();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_accept=yes"
 else
@@ -4708,12 +4699,12 @@ fi
      gcj_oldLibs=$LIBS
      LIBS="$LIBS $gcj_cv_lib_sockets"
      echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:4712: checking for gethostbyname" >&5
+echo "configure:4703: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4717 "configure"
+#line 4708 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -4736,7 +4727,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -4754,7 +4745,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:4758: checking for main in -lnsl" >&5
+echo "configure:4749: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4762,14 +4753,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4766 "configure"
+#line 4757 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4801,7 +4792,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
 
    if test "$with_system_zlib" = yes; then
       echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:4805: checking for deflate in -lz" >&5
+echo "configure:4796: checking for deflate in -lz" >&5
 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4809,7 +4800,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lz  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4813 "configure"
+#line 4804 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4820,7 +4811,7 @@ int main() {
 deflate()
 ; return 0; }
 EOF
-if { (eval echo configure:4824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4850,7 +4841,7 @@ fi
    # requires -ldl.
    if test "$GC" = boehm; then
       echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:4854: checking for main in -ldl" >&5
+echo "configure:4845: checking for main in -ldl" >&5
 ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4858,14 +4849,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4862 "configure"
+#line 4853 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:4869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4912,7 +4903,7 @@ GCJ="$GCJ -I$srcdir"
   # Extract the first word of "${ac_tool_prefix}gcj", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcj; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4916: checking for $ac_word" >&5
+echo "configure:4907: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4944,7 +4935,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "gcj", so it can be a program name with args.
 set dummy gcj; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4948: checking for $ac_word" >&5
+echo "configure:4939: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5004,7 +4995,7 @@ exec 5>>./config.log
 
 
 echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:5008: checking size of void *" >&5
+echo "configure:4999: checking size of void *" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5012,7 +5003,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 5016 "configure"
+#line 5007 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -5023,7 +5014,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:5027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_void_p=`cat conftestval`
 else
@@ -5121,7 +5112,7 @@ EOF
 # See if gcj supports -fuse-divide-subroutine.  gcc 2.95 does not, and
 # we want to continue to support that version.
 echo $ac_n "checking whether gcj supports -fuse-divide-subroutine""... $ac_c" 1>&6
-echo "configure:5125: checking whether gcj supports -fuse-divide-subroutine" >&5
+echo "configure:5116: checking whether gcj supports -fuse-divide-subroutine" >&5
 cat > conftest.java << 'END'
 public class conftest { }
 END
@@ -5138,18 +5129,18 @@ echo "$ac_t""$use_fuse" 1>&6
 
 
 echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6
-echo "configure:5142: checking for g++ -ffloat-store bug" >&5
+echo "configure:5133: checking for g++ -ffloat-store bug" >&5
 save_CFLAGS="$CFLAGS"
 CFLAGS="-x c++ -O2 -ffloat-store"
 cat > conftest.$ac_ext <<EOF
-#line 5146 "configure"
+#line 5137 "configure"
 #include "confdefs.h"
 #include <math.h>
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
 else
@@ -5169,17 +5160,17 @@ for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5173: checking for $ac_hdr" >&5
+echo "configure:5164: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5178 "configure"
+#line 5169 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5209,17 +5200,17 @@ for ac_hdr in dirent.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5213: checking for $ac_hdr" >&5
+echo "configure:5204: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5218 "configure"
+#line 5209 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5247,12 +5238,12 @@ done
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:5251: checking for ANSI C header files" >&5
+echo "configure:5242: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5256 "configure"
+#line 5247 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -5260,7 +5251,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5264: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5255: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5277,7 +5268,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 5281 "configure"
+#line 5272 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -5295,7 +5286,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 5299 "configure"
+#line 5290 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -5316,7 +5307,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 5320 "configure"
+#line 5311 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -5327,7 +5318,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:5331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -5351,12 +5342,12 @@ EOF
 fi
 
 echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:5355: checking for ssize_t" >&5
+echo "configure:5346: checking for ssize_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5360 "configure"
+#line 5351 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5385,9 +5376,9 @@ fi
 
 
 echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
-echo "configure:5389: checking for in_addr_t" >&5
+echo "configure:5380: checking for in_addr_t" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5391 "configure"
+#line 5382 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5401,7 +5392,7 @@ int main() {
 in_addr_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:5405: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_IN_ADDR_T 1
@@ -5417,16 +5408,16 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:5421: checking whether struct ip_mreq is in netinet/in.h" >&5
+echo "configure:5412: checking whether struct ip_mreq is in netinet/in.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5423 "configure"
+#line 5414 "configure"
 #include "confdefs.h"
 #include <netinet/in.h>
 int main() {
 struct ip_mreq mreq;
 ; return 0; }
 EOF
-if { (eval echo configure:5430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_STRUCT_IP_MREQ 1
@@ -5442,16 +5433,16 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:5446: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+echo "configure:5437: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5448 "configure"
+#line 5439 "configure"
 #include "confdefs.h"
 #include <netinet/in.h>
 int main() {
 struct sockaddr_in6 addr6;
 ; return 0; }
 EOF
-if { (eval echo configure:5455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5446: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_INET6 1
@@ -5467,9 +5458,9 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:5471: checking for socklen_t in sys/socket.h" >&5
+echo "configure:5462: checking for socklen_t in sys/socket.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5473 "configure"
+#line 5464 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -5477,7 +5468,7 @@ int main() {
 socklen_t x = 5;
 ; return 0; }
 EOF
-if { (eval echo configure:5481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_SOCKLEN_T 1
@@ -5493,16 +5484,16 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:5497: checking for tm_gmtoff in struct tm" >&5
+echo "configure:5488: checking for tm_gmtoff in struct tm" >&5
 cat > conftest.$ac_ext <<EOF
-#line 5499 "configure"
+#line 5490 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 struct tm tim; tim.tm_gmtoff = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:5506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define STRUCT_TM_HAS_GMTOFF 1
@@ -5515,16 +5506,16 @@ else
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
    echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
-echo "configure:5519: checking for global timezone variable" >&5
+echo "configure:5510: checking for global timezone variable" >&5
             cat > conftest.$ac_ext <<EOF
-#line 5521 "configure"
+#line 5512 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() {
 long z2 = timezone;
 ; return 0; }
 EOF
-if { (eval echo configure:5528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define HAVE_TIMEZONE 1
@@ -5544,19 +5535,19 @@ rm -f conftest*
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5548: checking for working alloca.h" >&5
+echo "configure:5539: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5553 "configure"
+#line 5544 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
-char *p = alloca(2 * sizeof(int));
+void *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:5560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -5577,12 +5568,12 @@ EOF
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5581: checking for alloca" >&5
+echo "configure:5572: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5586 "configure"
+#line 5577 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -5610,7 +5601,7 @@ int main() {
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:5614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -5642,12 +5633,12 @@ EOF
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5646: checking whether alloca needs Cray hooks" >&5
+echo "configure:5637: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5651 "configure"
+#line 5642 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -5672,12 +5663,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5676: checking for $ac_func" >&5
+echo "configure:5667: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5681 "configure"
+#line 5672 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5700,7 +5691,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5727,7 +5718,7 @@ done
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5731: checking stack direction for C alloca" >&5
+echo "configure:5722: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5735,7 +5726,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 5739 "configure"
+#line 5730 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -5754,7 +5745,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:5758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -5781,7 +5772,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5785: checking for $ac_word" >&5
+echo "configure:5776: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5845,6 +5836,851 @@ else
   multilib_arg=
 fi
 
+# If we find X, set shell vars x_includes and x_libraries to the
+# paths, otherwise set no_x=yes.
+# Uses ac_ vars as temps to allow command line to override cache and checks.
+# --without-x overrides everything else, but does not touch the cache.
+echo $ac_n "checking for X""... $ac_c" 1>&6
+echo "configure:5845: checking for X" >&5
+
+# Check whether --with-x or --without-x was given.
+if test "${with_x+set}" = set; then
+  withval="$with_x"
+  :
+fi
+
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+  # The user explicitly disabled X.
+  have_x=disabled
+else
+  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+    # Both variables are already set.
+    have_x=yes
+  else
+if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=NO ac_x_libraries=NO
+rm -fr conftestdir
+if mkdir conftestdir; then
+  cd conftestdir
+  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+  cat > Imakefile <<'EOF'
+acfindx:
+       @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+EOF
+  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+    for ac_extension in a so sl; do
+      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+        test -f $ac_im_libdir/libX11.$ac_extension; then
+        ac_im_usrlibdir=$ac_im_libdir; break
+      fi
+    done
+    # Screen out bogus values from the imake configuration.  They are
+    # bogus both because they are the default anyway, and because
+    # using them would break gcc on systems where it needs fixed includes.
+    case "$ac_im_incroot" in
+       /usr/include) ;;
+       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
+    esac
+    case "$ac_im_usrlibdir" in
+       /usr/lib | /lib) ;;
+       *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
+    esac
+  fi
+  cd ..
+  rm -fr conftestdir
+fi
+
+if test "$ac_x_includes" = NO; then
+  # Guess where to find include files, by looking for this one X11 .h file.
+  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+
+  # First, try using that file with no special directory specified.
+cat > conftest.$ac_ext <<EOF
+#line 5907 "configure"
+#include "confdefs.h"
+#include <$x_direct_test_include>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:5912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  # Look for the header file in a standard set of common directories.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+  for ac_dir in               \
+    /usr/X11/include          \
+    /usr/X11R6/include        \
+    /usr/X11R5/include        \
+    /usr/X11R4/include        \
+                              \
+    /usr/include/X11          \
+    /usr/include/X11R6        \
+    /usr/include/X11R5        \
+    /usr/include/X11R4        \
+                              \
+    /usr/local/X11/include    \
+    /usr/local/X11R6/include  \
+    /usr/local/X11R5/include  \
+    /usr/local/X11R4/include  \
+                              \
+    /usr/local/include/X11    \
+    /usr/local/include/X11R6  \
+    /usr/local/include/X11R5  \
+    /usr/local/include/X11R4  \
+                              \
+    /usr/X386/include         \
+    /usr/x386/include         \
+    /usr/XFree86/include/X11  \
+                              \
+    /usr/include              \
+    /usr/local/include        \
+    /usr/unsupported/include  \
+    /usr/athena/include       \
+    /usr/local/x11r5/include  \
+    /usr/lpp/Xamples/include  \
+                              \
+    /usr/openwin/include      \
+    /usr/openwin/share/include \
+    ; \
+  do
+    if test -r "$ac_dir/$x_direct_test_include"; then
+      ac_x_includes=$ac_dir
+      break
+    fi
+  done
+fi
+rm -f conftest*
+fi # $ac_x_includes = NO
+
+if test "$ac_x_libraries" = NO; then
+  # Check for the libraries.
+
+  test -z "$x_direct_test_library" && x_direct_test_library=Xt
+  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
+
+  # See if we find them without any special options.
+  # Don't add to $LIBS permanently.
+  ac_save_LIBS="$LIBS"
+  LIBS="-l$x_direct_test_library $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5981 "configure"
+#include "confdefs.h"
+
+int main() {
+${x_direct_test_function}()
+; return 0; }
+EOF
+if { (eval echo configure:5988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  LIBS="$ac_save_LIBS"
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  LIBS="$ac_save_LIBS"
+# First see if replacing the include by lib works.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
+    /usr/X11/lib          \
+    /usr/X11R6/lib        \
+    /usr/X11R5/lib        \
+    /usr/X11R4/lib        \
+                          \
+    /usr/lib/X11          \
+    /usr/lib/X11R6        \
+    /usr/lib/X11R5        \
+    /usr/lib/X11R4        \
+                          \
+    /usr/local/X11/lib    \
+    /usr/local/X11R6/lib  \
+    /usr/local/X11R5/lib  \
+    /usr/local/X11R4/lib  \
+                          \
+    /usr/local/lib/X11    \
+    /usr/local/lib/X11R6  \
+    /usr/local/lib/X11R5  \
+    /usr/local/lib/X11R4  \
+                          \
+    /usr/X386/lib         \
+    /usr/x386/lib         \
+    /usr/XFree86/lib/X11  \
+                          \
+    /usr/lib              \
+    /usr/local/lib        \
+    /usr/unsupported/lib  \
+    /usr/athena/lib       \
+    /usr/local/x11r5/lib  \
+    /usr/lpp/Xamples/lib  \
+    /lib/usr/lib/X11     \
+                          \
+    /usr/openwin/lib      \
+    /usr/openwin/share/lib \
+    ; \
+do
+  for ac_extension in a so sl; do
+    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+      ac_x_libraries=$ac_dir
+      break 2
+    fi
+  done
+done
+fi
+rm -f conftest*
+fi # $ac_x_libraries = NO
+
+if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi
+fi
+  fi
+  eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+  echo "$ac_t""$have_x" 1>&6
+  no_x=yes
+else
+  # If each of the values was on the command line, it overrides each guess.
+  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
+fi
+
+if test "$no_x" = yes; then
+  # Not all programs may use this symbol, but it does not hurt to define it.
+  cat >> confdefs.h <<\EOF
+#define X_DISPLAY_MISSING 1
+EOF
+
+  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+  if test -n "$x_includes"; then
+    X_CFLAGS="$X_CFLAGS -I$x_includes"
+  fi
+
+  # It would also be nice to do this for all -L options, not just this one.
+  if test -n "$x_libraries"; then
+    X_LIBS="$X_LIBS -L$x_libraries"
+    # For Solaris; some versions of Sun CC require a space after -R and
+    # others require no space.  Words are not sufficient . . . .
+    case "`(uname -sr) 2>/dev/null`" in
+    "SunOS 5"*)
+      echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
+echo "configure:6094: checking whether -R must be followed by a space" >&5
+      ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
+      cat > conftest.$ac_ext <<EOF
+#line 6097 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:6104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_R_nospace=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_R_nospace=no
+fi
+rm -f conftest*
+      if test $ac_R_nospace = yes; then
+       echo "$ac_t""no" 1>&6
+       X_LIBS="$X_LIBS -R$x_libraries"
+      else
+       LIBS="$ac_xsave_LIBS -R $x_libraries"
+       cat > conftest.$ac_ext <<EOF
+#line 6120 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:6127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_R_space=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_R_space=no
+fi
+rm -f conftest*
+       if test $ac_R_space = yes; then
+         echo "$ac_t""yes" 1>&6
+         X_LIBS="$X_LIBS -R $x_libraries"
+       else
+         echo "$ac_t""neither works" 1>&6
+       fi
+      fi
+      LIBS="$ac_xsave_LIBS"
+    esac
+  fi
+
+  # Check for system-dependent libraries X programs must link with.
+  # Do this before checking for the system-independent R6 libraries
+  # (-lICE), since we may need -lsocket or whatever for X linking.
+
+  if test "$ISC" = yes; then
+    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+  else
+    # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
+    # libraries were built with DECnet support.  And karl@cs.umb.edu says
+    # the Alpha needs dnet_stub (dnet does not exist).
+    echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
+echo "configure:6159: checking for dnet_ntoa in -ldnet" >&5
+ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldnet  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6167 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dnet_ntoa();
+
+int main() {
+dnet_ntoa()
+; return 0; }
+EOF
+if { (eval echo configure:6178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+      echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
+echo "configure:6200: checking for dnet_ntoa in -ldnet_stub" >&5
+ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldnet_stub  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6208 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dnet_ntoa();
+
+int main() {
+dnet_ntoa()
+; return 0; }
+EOF
+if { (eval echo configure:6219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+    # to get the SysV transport functions.
+    # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
+    # needs -lnsl.
+    # The nsl library prevents programs from opening the X display
+    # on Irix 5.2, according to dickey@clark.net.
+    echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:6248: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6253 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    if test $ac_cv_func_gethostbyname = no; then
+      echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:6297: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6305 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:6316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    # lieder@skyler.mavd.honeywell.com says without -lsocket,
+    # socket/setsockopt and other routines are undefined under SCO ODT
+    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
+    # on later versions), says simon@lia.di.epfl.ch: it contains
+    # gethostby* variants that don't use the nameserver (or something).
+    # -lsocket must be given before -lnsl if both are needed.
+    # We assume that if connect needs -lnsl, so does gethostbyname.
+    echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:6346: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6351 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char connect(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char connect();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+connect();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_connect=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_connect=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    if test $ac_cv_func_connect = no; then
+      echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
+echo "configure:6395: checking for connect in -lsocket" >&5
+ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6403 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char connect();
+
+int main() {
+connect()
+; return 0; }
+EOF
+if { (eval echo configure:6414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
+    echo $ac_n "checking for remove""... $ac_c" 1>&6
+echo "configure:6438: checking for remove" >&5
+if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6443 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char remove(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char remove();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_remove) || defined (__stub___remove)
+choke me
+#else
+remove();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_remove=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_remove=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    if test $ac_cv_func_remove = no; then
+      echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
+echo "configure:6487: checking for remove in -lposix" >&5
+ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lposix  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6495 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char remove();
+
+int main() {
+remove()
+; return 0; }
+EOF
+if { (eval echo configure:6506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+    echo $ac_n "checking for shmat""... $ac_c" 1>&6
+echo "configure:6530: checking for shmat" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6535 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shmat(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shmat();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_shmat) || defined (__stub___shmat)
+choke me
+#else
+shmat();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_shmat=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_shmat=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    if test $ac_cv_func_shmat = no; then
+      echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
+echo "configure:6579: checking for shmat in -lipc" >&5
+ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lipc  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6587 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shmat();
+
+int main() {
+shmat()
+; return 0; }
+EOF
+if { (eval echo configure:6598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+  fi
+
+  # Check for libraries that X11R6 Xt/Xaw programs need.
+  ac_save_LDFLAGS="$LDFLAGS"
+  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+  # check for ICE first), but we must link in the order -lSM -lICE or
+  # we get undefined symbols.  So assume we have SM if we have ICE.
+  # These have to be linked with before -lX11, unlike the other
+  # libraries we check for below, so use a different variable.
+  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+  echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
+echo "configure:6631: checking for IceConnectionNumber in -lICE" >&5
+ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6639 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char IceConnectionNumber();
+
+int main() {
+IceConnectionNumber()
+; return 0; }
+EOF
+if { (eval echo configure:6650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  LDFLAGS="$ac_save_LDFLAGS"
+
+fi
+
+
+
+
+if test "$no_x" = yes; then
+  NO_X_TRUE=
+  NO_X_FALSE='#'
+else
+  NO_X_TRUE='#'
+  NO_X_FALSE=
+fi
+
 here=`pwd`
 
 
@@ -6076,6 +6912,12 @@ s%@AM_RUNTESTFLAGS@%$AM_RUNTESTFLAGS%g
 s%@ALLOCA@%$ALLOCA%g
 s%@PERL@%$PERL%g
 s%@SYSDEP_SOURCES@%$SYSDEP_SOURCES%g
+s%@X_CFLAGS@%$X_CFLAGS%g
+s%@X_PRE_LIBS@%$X_PRE_LIBS%g
+s%@X_LIBS@%$X_LIBS%g
+s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
+s%@NO_X_TRUE@%$NO_X_TRUE%g
+s%@NO_X_FALSE@%$NO_X_FALSE%g
 s%@here@%$here%g
 
 CEOF
index f29e73d756a27460e8c80478cf108be4bd06326f..81f0d09ef2382bb081324d102a23f611db89daff 100644 (file)
@@ -762,6 +762,10 @@ else
   multilib_arg=
 fi
 
+AC_PATH_XTRA
+
+AM_CONDITIONAL(NO_X, test "$no_x" = yes)
+
 here=`pwd`
 AC_SUBST(here)
 
diff --git a/libjava/gnu/awt/LightweightRedirector.java b/libjava/gnu/awt/LightweightRedirector.java
new file mode 100644 (file)
index 0000000..a0ea7bc
--- /dev/null
@@ -0,0 +1,183 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt;
+
+import java.awt.AWTEvent;
+import java.awt.AWTError;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.event.MouseEvent;
+import java.awt.event.InputEvent;
+
+/**
+ * Encapsulates the logic required to dispatch events to the correct
+ * component in a component tree that may contain lightweight
+ * components. Toolkits typically only identify heavyweight components
+ * as the source of events. This class redirects the events to the
+ * appropriate lightweight children of the heavyweight component.
+ */
+public class LightweightRedirector
+{
+  final static int LAST_BUTTON_NUMBER = 3;
+
+  /* We sacrifice one array element to allow the button number to 
+     match the index of this array. */
+  Component[] releaseTargets = new Component[LAST_BUTTON_NUMBER+1];
+
+  /** 
+   *
+   * Modifies or replaces the given event with an event that has been
+   * properly redirected.  State of button presses are kept so that
+   * button releases can be redirected to the same component as the
+   * button press.  It is required that all events are sent through
+   * this method in chronological order.
+   */
+  public AWTEvent redirect(AWTEvent event)
+  {
+    if (event instanceof MouseEvent)
+      return redirectMouse((MouseEvent) event);
+
+    /* In case we don't know how to redirect the event, simply return
+       the event unchanged. */
+    return event;
+  }
+
+  MouseEvent redirectMouse(MouseEvent event)
+  {
+    int button = getButtonNumber(event);
+    int id = event.getID();
+
+    Component heavySource = (Component) event.getSource();
+    Component source = heavySource;
+    int x = event.getX();
+    int y = event.getY();
+
+    if (id == MouseEvent.MOUSE_RELEASED)
+      {
+       Component target = releaseTargets[button];
+
+       if (target != null)
+         {
+           releaseTargets[button] = null;
+           source = target;
+
+           Component child = source;
+           while (child != heavySource)
+             {
+               x -= child.getX();
+               y -= child.getY();
+               child = child.getParent();
+               if (child == null)
+                 System.err.println("warning, orphaned release target");
+             }
+         }
+      }
+    else
+      {
+       /* Find real component, and adjust source, x and y
+          accordingly. */
+       
+       while (true)
+         {
+           Component parent = source;
+           
+           Component child = parent.getComponentAt(x, y);
+           
+           if (parent == child)
+             break;
+           
+           // maybe ignoring would be better?
+           if (child == null)
+             {
+               String msg = "delivered event not within component. " +
+                 "Heavyweight source was " + heavySource + ". " +
+                 "Component was " + parent;
+               throw new AWTError(msg);
+             }
+           if (child.isLightweight())
+             {
+               // descend down to child
+               source = child;
+               x -= child.getX();
+               y -= child.getY();
+             }
+           else
+             {
+               System.err.println("warning: event delivered to wrong " +
+                                  "heavyweight component. Was " +
+                                  "delivered to " + source + ". " +
+                                  "Should have been delivered to " +
+                                  child + ". Maybe the native window " +
+                                  "system is bubbling events up the " +
+                                  "containment hierarchy.");
+               break;
+             }
+         }
+       
+       /* ensure that the release event is delivered to the same
+          component as the press event. For most toolkits this is
+          only necessary for lightweight components, since the
+          underlying windowing system takes care of its heavyweight
+          components. */
+       if (id == MouseEvent.MOUSE_PRESSED)
+         releaseTargets[button] = source;
+      }
+    
+    
+    if (source == heavySource)
+      return event; // no change in event
+    
+    // print warning for heavyweights
+    /* this warning can safely be removed if a toolkit that
+       needs heavyweight redirection support is ever created. */
+    if (!source.isLightweight())
+      System.err.println("warning: redirecting to heavyweight");
+    
+    MouseEvent redirected = new MouseEvent(source, event.getID(),
+                                          event.getWhen(),
+                                          event.getModifiers(),
+                                          x, y,
+                                          event.getClickCount(),
+                                          event.isPopupTrigger());
+    
+    return redirected;
+  }
+  
+  /**
+   * Identifies the button number for an input event.
+   * 
+   * @returns the button number, or 0 if no button modifier was set
+   * for the event.
+   */
+  int getButtonNumber(InputEvent event)
+  {
+    int modifiers = event.getModifiers();
+    
+    modifiers &=
+      InputEvent.BUTTON1_MASK |
+      InputEvent.BUTTON2_MASK |
+      InputEvent.BUTTON3_MASK;
+    
+    switch (modifiers)
+      {
+      case InputEvent.BUTTON1_MASK:
+       return 1;
+      case InputEvent.BUTTON2_MASK:
+       return 2;
+      case InputEvent.BUTTON3_MASK:
+       return 3;
+      case 0:
+       return 0;
+
+      default:
+       System.err.println("FIXME: multibutton event");
+       return 0;
+      }
+  }
+}
diff --git a/libjava/gnu/awt/j2d/AbstractGraphicsState.java b/libjava/gnu/awt/j2d/AbstractGraphicsState.java
new file mode 100644 (file)
index 0000000..e3b3ec6
--- /dev/null
@@ -0,0 +1,128 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.j2d;
+
+import java.awt.Color;
+import java.awt.Image;
+import java.awt.Shape;
+import java.awt.Rectangle;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.image.ImageObserver;
+
+/**
+ * Base class for graphics state objects (State pattern, GOF book)
+ * that represents the current pipeline configuration. The Graphics2D
+ * object forwards most of the requests to the state object. The
+ * Graphics2D object itself only administers properties that are not
+ * specific for a certain state.
+ */
+public abstract class AbstractGraphicsState implements Cloneable
+{
+  Graphics2DImpl frontend;
+
+  public void setFrontend(Graphics2DImpl frontend)
+  {
+    this.frontend = frontend;
+  }
+  
+  public void dispose()
+  {
+    frontend = null;
+  }
+
+  // -------- Graphics methods:
+  
+  public abstract void setColor(Color color);
+
+  public abstract void setPaintMode();
+
+  public abstract void setXORMode(Color altColor);
+
+  public abstract void setFont(Font font);
+
+  public abstract FontMetrics getFontMetrics(Font font);
+
+  public abstract void setClip(Shape clip);
+
+  public abstract Shape getClip();
+  public abstract Rectangle getClipBounds();
+
+  public abstract void copyArea(int x, int y, 
+                               int width, int height,
+                               int dx, int dy);
+
+  public abstract void drawLine(int x1, int y1,
+                               int x2, int y2);
+  
+  public abstract void fillRect(int x, int y,
+                               int width, int height);
+  
+  public abstract void clearRect(int x, int y,
+                                int width, int height);
+  
+  public abstract void drawRoundRect(int x, int y,
+                                    int width, int height,
+                                    int arcWidth, int arcHeight);
+  
+  public abstract void fillRoundRect(int x, int y,
+                                    int width, int height,
+                                    int arcWidth, int arcHeight);
+  
+  public abstract void drawOval(int x, int y,
+                               int width, int height);
+  
+  public abstract void fillOval(int x, int y,
+                               int width, int height);
+  
+  public abstract void drawArc(int x, int y,
+                              int width, int height,
+                              int startAngle, int arcAngle);
+  
+  public abstract void fillArc(int x, int y,
+                              int width, int height,
+                              int startAngle, int arcAngle);
+  
+  public abstract void drawPolyline(int[] xPoints, int[] yPoints,int nPoints);
+
+  public abstract void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
+    
+  public abstract void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
+
+  public abstract boolean drawImage(Image image, int x, int y,
+                                   ImageObserver observer);
+    
+
+  // -------- Graphics2D methods:
+
+  public abstract void draw(Shape shape);
+
+  public abstract void fill(Shape shape);
+    
+  public abstract boolean hit(Rectangle rect, Shape text, boolean onStroke);
+  
+  public abstract void drawString(String text, int x, int y);
+  
+  public abstract void drawString(String text, float x, float y);
+  
+  public abstract void translate(int x, int y);
+  
+  public abstract void translate(double tx, double ty);
+  
+  public abstract void rotate(double theta);
+  
+  public abstract void rotate(double theta, double x, double y);
+  
+  public abstract void scale(double scaleX, double scaleY);
+  
+  public abstract void shear(double shearX, double shearY);
+}
diff --git a/libjava/gnu/awt/j2d/DirectRasterGraphics.java b/libjava/gnu/awt/j2d/DirectRasterGraphics.java
new file mode 100644 (file)
index 0000000..6bbdbd1
--- /dev/null
@@ -0,0 +1,82 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.j2d;
+
+import java.awt.Color;
+import java.awt.Image;
+import java.awt.Shape;
+import java.awt.Rectangle;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.image.Raster;
+import java.awt.image.ImageObserver;
+
+/**
+ * Interface for a simple pixel based backend graphics object that
+ * does not handle translation/transforms, curves, nor advanced
+ * compositing.
+ */
+public interface DirectRasterGraphics extends Cloneable
+{
+  public void dispose();
+  
+  public void setColor(Color color);
+  
+  public void setPaintMode();
+  
+  public void setXORMode(Color altColor);
+  
+  public void setFont(Font font);
+  
+  public FontMetrics getFontMetrics(Font font);
+  
+  // supports rects, multi-rects and polygons
+  public void setClip(Shape clip);
+  
+  public void copyArea(int x, int y, int width, int height,
+                      int dx, int dy);
+  
+  public void drawLine(int x1, int y1, int x2, int y2);
+  
+  public void drawRect(int x, int y, int width, int height);
+  
+  public void fillRect(int x, int y, int width, int height);
+  
+  public void drawArc(int x, int y, int width, int height,
+                     int startAngle, int arcAngle);
+  
+  public void fillArc(int x, int y, int width, int height,
+                     int startAngle, int arcAngle);
+  
+  public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints);
+  
+  public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
+  
+  public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
+  
+  public void drawString(String str, int x, int y);
+  
+  public boolean drawImage(Image image, int x, int y,
+                          ImageObserver observer);
+
+  /**
+   * Map the data for screen pixels in the requested bounds to a
+   * raster object.  This gives read/write access to the screen
+   * pixels, allowing neat alpha and composite tricks.
+   */
+  public MappedRaster mapRaster(Rectangle bounds);
+  
+  /**
+   * Detach previously mapped pixel data from a raster object.
+   */
+  public void unmapRaster(MappedRaster mappedRaster);
+}
diff --git a/libjava/gnu/awt/j2d/Graphics2DImpl.java b/libjava/gnu/awt/j2d/Graphics2DImpl.java
new file mode 100644 (file)
index 0000000..7c08295
--- /dev/null
@@ -0,0 +1,454 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.j2d;
+
+import java.awt.Color;
+import java.awt.Image;
+import java.awt.Shape;
+import java.awt.Rectangle;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Paint;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ImageObserver;
+
+/**
+ * Delegates almost all work to a state object, that allows us to
+ * hot-swap rendering strategies based on state changes inflicted on
+ * this Graphics object. This class keeps track of properties that are
+ * not affected by the state, (such as clip shape,
+ * foreground/background color, font, etc.).
+ *
+ * <p>The far front-end of the rendering pipeline consists of the
+ * Graphics2D API. In the far back-end, lies the native graphics
+ * libraries. In most cases the native graphics libraries only have
+ * direct support for a subset of the properties of Graphics2D. To
+ * make up missing features in the native graphics libraries, the
+ * pipeline between the front-end and the back-end need to translate
+ * drawing request to primitive operations that are supported by the
+ * back-end. E.g. for X11, drawing a straight line will translate to
+ * an XDrawLine, drawing a bezier curve will trigger flattening of the
+ * curve and will result in a call to XDrawLines.
+ *
+ * <p>This is the basic strategy for the rendering pipeline: Whenever
+ * a graphics property change occurs, that causes the current pipeline
+ * to be insufficient, amend or replace parts of the pipeline so that
+ * the pipeline will once again be able to translate requests to the
+ * set of primitives supported by the native graphics library.
+ *
+ * <p>Most graphics libraries share common subsets of
+ * functionality. To be able to reuse pieces of the rendering pipeline
+ * for several backends, we define interfaces that describe subsets of
+ * characteristics supported by the backends. A wrapper for the native
+ * library can implement several interfaces to describe its range of
+ * functionality.
+ *
+ * <p>Typically, most painting is done with a graphics object with
+ * simple properties. Unless one is using a complex Look & Feel, the
+ * painting of Swing components will never require affine transforms,
+ * alpha blending, non-rectangular clipping, etc. When graphics
+ * objects are created, they start off in a state where all the
+ * properties are simple. Most graphics objects experience only
+ * trivial property changes, and never leave this simple state. It is
+ * therefore wise to ensure that the rendering pipeline for this
+ * initial state is lean and as much as possible plugs directly into
+ * the backend.
+ *
+ * <p>The initial state for graphics object of most raster displays
+ * would call for two levels of indirection:
+ *
+ * <pre>
+ * Graphics2D object ---> IntegerGraphicsState ---> DirectRasterGraphics
+ * </pre>
+ */
+public class Graphics2DImpl extends Graphics2D implements Cloneable
+{
+  GraphicsConfiguration config;
+
+  AbstractGraphicsState state;
+    
+  Color fg;
+  Color bg;
+
+  Font font;
+  
+  public Graphics2DImpl(GraphicsConfiguration config)
+  {
+    this.config = config;
+  }
+  
+  public void setState(AbstractGraphicsState state)
+  {
+    this.state = state;
+    this.state.setFrontend(this);
+  }
+    
+  public Object clone()
+  {
+    Graphics2DImpl gfxCopy = (Graphics2DImpl) super.clone();
+    AbstractGraphicsState stateCopy =
+      (AbstractGraphicsState) state.clone();
+    gfxCopy.setState(stateCopy);
+    
+    return gfxCopy;
+  }
+
+
+  // -------- Graphics methods:
+
+  public Graphics create()
+  {
+    Graphics2DImpl gfxCopy = (Graphics2DImpl) clone();
+    return gfxCopy;
+  }
+
+  public Color getColor()
+  {
+    return fg;
+  }
+  
+  public void setColor(Color color)
+  {
+    fg = color;
+    state.setColor(color);
+  }
+
+  public void setPaintMode()
+  {
+    state.setPaintMode();
+  }
+
+  public void setXORMode(Color altColor)
+  {
+    state.setXORMode(altColor);
+  }
+
+  public Font getFont()
+  {
+    return font;
+  }
+
+  public void setFont(Font font)
+  {
+    this.font = font;
+    state.setFont(font);
+  }
+    
+  public FontMetrics getFontMetrics(Font font)
+  {
+    return state.getFontMetrics(font);
+  }
+
+  public Rectangle getClipBounds()
+  {
+    return state.getClipBounds();
+  }
+    
+  public void clipRect(int x, int y, int width, int height)
+  {
+    Shape clip = state.getClip();
+    if (clip instanceof Rectangle)
+      {
+       Rectangle clipRect = (Rectangle) clip;
+       clip = clipRect.intersection(new Rectangle(x, y, width, height));
+       setClip(clip);
+       return;
+      }
+       
+    String msg =
+      "intersecting current clip shape " + clip + " with new rectangle " +
+      "has not been implemented yet";
+    throw new UnsupportedOperationException(msg);
+  }
+
+  public void setClip(int x, int y, int width, int height)
+  {
+    Rectangle clip = new Rectangle(x, y, width, height);
+    setClip(clip);
+  }
+
+  public Shape getClip()
+  {
+    return state.getClip();
+  }
+
+  public void setClip(Shape clip)
+  {
+    state.setClip(clip);
+  }
+
+  public void copyArea(int x, int y, int width, int height,
+                      int dx, int dy)
+  {
+    state.copyArea(x, y, width, height, dx, dy);
+  }
+
+  public void drawLine(int x1, int y1, int x2, int y2)
+  {
+    state.drawLine(x1, y1, x2, y2);
+  }
+    
+  public void fillRect(int x, int y, int width, int height)
+  {
+    state.fillRect(x, y, width, height);
+  }
+    
+  public void clearRect(int x, int y, int width, int height)
+  {
+    state.clearRect(x, y, width, height);
+  }
+  
+  public void drawRoundRect(int x, int y, int width, int height,
+                           int arcWidth, int arcHeight)
+  {
+    state.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
+  }
+    
+  public void fillRoundRect(int x, int y, int width, int height,
+                           int arcWidth, int arcHeight)
+  {
+    state.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
+  }
+
+  public void drawOval(int x, int y, int width, int height)
+  {
+    state.drawOval(x, y, width, height);
+  }
+
+  public void fillOval(int x, int y, int width, int height)
+  {
+    state.fillOval(x, y, width, height);
+  }
+
+  public void drawArc(int x, int y, int width, int height,
+                     int startAngle, int arcAngle)
+  {
+    state.drawArc(x, y, width, height, startAngle, arcAngle);
+  }
+
+  public void fillArc(int x, int y, int width, int height,
+                     int startAngle, int arcAngle)
+  {
+    state.fillArc(x, y, width, height, startAngle, arcAngle);
+  }
+
+  public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    state.drawPolyline(xPoints, yPoints, nPoints);
+  }
+  
+  public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    state.drawPolygon(xPoints, yPoints, nPoints);
+  }
+    
+  public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    state.fillPolygon(xPoints, yPoints, nPoints);
+  }
+    
+  public boolean drawImage(Image image, int x, int y,
+                          ImageObserver observer)
+  {
+    return state.drawImage(image, x, y, observer);
+  }
+
+  public boolean drawImage(Image img, int x, int y,
+                          int width, int height,
+                          ImageObserver observer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public boolean drawImage(Image img, int x, int y, Color bgcolor,
+                          ImageObserver observer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public boolean drawImage(Image img, int x, int y,
+                          int width, int height, Color bgcolor,
+                          ImageObserver observer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public boolean drawImage(Image img,
+                          int dx1, int dy1, int dx2, int dy2,
+                          int sx1, int sy1, int sx2, int sy2,
+                          ImageObserver observer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public boolean drawImage(Image img,
+                          int dx1, int dy1, int dx2, int dy2,
+                          int sx1, int sy1, int sx2, int sy2,
+                          Color bgcolor, ImageObserver observer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public void dispose()
+  {
+    AbstractGraphicsState lState = state;
+    
+    state = null;
+    config = null;
+    font = null;
+    fg = null;
+    bg = null;
+    
+    if (lState != null)
+      lState.dispose();
+  }
+    
+
+
+  // -------- Graphics2D methods:
+    
+  public void draw(Shape shape)
+  {
+    state.draw(shape);
+  }
+  
+  public boolean drawImage(Image image, AffineTransform xform,
+                          ImageObserver obs)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+
+  public void drawString(String text, int x, int y)
+  {
+    state.drawString(text, x, y);
+  }
+
+  public void drawString(String text, float x, float y)
+  {
+    state.drawString(text, x, y);
+  }
+
+  public void fill(Shape shape)
+  {
+    state.fill(shape);
+  }
+
+  public boolean hit(Rectangle rect, Shape text, boolean onStroke)
+  {
+    return state.hit(rect, text, onStroke);
+  }
+    
+  public GraphicsConfiguration getDeviceConfiguration()
+  {
+    return config;
+  }
+
+  public void setPaint(Paint paint)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public void setRenderingHint(RenderingHints.Key hintKey,
+                              Object hintValue)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public Object getRenderingHint(RenderingHints.Key hintKey)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public RenderingHints getRenderingHints()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+    
+  public void translate(int x, int y)
+  {
+    state.translate(x, y);
+  }
+  
+  public void translate(double tx, double ty)
+  {
+    state.translate(tx, ty);
+  }
+    
+  public void rotate(double theta)
+  {
+    state.rotate(theta);
+  }
+
+  public void rotate(double theta, double x, double y)
+  {
+    state.rotate(theta, x, y);
+  }
+  
+  public void scale(double scaleX, double scaleY)
+  {
+    state.scale(scaleX, scaleY);
+  }
+  
+  public void shear(double shearX, double shearY)
+  {
+    state.shear(shearX, shearY);
+  }
+
+  public void transform(AffineTransform Tx)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public void setTransform(AffineTransform Tx)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+    
+  public AffineTransform getTransform()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public Paint getPaint()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+    
+  public void setBackground(Color color)
+  {
+    bg = color;
+  }
+
+  public Color getBackground()
+  {
+    return bg;
+  }
+
+  public void clip(Shape shape)
+  {
+    Shape clip = state.getClip();
+    
+    if ((shape instanceof Rectangle) && (clip instanceof Rectangle))
+      {
+       clip = ((Rectangle) clip).intersection((Rectangle) shape);
+       state.setClip(clip);
+       return;
+      }
+       
+    String msg =
+      "intersecting current clip shape " + clip + " with new shape " + shape +
+      "has not been implemented yet";
+    throw new UnsupportedOperationException(msg);
+  }
+}
diff --git a/libjava/gnu/awt/j2d/IntegerGraphicsState.java b/libjava/gnu/awt/j2d/IntegerGraphicsState.java
new file mode 100644 (file)
index 0000000..923720e
--- /dev/null
@@ -0,0 +1,409 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.j2d;
+
+import java.awt.Color;
+import java.awt.Image;
+import java.awt.Shape;
+import java.awt.Rectangle;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.ColorModel;
+
+/**
+ * IntegerGraphicsState is one of several graphics state
+ * implementations.  This graphics state is used when the graphics
+ * object has simple properties, (coordinate translation only, no
+ * transform) and the backend supports integer coordinates (pixel
+ * based). For primitive paint operations, this object translates the
+ * coordinates and forwards the request to the backend. For requests
+ * to draw arbitrary shapes and paths, this object translates the
+ * requests to primitive drawing operations supported by the
+ * backend. IntegerGraphicsState is meant to support the most common
+ * state of an graphics object. The degree of functionality is roughly
+ * equivalent with the old java.awt.Graphics API.
+ */
+public class IntegerGraphicsState extends AbstractGraphicsState
+{
+  int tx;
+  int ty;
+  
+  DirectRasterGraphics directGfx;
+  Shape clip;
+  
+  public IntegerGraphicsState(DirectRasterGraphics directGfx)
+  {
+    this.directGfx = directGfx;
+  }
+  
+  public Object clone()
+  {
+    IntegerGraphicsState clone = (IntegerGraphicsState) super.clone();
+    clone.directGfx = (DirectRasterGraphics) directGfx.clone();
+    
+    return clone;
+  }
+
+  public void dispose()
+  {
+    DirectRasterGraphics lDeviceGfx = directGfx;
+    
+    directGfx = null;
+    
+    if (lDeviceGfx != null)
+      lDeviceGfx.dispose();
+    
+    super.dispose();
+  }
+  
+
+  // -------- Graphics methods:
+  
+  public void setColor(Color color)
+  {
+    directGfx.setColor(color);
+  }
+  
+  public void setPaintMode()
+  {
+    directGfx.setPaintMode();
+  }
+
+  public void setXORMode(Color altColor)
+  {
+    directGfx.setXORMode(altColor);
+  }
+  
+  public void setFont(Font font)
+  {
+    directGfx.setFont(font);
+  }
+  
+  public FontMetrics getFontMetrics(Font font)
+  {
+    return directGfx.getFontMetrics(font);
+  }
+
+  public void setClip(Shape clip)
+  {
+    if (clip instanceof Rectangle)
+      {
+       Rectangle clipRect = (Rectangle) clip.clone();
+       clipRect.x += tx;
+       clipRect.y += ty;
+       
+       this.clip = clipRect;
+       
+       directGfx.setClip(clipRect);
+       return;
+      }
+    
+    String msg =
+      "translating clip shape " + clip + " into device " +
+      "coordinate space has not been implemented yet";
+    
+    throw new UnsupportedOperationException(msg);
+  }
+
+  public Shape getClip()
+  {
+    if (clip instanceof Rectangle)
+      {
+       Rectangle clipRect = (Rectangle) clip;
+       clipRect.x -= tx;
+       clipRect.y -= ty;
+       return clipRect;
+      }
+
+    String msg =
+      "translating clip shape " + clip + " into user " +
+      "coordinate space has not been implemented yet";
+    
+    throw new UnsupportedOperationException(msg);
+  }
+
+  public Rectangle getClipBounds()
+  {
+    Rectangle clipRect = clip.getBounds();
+    
+    clipRect.x -= tx;
+    clipRect.y -= ty;
+    return clipRect;
+  }
+
+  public void copyArea(int x, int y, 
+                      int width, int height,
+                      int dx, int dy)
+  {
+    directGfx.copyArea(x+tx, y+ty, width, height, dx, dy);
+  }
+
+  public void drawLine(int x1, int y1,
+                      int x2, int y2)
+  {
+    directGfx.drawLine(x1+tx, y1+ty, x2+tx, y2+ty);
+  }
+    
+  public void fillRect(int x, int y,
+                      int width, int height)
+  {
+    directGfx.fillRect(x+tx, y+ty, width, height);
+  }
+    
+  public void clearRect(int x, int y,
+                       int width, int height)
+  {
+    directGfx.setColor(frontend.getBackground());
+    directGfx.fillRect(x+tx, y+ty, width, height);
+    directGfx.setColor(frontend.getColor());
+  }
+
+  public void drawRoundRect(int x, int y,
+                           int width, int height,
+                           int arcWidth, int arcHeight)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public void fillRoundRect(int x, int y,
+                           int width, int height,
+                           int arcWidth, int arcHeight)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public void drawOval(int x, int y,
+                      int width, int height)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public void fillOval(int x, int y,
+                      int width, int height)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public void drawArc(int x, int y,
+                     int width, int height,
+                     int startAngle, int arcAngle)
+  {
+    directGfx.drawArc(x+tx, y+ty, width, height, startAngle, arcAngle);
+  }    
+
+  public void fillArc(int x, int y,
+                     int width, int height,
+                     int startAngle, int arcAngle)
+  {
+    directGfx.fillArc(x+tx, y+ty, width, height, startAngle, arcAngle);
+  }
+  
+  public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    if ((tx == 0) || (ty == 0))
+      {
+       directGfx.drawPolyline(xPoints, yPoints, nPoints);
+       return;
+      }
+           
+    throw new UnsupportedOperationException("translate not implemented");
+  }
+
+  public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    if ((tx == 0) || (ty == 0))
+      {
+       directGfx.drawPolygon(xPoints, yPoints, nPoints);
+       return;
+      }
+
+    throw new UnsupportedOperationException("translate not implemented");
+  }
+  
+  public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
+  {
+    if ((tx == 0) || (ty == 0))
+      {
+       directGfx.fillPolygon(xPoints, yPoints, nPoints);
+       return;
+      }
+    
+    throw new UnsupportedOperationException("translate not implemented");
+  }
+
+  public boolean drawImage(Image image, int x, int y,
+                          ImageObserver observer)
+  {
+    x += tx;
+    y += ty;
+    
+    if (image instanceof BufferedImage)
+      {
+       BufferedImage bImage = (BufferedImage) image;
+       Object config =
+         bImage.getProperty("java.awt.GraphicsConfiguration");
+       
+       if (config == frontend.config)
+         return directGfx.drawImage(image, x, y, observer);
+       
+       int width = image.getWidth(null);
+       int height = image.getHeight(null);     
+       
+       Rectangle bounds = new Rectangle(x, y, width, height);
+       
+       MappedRaster mr = directGfx.mapRaster(bounds);
+       
+       // manipulate raster here...
+       ColorModel colorModel = mr.getColorModel();
+       WritableRaster raster = mr.getRaster();
+       
+       int xEnd = x + width;
+       int yEnd = y + height;
+       
+       // FIXME: Use the following code only as a fallback. It's SLOW!
+
+       Object rgbElem = null;
+       for (int yy=0; yy<height; yy++)
+         {
+           for (int xx=0; xx<width; xx++)
+             {
+               int srgb = bImage.getRGB(xx, yy);
+               int sa = ((srgb >>> 24) & 0xff) + 1;
+               int sr = ((srgb >>> 16) & 0xff) + 1;
+               int sg = ((srgb >>> 8) & 0xff) + 1;
+               int sb = (srgb & 0xff) + 1;
+               
+               rgbElem = raster.getDataElements(xx+x, yy+y, rgbElem);
+               int drgb = colorModel.getRGB(rgbElem);
+               int dr = ((drgb >>> 16) & 0xff) + 1;
+               int dg = ((drgb >>> 8) & 0xff) + 1;
+               int db = (drgb & 0xff) + 1;                 
+               int da = 256 - sa;
+               
+               dr = ((sr*sa + dr*da) >>> 8) - 1;
+               dg = ((sg*sa + dg*da) >>> 8) - 1;
+               db = ((sb*sa + db*da) >>> 8) - 1;
+               
+               drgb = (dr<<16) | (dg<<8) | db;
+               
+               rgbElem = colorModel.getDataElements(drgb, rgbElem);
+               
+               raster.setDataElements(xx+x, yy+y, rgbElem);
+             }
+         }
+       directGfx.unmapRaster(mr);
+       return true;
+       
+      }
+    throw new UnsupportedOperationException("drawing image " + image +
+                                           "not implemented");
+  }
+  
+
+  // -------- Graphics2D methods:
+  
+  public void draw(Shape shape)
+  {
+    if (shape instanceof Rectangle)
+      {
+       Rectangle rect = (Rectangle) shape;
+       directGfx.drawRect(rect.x+tx, rect.y+ty, rect.width, rect.height);
+       return;
+      } 
+    
+    throw new UnsupportedOperationException("shape not implemented");
+  }
+
+  public void fill(Shape shape)
+  {
+    if (shape instanceof Rectangle)
+      {
+       Rectangle rect = (Rectangle) shape;
+       directGfx.fillRect(rect.x+tx, rect.y+ty, rect.width, rect.height);
+       return;
+      }
+    
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public boolean hit(Rectangle rect, Shape text,
+                    boolean onStroke)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+
+  public void drawString(String text, int x, int y)
+  {
+    directGfx.drawString(text, x+tx, y+ty);
+  }
+
+  public void drawString(String text, float x, float y)
+  {
+    drawString(text, (int) x, (int) y);
+  }
+  
+  public void translate(int x, int y)
+  {
+    tx += x;
+    ty += y;
+  }
+    
+  public void translate(double tx, double ty)
+  {
+    if ((tx == 0) && (ty == 0))
+      return;
+    
+    needAffineTransform();
+  }
+
+  public void rotate(double theta)
+  {
+    if (theta == 0)
+      return;
+    
+    needAffineTransform();
+  }
+
+  public void rotate(double theta, double x, double y)
+  {
+    if (theta == 0)
+      return;
+    
+    needAffineTransform();
+  }
+
+  public void scale(double scaleX, double scaleY)
+  {
+    if ((scaleX == 1) && (scaleY == 1))
+      return;
+
+    needAffineTransform();
+  }
+  
+  public void shear(double shearX, double shearY)
+  {
+    if ((shearX == 0) && (shearY == 0))
+      return;
+    
+    needAffineTransform();
+  }   
+  
+  private void needAffineTransform()
+  {
+    throw new UnsupportedOperationException("state with affine " +
+                                           "transform not implemented");
+  }
+}
diff --git a/libjava/gnu/awt/j2d/MappedRaster.java b/libjava/gnu/awt/j2d/MappedRaster.java
new file mode 100644 (file)
index 0000000..eb41eec
--- /dev/null
@@ -0,0 +1,72 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.j2d;
+
+import java.awt.image.WritableRaster;
+import java.awt.image.ColorModel;
+
+/* The raster and associated properties of a mapped screen region.
+ * The compositing capabilities of backends are often insufficient.
+ * The backend may not support alpha blending, or may not support some
+ * other special compositing rule.  This means that compositing must
+ * sometimes be done within the rendering pipeline.  The general
+ * compositing operation consists of combining new color and alpha
+ * values with existing color values on the drawing surface, to find
+ * the new color values for the drawing surface. The way the values
+ * are combined, determines what kind of compositing operation that is
+ * performed.  The default compositing operation is alpha compositing.
+ *
+ * <p>In order to perform alpha compositing and other compositing
+ * operations, we need access to the color values of the imagery that
+ * has already been drawn on the drawing surface.  The
+ * DirectRasterGraphics interface must therefore contain methods that
+ * makes it possible to gain access to the pixel values of the drawing
+ * surface.  The methods are modeled after the POSIX mmap() and
+ * munmap() functions.  But, instead of mapping and unmapping portions
+ * of data from a file descriptor to memory, the methods in
+ * DirectRasterGraphics maps and unmaps portions of the drawing
+ * surface to data arrays within writable raster objects.  A call to
+ * mapRaster() will return a writable raster object, encapsulating the
+ * image data of the drawing surface in the requested domain. The data
+ * encapsulated by this raster object can be modified using the
+ * WritableRaster API, or the data buffers can be retrieved from the
+ * raster, so that the data arrays can be manipulated directly.  When
+ * the raster image has been modified as desired, the data can be
+ * resynchronized with the drawing surface by calling mapRaster().
+ *
+ * <p>As with mmap() and munmap() the methods may work by direct
+ * manipulation of shared memory, (i.e. the raster object directly
+ * wraps the actual image data of the drawing surface), or may make a
+ * private copy that is resynched when the raster is unmapped. The
+ * backend may choose to implement either mechanism, and the pipeline
+ * code should not care what mechanism is actually used.  This design
+ * allows us to make full use of speedups such as X shared memory
+ * extentions when available.
+ */
+public class MappedRaster
+{
+  WritableRaster raster;
+  ColorModel cm;
+  
+  public MappedRaster(WritableRaster raster, ColorModel cm)
+  {
+    this.raster = raster;
+    this.cm = cm;
+  }
+
+  public final WritableRaster getRaster()
+  {
+    return raster;
+  }
+
+  public final ColorModel getColorModel()
+  {
+    return cm;
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XCanvasPeer.java b/libjava/gnu/awt/xlib/XCanvasPeer.java
new file mode 100644 (file)
index 0000000..5674f5b
--- /dev/null
@@ -0,0 +1,388 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.Dimension;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Rectangle;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Image;
+import java.awt.GraphicsConfiguration;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Toolkit;
+import java.awt.AWTEvent;
+import java.awt.Cursor;
+import java.awt.Shape;
+
+import java.awt.peer.*;
+import java.awt.image.*;
+
+import java.awt.event.MouseListener;
+import java.awt.event.PaintEvent;
+
+import java.util.EventListener;
+
+import gnu.gcj.xlib.WMSizeHints;
+import gnu.gcj.xlib.Window;
+import gnu.gcj.xlib.WindowAttributes;
+import gnu.gcj.xlib.Display;
+import gnu.gcj.xlib.Visual;
+import gnu.gcj.xlib.Screen;
+import gnu.gcj.xlib.XImage;
+
+import gnu.awt.j2d.*;
+
+public class XCanvasPeer implements CanvasPeer
+{
+  static final Dimension MIN_SIZE = new Dimension(1, 1);
+  
+  public // temporary
+  
+  Window window;
+  Window parent;
+
+  Component component;
+  XGraphicsConfiguration config;
+  
+  public XCanvasPeer(Component component)
+  {
+    this.component = component;
+    
+    // Set up graphics configuration (ie. screen + visual):
+
+    config = (XGraphicsConfiguration)
+      component.getGraphicsConfiguration();
+
+    if (config == null)
+      {
+       // This will usually only happen for toplevel windows
+       config = getXToolkit().getDefaultXGraphicsConfiguration();
+      } 
+
+    Rectangle bounds = component.getBounds();
+    parent = locateParentWindow(bounds);
+       
+    // Windows in X must atleast be of size 1x1
+    boolean boundsChanged = false;
+    if (bounds.width < 1)
+      {
+       boundsChanged = true;
+       bounds.width = 1;
+      }
+    if (bounds.height < 1)
+      {
+       boundsChanged = true;
+       bounds.height = 1;
+      }
+       
+    /* don't worry about this calling back to us, since the real
+       component object has not yet received a reference to this peer
+       object. */
+    component.setBounds(bounds);
+           
+    WindowAttributes attributes = new WindowAttributes();
+
+    /* Set background color */
+    Color bg = component.getBackground();
+    if (bg != null)
+      {
+       int[] components =
+       {
+         bg.getRed(),
+         bg.getGreen(),
+         bg.getBlue(),
+         0xff
+       };
+
+       ColorModel cm = config.getColorModel();
+       long pixel = cm.getDataElement(components, 0);
+       attributes.setBackground(pixel);
+      }
+       
+    /* Set exposure mask so that we get exposure events
+       that can be translated into paint() calls. */
+    long eventMask = WindowAttributes.MASK_EXPOSURE;
+
+    /* It would be nice to set up all other required events here, but
+       it is not possible to do so before after all the children of
+       this component has been realized.  The reason is that it is not
+       determined whether a component is lightweight before after the
+       addNotify() method has been called.  Thus, it is not possible
+       for parent component to determine what events it needs to
+       furnish for lightweight children.  Instead, we currently rely
+       on the component calling our setEventMask() method after the
+       correct event mask has been determined. */
+
+    attributes.setEventMask(eventMask);
+       
+           
+    // TODO: set more window attributes?
+
+    /* don't allow event queue to process events from the newly
+       created window before this peer has been registered as client
+       data. */
+    synchronized (getXToolkit().eventLoop)
+      {
+       window = new gnu.gcj.xlib.Window(parent, bounds, attributes);
+       window.setClientData(this); /* make it possible to find back
+                                      to this peer object. Used by
+                                      XEventQueue. */
+      }
+    
+    initWindowProperties();
+
+    if (component.isVisible())
+      EventQueue.invokeLater(new DoMap(window));
+  }
+
+  /**
+   * Override this in subclasses to implement other ways of obtaining
+   * parent windows.  Toplevel windows will typically have a different
+   * implementation.
+   */
+  gnu.gcj.xlib.Window locateParentWindow(Rectangle bounds)
+  {
+    Container parent = component.getParent();
+    while (parent.isLightweight())
+      {
+       bounds.x += parent.getX();
+       bounds.y += parent.getY();
+       parent = parent.getParent();
+       // a null pointer here is a genuine error
+      }
+    
+    XCanvasPeer parentPeer = (XCanvasPeer) parent.getPeer();
+    if (parentPeer == null)
+      throw new NullPointerException("Parent has no peer. This should " +
+                                    "not be possible, since the " +
+                                    "calls leading here should come " +
+                                    "from parent, after it has " +
+                                    "set the parent peer.");
+    return parentPeer.window;
+  }
+    
+
+  /** 
+   * Template method to allow subclasses to apply properties to X11
+   * window right after creation.
+   */
+  void initWindowProperties()
+  {
+  }
+    
+  XToolkit getXToolkit()
+  {
+    return XToolkit.INSTANCE;
+  }
+
+  protected void ensureFlush()
+  {
+    getXToolkit().flushIfIdle();
+  }
+
+  public Component getComponent()
+  {
+    return component;
+  }
+  
+  long getBasicEventMask()
+  {
+    return WindowAttributes.MASK_EXPOSURE;
+  }
+    
+  // -------- java.awt.peer.ComponentPeer implementation
+
+  public int checkImage(Image img, int width, int height, ImageObserver o)
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+  public Image createImage(ImageProducer prod)
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+  public Image createImage(int width, int height)
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+  public void dispose()
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public GraphicsConfiguration getGraphicsConfiguration()
+  {
+    return config;
+  }
+
+  public FontMetrics getFontMetrics(Font f)
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public Graphics getGraphics()
+  {
+    DirectRasterGraphics gfxDevice = new XGraphics(window, config);
+    IntegerGraphicsState igState = new IntegerGraphicsState(gfxDevice);
+    Graphics2DImpl gfx2d = new Graphics2DImpl(config);
+
+    gfx2d.setState(igState);
+    gfx2d.setColor(component.getBackground());
+    return gfx2d;
+  }
+    
+  public Point getLocationOnScreen()
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public Dimension getMinimumSize ()
+  {
+    return MIN_SIZE;
+  }
+
+  public Dimension getPreferredSize ()
+  {
+    return component.getSize();
+  }
+    
+  public Toolkit getToolkit()
+  {
+    return getXToolkit();
+  }
+
+  public void handleEvent(AWTEvent event)
+  {
+  }
+
+  public boolean isFocusTraversable()
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public void paint(Graphics gfx)
+  {
+    // do nothing by default
+  }
+    
+  public boolean prepareImage(Image img, int width, int height,
+                             ImageObserver o)
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public void print(Graphics graphics)
+  {
+    paint(graphics);
+  }
+
+  public void repaint(long tm, int x, int y, int w, int h)
+  {
+    /* TODO?
+
+       X allows intelligent X servers to do smart
+       refreshing. Perhaps involve X in repainting of components,
+       rather that keeping it all within the local event queue. */
+    
+    PaintEvent updateEvent = new PaintEvent(component,
+                                           PaintEvent.UPDATE,
+                                           new Rectangle(x, y, w, h));
+    getXToolkit().queue.postEvent(updateEvent);
+  }
+    
+  public void requestFocus()
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public void setBackground(Color color)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+
+  public void setBounds(int x, int y, int width, int height)
+  {
+    width  = Math.max(width,  1);
+    height = Math.max(height, 1);
+    window.setBounds(x, y, width, height);
+    ensureFlush();         
+  }
+    
+  public void setCursor(Cursor cursor)
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public void setEnabled(boolean enabled)
+  {
+    throw new UnsupportedOperationException("FIXME, not implemented");
+  }
+
+  public void setEventMask(long eventMask)
+  {
+    WindowAttributes attributes = new WindowAttributes();
+
+    long xEventMask = getBasicEventMask();
+       
+    if ((eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0)
+      {
+       xEventMask |=
+         WindowAttributes.MASK_BUTTON_PRESS |
+         WindowAttributes.MASK_BUTTON_RELEASE;
+      }
+           
+    attributes.setEventMask(xEventMask);
+    window.setAttributes(attributes);
+    ensureFlush();
+  }
+
+  public void setFont(Font font)
+  {
+    /* default canvas peer does keep track of font, since it won't
+       write anything. */
+  }
+
+  public void setForeground(Color color)
+  {
+    /* default canvas peer does keep track of foreground, since it won't
+       paint anything. */
+  }
+       
+  public void setVisible(boolean visible)
+  {
+    if (visible)
+      {
+       window.map();
+       ensureFlush();      
+      }
+    else
+      {
+       throw new UnsupportedOperationException("unmap not implemented");
+      }
+  }
+       
+  static class DoMap implements Runnable 
+  {
+    Window window;
+    public DoMap(Window w) 
+    {
+      this.window = w;
+    }
+    
+    public void run() 
+    {
+      window.map();
+    }
+  }
+}
+
diff --git a/libjava/gnu/awt/xlib/XEventLoop.java b/libjava/gnu/awt/xlib/XEventLoop.java
new file mode 100644 (file)
index 0000000..4d29320
--- /dev/null
@@ -0,0 +1,268 @@
+package gnu.awt.xlib;
+
+/* Copyright (C) 2000  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.  */
+
+import java.awt.*;
+
+import gnu.awt.LightweightRedirector;
+import gnu.gcj.xlib.Display;
+import gnu.gcj.xlib.XAnyEvent;
+import gnu.gcj.xlib.XExposeEvent;
+import gnu.gcj.xlib.XButtonEvent;
+import gnu.gcj.xlib.XConfigureEvent;
+import java.awt.event.PaintEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.util.Vector;
+
+public class XEventLoop implements Runnable
+{
+  Display display;
+  EventQueue queue;
+  XAnyEvent anyEvent;
+  Thread eventLoopThread;
+
+  LightweightRedirector lightweightRedirector = new LightweightRedirector();
+    
+  public XEventLoop(Display display, EventQueue queue)
+  {
+    this.display = display;
+    this.queue = queue;
+    
+    anyEvent = new XAnyEvent(display);
+    eventLoopThread = new Thread(this, "AWT thread for XEventLoop");
+    eventLoopThread.start();
+  }
+
+  public void run()
+  {
+    while (true) 
+      postNextEvent();
+  }
+
+  void postNextEvent()
+  {
+    try
+      {
+       AWTEvent evt = getNextEvent();
+       queue.postEvent(evt);
+       
+      }
+    catch (InterruptedException ie)
+      {
+       // FIXME: what now?
+       System.err.println(ie);
+      }
+  }
+    
+  /** get next event. Will block until events become available. */
+  public AWTEvent getNextEvent()
+  {
+    // ASSERT:
+    if (isIdle())
+      throw new Error("should not be idle");
+    
+    AWTEvent event = null;
+    while (event == null)
+      {
+       loadNextEvent();
+       event = createEvent();
+      }
+
+    event = lightweightRedirector.redirect(event);
+
+    return event;
+  }
+
+  void loadNextEvent()
+  {
+    try
+      {
+       setIdle(true);
+       
+       /* The code below will result in an XFlush(). However,
+          while we are waiting for events after calling XFlush(),
+          new X requests issued on other threads will not
+          automatically be flushed. This can lead to a deadlock
+          since XFlush() will not be called before after the
+          processing of the next event, and new events arriving
+          might be dependent on the delivery of the X
+          requests. 
+          
+          Code that issues X requests should therefore call
+          flushIfIdle() after they're done, to ensure that the
+          requests are delivered in a timely manner.  XFlush is not
+          run if event processing is underway, since we are assured
+          that the event loop execution will return to this point,
+          where requests are flushed again, before waiting for new
+          events.
+
+          Alternatively, do the work on the AWT thread, since the
+          XEventQueue knows how to flush the display when it runs out
+          of events. */
+       
+       //display.flush(); // implicit?
+       anyEvent.loadNext();
+      }
+    catch (RuntimeException re)
+      {
+       System.err.println("Exception thrown on event thread:" + re);
+      }
+    finally
+      {
+       setIdle(false);
+      }
+  }
+    
+  /**
+   * @returns an AWT event created based on the current XEvent.
+   * Returns null if the current XEvent does not map to any perticular
+   * AWT event.
+   */
+    
+  AWTEvent createEvent()
+  {
+    /* avoid attempting to get client data before client data has
+       been set. */
+    Object peer;
+    synchronized (this)
+      {
+       peer = anyEvent.getWindow().getClientData();
+      }
+           
+    Component source = null;
+
+    // Try to identify source component
+       
+    if (peer instanceof XCanvasPeer)
+      {
+       source = ((XCanvasPeer) peer).getComponent();
+      }
+       
+    if (source == null)
+      {
+       String msg = "unable to locate source for event (" +
+         anyEvent + ")";
+       throw new RuntimeException(msg);
+      }
+
+    /* if a mapping from anyEvent to AWTEvent is possible, construct a
+       new AWTEvent and return it. */
+       
+    int type = anyEvent.getType();
+    switch (type)
+      {
+      case XAnyEvent.TYPE_EXPOSE:
+       return createPaintEvent(source);
+      case XAnyEvent.TYPE_BUTTON_PRESS:
+      case XAnyEvent.TYPE_BUTTON_RELEASE:
+       return createMouseEvent(type, source);
+      case XAnyEvent.TYPE_UNMAP_NOTIFY:
+      case XAnyEvent.TYPE_MAP_NOTIFY:
+      case XAnyEvent.TYPE_REPARENT_NOTIFY:
+       return null; // ignore for now
+      case XAnyEvent.TYPE_CONFIGURE_NOTIFY:
+       configureNotify(peer);
+       return null;
+
+      default:
+       String msg = "Do no know how to handle event (" + anyEvent + ")";
+       throw new RuntimeException(msg);
+      }
+  }
+    
+  AWTEvent createPaintEvent(Component src)
+  {
+    XExposeEvent expose = new XExposeEvent(anyEvent);
+    PaintEvent pe = new PaintEvent(src, PaintEvent.PAINT,
+                                  expose.getBounds());
+    return pe;
+  }
+    
+  AWTEvent createMouseEvent(int type, Component src)
+  {    
+    XButtonEvent buttonEvt = new XButtonEvent(anyEvent);
+    
+    int modifiers = 0; //buttonToModifierMap[buttonEvt.button];
+    
+    /* Warning: this makes assumptions on the contents of
+       X.h... Button1 = 1, Button2 = 2, etc... */
+    switch (buttonEvt.button)
+      {
+      case 1:
+       modifiers = InputEvent.BUTTON1_MASK;
+       break;
+      case 2:
+       modifiers = InputEvent.BUTTON2_MASK;
+       break;
+      case 3:
+       modifiers = InputEvent.BUTTON2_MASK;
+       break;
+      }
+    
+    int state = buttonEvt.state;
+    
+    // remap bits from state to modifiers:
+    
+    if ((state & XButtonEvent.MASK_SHIFT) != 0)
+      modifiers |= InputEvent.SHIFT_MASK;
+       
+       
+    if ((state & XButtonEvent.MASK_CONTROL) != 0)
+      modifiers |= InputEvent.CTRL_MASK;
+       
+    
+    /* FIXME: we need additional X code to properly map MODn states to
+       input modifiers */
+       
+    int clickCount = 1; // FIXME... Can't get this from X.
+    boolean popupTrigger = false; // FIXME: look up policy somewhere
+       
+    int x = buttonEvt.x;
+    int y = buttonEvt.y;
+
+    int id = (type == XAnyEvent.TYPE_BUTTON_PRESS) ?
+      MouseEvent.MOUSE_PRESSED :
+      MouseEvent.MOUSE_RELEASED;
+       
+    MouseEvent me = new MouseEvent(src,
+                                  id,
+                                  buttonEvt.time, modifiers,
+                                  buttonEvt.x, buttonEvt.y,
+                                  clickCount, popupTrigger);
+    return me;
+  }
+
+  void configureNotify(Object peerObj)
+  {
+    XConfigureEvent configEvent = new XConfigureEvent(anyEvent);
+    XFramePeer peer = (XFramePeer)  peerObj;
+    
+    peer.configureNotify(configEvent);
+  }
+    
+  public void flushIfIdle()
+  {
+    if (isIdle())
+      display.flush();
+  }
+  
+  volatile boolean idle = false;
+
+  final synchronized void setIdle(boolean idle)
+  {
+    this.idle = idle;
+  }
+
+  final synchronized boolean isIdle()
+  {
+    return idle;
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XEventQueue.java b/libjava/gnu/awt/xlib/XEventQueue.java
new file mode 100644 (file)
index 0000000..ea2ad18
--- /dev/null
@@ -0,0 +1,34 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.*;
+
+import gnu.gcj.xlib.Display;
+
+/**
+ * The only difference here from a standard EventQueue is that the X
+ * display connection is flushed before waiting for more events.
+ */
+public class XEventQueue extends EventQueue
+{
+  Display display;
+  
+  public XEventQueue(Display display)
+  {
+    this.display = display;
+  }
+  
+  public AWTEvent getNextEvent() throws InterruptedException
+  {
+    if ((peekEvent() == null) && (display != null))
+      display.flush();
+    return super.getNextEvent();
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XFontMetrics.java b/libjava/gnu/awt/xlib/XFontMetrics.java
new file mode 100644 (file)
index 0000000..4e45a1f
--- /dev/null
@@ -0,0 +1,47 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.FontMetrics;
+
+public class XFontMetrics extends FontMetrics
+{
+  gnu.gcj.xlib.Font xfont;
+  
+  public XFontMetrics(gnu.gcj.xlib.Font xfont, java.awt.Font awtFont)
+  {
+    super(awtFont);
+    this.xfont = xfont;
+  }
+
+  public int getAscent()
+  {
+    return xfont.getAscent();
+  }
+
+  public int getDescent()
+  {
+    return xfont.getDescent();
+  }
+
+  public int getMaxAscent()
+  {
+    return xfont.getMaxAscent();
+  }
+  public int getMaxDescent()
+  {
+    return xfont.getMaxDescent();
+  }
+
+  public int stringWidth(String str)
+  {
+    return xfont.getStringWidth(str);
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XFramePeer.java b/libjava/gnu/awt/xlib/XFramePeer.java
new file mode 100644 (file)
index 0000000..0f55088
--- /dev/null
@@ -0,0 +1,174 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.image.*;
+import gnu.gcj.xlib.WMSizeHints;
+import gnu.gcj.xlib.WindowAttributes;
+import gnu.gcj.xlib.Display;
+import gnu.gcj.xlib.Visual;
+import gnu.gcj.xlib.Screen;
+import gnu.gcj.xlib.XConfigureEvent;
+
+/** FIXME: a lot of the code here should be moved down to XWindowPeer. */
+
+public class XFramePeer extends XCanvasPeer implements FramePeer
+{
+
+  public XFramePeer(Frame frame)
+  {
+    super(frame);
+    
+    // Set some defaults for a toplevel component:
+    if (frame.getFont() == null)
+      frame.setFont(new Font("helvetica", Font.PLAIN, 12));
+
+    if (frame.getBackground() == null)
+      frame.setBackground(Color.lightGray);
+
+    if (frame.getForeground() == null)
+      frame.setForeground(Color.black);
+  }
+
+  /** Find parent window for toplevel window, ie. root window of
+      selected screen. Bounds are not changed. */
+  gnu.gcj.xlib.Window locateParentWindow(Rectangle bounds)
+  {
+    Screen screen = config.getVisual().getScreen();
+    return screen.getRootWindow();
+  }
+       
+  void initWindowProperties()
+  {
+    Frame frame = (Frame) component;
+    setResizable(frame.isResizable());
+    String title = frame.getTitle();
+    if (!title.equals("")) setTitle(title);
+  }
+
+  long getBasicEventMask()
+  {
+    return super.getBasicEventMask() |
+      WindowAttributes.MASK_STRUCTURE_NOTIFY;
+  }
+
+  void configureNotify(XConfigureEvent configEvent)
+  {
+    component.setBounds(configEvent.getBounds());
+    
+    /* FIXME: Validation should probably not be done here.  The best
+       strategy is probably to validate on the AWT thread in response
+       to an ComponentEvent.  This will make it possible to coalesce
+       resize validations. */
+    component.validate();
+  }
+
+  /* Overridden to ignore request to set bounds if the request occurs
+     on the X event loop thread.  It is assumed that all requests that
+     occur on the X event loop thread are results of XConfigureNotify
+     events, in which case the X window already has the desired
+     bounds.  */
+  public void setBounds(int x, int y, int width, int height)
+  {
+    if (Thread.currentThread() == getXToolkit().eventLoop.eventLoopThread)
+      return;
+    
+    super.setBounds(x, y, width, height);
+  }
+  // Implementing ContainerPeer:
+
+  static final Insets INSETS_0_PROTOTYPE = new Insets(0, 0, 0, 0);
+
+  public Insets getInsets()
+  {
+    return (Insets) INSETS_0_PROTOTYPE.clone();
+  }
+
+  public void beginValidate()
+  {
+  }
+
+  public void endValidate()
+  {
+    // reassert sizing hints
+    Frame frame = (Frame) component;
+    setResizable(frame.isResizable());
+  }
+    
+
+  // Implementing WindowPeer:
+
+  public void toBack()
+  {
+    throw new UnsupportedOperationException("not implemented yet");    
+  }
+  
+  public void toFront()
+  {
+    throw new UnsupportedOperationException("not implemented yet");    
+  }
+
+
+  // Implementing FramePeer:
+
+  public void setIconImage(Image image)
+  {
+    throw new UnsupportedOperationException("not implemented yet");    
+  }
+  
+  public void setMenuBar(MenuBar mb)
+  {
+    throw new UnsupportedOperationException("not implemented yet");    
+  }
+
+
+  public void setTitle(String title)
+  {
+    synchronized (window.getDisplay())
+      {
+       // Oh, what a nice implementation :-)
+       window.setProperty("WM_NAME", "STRING", title);
+       
+       ensureFlush();
+      }
+  }
+
+  public void setResizable(boolean resizable)
+  {
+    Frame frame = (Frame) component;
+    
+    WMSizeHints sizeHints = new WMSizeHints();
+    if (resizable)
+      {
+       Dimension minSize = frame.getMinimumSize();
+       sizeHints.setMinSize(minSize.width, minSize.height);
+       
+       Dimension maxSize = frame.getMaximumSize();
+       
+       if ((maxSize.width < Short.MAX_VALUE) ||
+           (maxSize.height < Short.MAX_VALUE))
+         {
+           maxSize.width  = Math.min(maxSize.width,  Short.MAX_VALUE);
+           maxSize.height = Math.min(maxSize.height, Short.MAX_VALUE);
+           sizeHints.setMaxSize(maxSize.width, maxSize.height);
+         }
+      }
+    else
+      {
+       // lock resizing to current bounds
+       Dimension size = frame.getSize();
+       sizeHints.setMinSize(size.width, size.height);
+       sizeHints.setMaxSize(size.width, size.height);
+      }
+    sizeHints.applyNormalHints(window);
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XGraphics.java b/libjava/gnu/awt/xlib/XGraphics.java
new file mode 100644 (file)
index 0000000..27b07a2
--- /dev/null
@@ -0,0 +1,279 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.*;
+import java.awt.image.WritableRaster;
+import java.awt.image.Raster;
+import java.awt.image.DataBuffer;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.BufferedImage;
+import gnu.gcj.xlib.GC;
+import gnu.gcj.xlib.XImage;
+import gnu.gcj.xlib.Drawable;
+import gnu.gcj.xlib.Window;
+import gnu.gcj.xlib.Drawable;
+import gnu.gcj.xlib.Visual;
+import gnu.awt.j2d.DirectRasterGraphics;
+import gnu.awt.j2d.MappedRaster;
+
+public class XGraphics implements Cloneable, DirectRasterGraphics
+{
+  static class XRaster extends MappedRaster
+  {
+    XImage ximage;
+    
+    public XRaster(WritableRaster raster, XImage ximage, ColorModel cm)
+    {
+      super(raster, cm);
+      this.ximage = ximage;
+    }
+  }
+  
+  GC context;
+  XGraphicsConfiguration config;
+  Rectangle clipBounds;
+    
+  XFontMetrics metrics;
+
+
+  public Object clone()
+  {
+    XGraphics gfxCopy = (XGraphics) super.clone();
+    gfxCopy.context = context.create();
+    
+    return gfxCopy;
+  }
+
+  public void dispose()
+  {
+    GC lContext = context;
+    context = null;
+    config = null;
+    clipBounds = null;
+    
+    if (lContext != null)
+      {
+       lContext.dispose();
+      }            
+  }
+
+  public XGraphics(Drawable drawable, XGraphicsConfiguration config)
+  {
+    context = new GC(drawable);
+    this.config = config;
+  }  
+  
+  public void setColor(Color color)
+  {
+    context.setForeground(config.getPixel(color));
+  }
+
+  public void setPaintMode()
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+
+  public void setXORMode(Color c1)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public void setFont(Font font)
+  {
+    if ((metrics != null) && font.equals(metrics.getFont())) return;
+
+    metrics = config.getXFontMetrics(font);
+    context.setFont(metrics.xfont);
+  }
+    
+  public FontMetrics getFontMetrics(Font font)
+  {
+    if ((metrics != null) && font.equals(metrics.getFont()))
+      return metrics;
+    
+    return config.getXFontMetrics(font);
+  }
+    
+  public void setClip(int x, int y, int width, int height)
+  {
+    Rectangle[] rects = { new Rectangle(x, y, width, height) };
+    context.setClipRectangles(rects);
+  }
+    
+  public void setClip(Shape clip)
+  {
+    /* TODO: create a special RectangleUnion shape that can be
+       used to draw advantage of the GCs ability to set multiple
+       rectangles. 
+    */
+
+    /* FIXME: creating all these objects is wasteful and can be
+       costly in the long run, since this code is run at every
+       expose. */
+    Rectangle newClipBounds = clip.getBounds();
+    
+    if ((clipBounds != null) && !clipBounds.contains(newClipBounds))
+      {
+       System.err.println("warning: old clip ("+ clipBounds +") does " +
+                          "not fully contain new clip (" +
+                          newClipBounds + ")");
+      }
+    clipBounds = newClipBounds;
+    Rectangle[] rects = { clipBounds };
+    context.setClipRectangles(rects);
+  }
+    
+  public void copyArea(int x, int y, int width, int height, int
+                      dx, int dy)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public void drawLine(int x1, int y1, int x2, int y2)
+  {
+    context.drawLine(x1, y1, x2, y2);
+  }
+    
+  public void drawRect(int x, int y, int width, int height)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+    
+  public void fillRect(int x, int y, int width, int height)
+  {
+    context.fillRectangle(x, y, width, height);
+  }
+    
+  public void drawArc(int x, int y, int width, int height, int
+                     startAngle, int arcAngle)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public void fillArc(int x, int y, int width, int height, int
+                     startAngle, int arcAngle)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public void drawPolyline(int[] xPoints, int[] yPoints, int
+                          nPoints)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public void drawPolygon(int[] xPoints, int[] yPoints, int
+                         nPoints)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public void fillPolygon(int[] xPoints, int[] yPoints, int
+                         nPoints)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+
+  public void drawString(String str, int x, int y)
+  {
+    context.drawString(str, x, y);
+  }
+
+  public boolean drawImage(Image img, int x, int y,
+                          ImageObserver observer)
+  {
+    if (clipBounds == null)
+      return false; // ***FIXME***
+
+    if (!(img instanceof BufferedImage))
+      {
+       throw new AWTError("unknown image class");
+      }
+       
+    BufferedImage bimg = (BufferedImage) img;
+
+    XImage ximg = (XImage) bimg.getProperty("gnu.gcj.xlib.XImage");
+    if (ximg == null)
+      {
+       System.err.println("FIXME: skipping null XImage, should " +
+                          "really do on the spot conversion");
+       return false;
+      }
+
+    /*
+      +------------------
+      |    clip
+      |     +---------+
+      | img |         |
+      |  +--+-------+ |
+      |  |  |       | | 
+      |  |  |       | |
+      |  |  +-------+-+
+      |  |          |
+      |  +----------+
+    */
+
+    int iLeft   = Math.max(x, clipBounds.x);
+    int iTop    = Math.max(y, clipBounds.y);
+    int iRight  = Math.min(x + bimg.getWidth(),
+                          clipBounds.x + clipBounds.width);
+    int iBottom = Math.min(y + bimg.getHeight(),
+                          clipBounds.y + clipBounds.height);
+    
+    int srcX = iLeft - x;
+    int srcY = iTop  - y;
+    
+    int width  = iRight  - iLeft;
+    int height = iBottom - iTop;
+    
+    if ((width > 0) && (height > 0))
+      context.putImage(ximg, srcX, srcY, iLeft, iTop, width, height);
+
+    return true;
+  }
+
+  public MappedRaster mapRaster(Rectangle bounds)
+  {
+    Visual visual = config.getVisual();
+    XImage ximage = new XImage(visual, bounds.width, bounds.height,
+                              false // do not auto allocate memory
+                              );
+
+    WritableRaster raster =
+      config.createRasterForXImage(ximage,
+                                  new Point(bounds.x, bounds.y));
+    
+    DataBuffer dataB = raster.getDataBuffer();
+    XGraphicsConfiguration.attachData(ximage, dataB, 0);
+
+    Drawable drawable = context.getDrawable();
+
+    // TODO: restrict to clipping
+
+    Rectangle mBounds = drawable.copyIntoXImage(ximage, bounds, 0, 0);
+       
+    return new XRaster(raster, ximage, config.imageCM);
+  }
+    
+    
+  public void unmapRaster(MappedRaster mappedRaster)
+  {
+    XRaster xraster = (XRaster) mappedRaster;
+    XImage ximage = xraster.ximage;
+    Raster raster = xraster.getRaster();
+    int x = raster.getMinX();
+    int y = raster.getMinY();
+    int width = raster.getWidth();
+    int height = raster.getHeight();
+    
+    context.putImage(ximage, 0, 0, x, y, width, height);
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XGraphicsConfiguration.java b/libjava/gnu/awt/xlib/XGraphicsConfiguration.java
new file mode 100644 (file)
index 0000000..af2663b
--- /dev/null
@@ -0,0 +1,367 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.GraphicsConfiguration;
+import java.awt.Rectangle;
+import java.awt.Graphics2D;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+import java.awt.image.*;
+import java.awt.geom.AffineTransform;
+import gnu.gcj.xlib.GC;
+import gnu.gcj.xlib.Drawable;
+import gnu.gcj.xlib.Window;
+import gnu.gcj.xlib.XImage;
+import gnu.gcj.xlib.Visual;
+import gnu.gcj.xlib.Colormap;
+import gnu.gcj.xlib.XColor;
+import gnu.gcj.xlib.Screen;
+import gnu.gcj.xlib.Display;
+import gnu.gcj.awt.Buffers;
+import java.util.Hashtable;
+
+public class XGraphicsConfiguration extends GraphicsConfiguration
+{
+  //public abstract GraphicsDevice getDevice();
+  
+  Visual visual;
+  int format;
+  Colormap colormap;
+  ColorModel imageCM;
+  ColorModel pixelCM;
+  
+  public XGraphicsConfiguration(Visual visual)
+  {
+    this.visual = visual;
+  }
+
+  public BufferedImage createCompatibleImage(int width, int height)
+  {
+    XImage ximg = new XImage(visual, width, height,
+                            false // do not auto allocate memory
+                            );
+
+    Point origin = new Point(0, 0);
+    WritableRaster raster = createRasterForXImage(ximg, origin);
+
+    /* This is not a good way of doing this. Multiple toolkits may
+       want to share the BufferedImage. */
+    Hashtable props = new Hashtable();
+    props.put("gnu.gcj.xlib.XImage", ximg);
+    props.put("java.awt.GraphicsConfiguration", this);
+    
+    BufferedImage bimg = new BufferedImage(imageCM,raster, false, props);
+
+    DataBuffer dataB = raster.getDataBuffer();
+    attachData(ximg, dataB, 0);
+    return bimg;
+  }
+
+  WritableRaster createRasterForXImage(XImage ximage, Point origin)
+  {
+    if (imageCM == null) prepareColorModel(ximage);
+    
+    /*
+      This will not work, since it creates a sample model that
+      does not necessarily match the format of the XImage.
+      
+      WritableRaster raster =
+      imageCM.createCompatibleWritableRaster(width, height); */
+    
+    // Create a sample model matching the XImage:
+
+    SampleModel imageSM = null;
+
+    int width = ximage.getWidth();
+    int height = ximage.getHeight();
+    int bitsPerPixel = ximage.getBitsPerPixel();
+    int dataType =
+      Buffers.smallestAppropriateTransferType(bitsPerPixel);
+    int bitsPerDataElement = DataBuffer.getDataTypeSize(dataType);
+    int scanlineStride = ximage.getBytesPerLine()*8/bitsPerDataElement;
+    
+    if (imageCM instanceof IndexColorModel)
+      {
+       int[] bandOffsets = {0};
+       imageSM = new ComponentSampleModel(dataType,
+                                          width, height,
+                                          1, // pixel stride
+                                          scanlineStride,
+                                          bandOffsets);
+      }
+    else if (imageCM instanceof PackedColorModel)
+      {
+       PackedColorModel pcm = (PackedColorModel) imageCM;
+       int[] masks = pcm.getMasks();
+       
+       imageSM = new SinglePixelPackedSampleModel(dataType,
+                                                  width, height,
+                                                  scanlineStride,
+                                                  masks);
+      }
+
+    if (imageSM == null)
+      {
+       throw new UnsupportedOperationException("creating sample model " +
+                                               "for " + imageCM +
+                                               " not implemented");
+      }
+
+    WritableRaster raster = Raster.createWritableRaster(imageSM, origin);
+    return raster;
+  }
+
+
+
+  /**
+   * Attach a the memory of a data buffer to an XImage
+   * structure. [This method is not gnu.awt.xlib specific, and should
+   * maybe be moved to a different location.]
+   *
+   * @param offset Offset to data. The given offset does not include
+   * data buffer offset, which will also be added.  */
+  static void attachData(XImage ximage, DataBuffer dataB, int offset)
+  {
+    offset += dataB.getOffset();
+    switch (dataB.getDataType())
+      {
+      case DataBuffer.TYPE_BYTE:
+       ximage.setData(((DataBufferByte) dataB).getData(), offset);
+       break;
+      case DataBuffer.TYPE_USHORT:
+       ximage.setData(((DataBufferUShort) dataB).getData(), offset);
+       break;
+      case DataBuffer.TYPE_INT:
+       ximage.setData(((DataBufferInt) dataB).getData(), offset);
+       break;
+      default:
+       throw
+         new UnsupportedOperationException("Do not know how to " +
+                                           "set data for data " +
+                                           "type " +
+                                           dataB.getDataType());
+      }
+  }
+    
+  void prepareColorModel(XImage ximage)
+  {
+    format = ximage.getFormat();
+    int bitsPerPixel = ximage.getBitsPerPixel();
+    switch (format) {
+    case XImage.ZPIXMAP_FORMAT:
+      calcZPixmapModels(bitsPerPixel);
+      break;
+      
+    default:
+      throw new UnsupportedOperationException("unimplemented format");
+    }
+  }
+
+  void calcZPixmapModels(int bitsPerPixel)
+  {
+    switch (visual.getVisualClass())
+      {
+      case Visual.VC_TRUE_COLOR:
+       calcDecomposedRGBModels(bitsPerPixel);
+       break;
+      case Visual.VC_PSEUDO_COLOR:
+       calcPseudoColorModels(bitsPerPixel);
+       break;
+      default:
+       String msg = "unimplemented visual class";
+       throw new UnsupportedOperationException(msg);
+      }
+  }
+    
+  void calcDecomposedRGBModels(int bitsPerPixel)
+  {
+    int dataType = Buffers.smallestAppropriateTransferType(bitsPerPixel);
+    
+    
+    if (DataBuffer.getDataTypeSize(dataType) == bitsPerPixel)
+      {        
+       ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+       
+       imageCM = new DirectColorModel(cs,
+                                      visual.getDepth(),
+                                      visual.getRedMask(),
+                                      visual.getGreenMask(),
+                                      visual.getBlueMask(),
+                                      0, // no alpha
+                                      false,
+                                      dataType);
+      }
+    else
+      {
+       throw new
+         UnsupportedOperationException("unimplemented bits per pixel");
+      }
+    }
+    
+  void calcPseudoColorModels(int bitsPerPixel)
+  {
+    if (colormap == null)
+      colormap = visual.getScreen().getDefaultColormap();
+    
+    XColor[] colArray = colormap.getXColors();
+       
+    int numCol = colArray.length;
+    byte[] rmap = new byte[numCol];
+    byte[] gmap = new byte[numCol];
+    byte[] bmap = new byte[numCol];
+    byte[] amap = new byte[numCol];
+    
+    for (int i=0; i < numCol; i++)
+      {
+       XColor color = colArray[i];
+       if (color.getFlags() == Colormap.FLAG_SHARED)
+         {
+           rmap[i] = (byte) (color.getRed()   >> 8);
+           gmap[i] = (byte) (color.getGreen() >> 8);
+           bmap[i] = (byte) (color.getBlue()  >> 8);
+           amap[i] = (byte) 0xff;
+         } // else, leave default zero values...
+      }
+
+    imageCM = new IndexColorModel(visual.getDepth(), numCol,
+                                 rmap, gmap, bmap, amap);
+  }
+
+  public BufferedImage createCompatibleImage(int width,
+                                            int height,
+                                            int transparency)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  /**
+   * FIXME: I'm not sure which color model that should be returned here.
+   */
+  public ColorModel getColorModel()
+  {
+    if (pixelCM == null)
+      preparePixelCM();
+    return pixelCM;
+  }
+
+  void preparePixelCM()
+  {
+    switch (visual.getVisualClass())
+      {
+      case Visual.VC_TRUE_COLOR:
+       pixelCM = new DirectColorModel(visual.getDepth(),
+                                      visual.getRedMask(),
+                                      visual.getGreenMask(),
+                                      visual.getBlueMask());
+       break;
+      case Visual.VC_PSEUDO_COLOR:
+
+       if (colormap == null)
+         colormap = visual.getScreen().getDefaultColormap();
+       
+       XColor[] colArray = colormap.getXColors();
+       
+       int numCol = colArray.length;
+       byte[] rmap = new byte[numCol];
+       byte[] gmap = new byte[numCol];
+       byte[] bmap = new byte[numCol];
+       byte[] amap = new byte[numCol];
+       
+       for (int i=0; i < numCol; i++)
+         {
+           XColor color = colArray[i];
+           if (color.getFlags() == Colormap.FLAG_SHARED) {
+             rmap[i] = (byte) (color.getRed()   >> 8);
+             gmap[i] = (byte) (color.getGreen() >> 8);
+             bmap[i] = (byte) (color.getBlue()  >> 8);
+             amap[i] = (byte) 0xff;
+           } // else, leave default zero values...
+
+         }
+
+       pixelCM = new IndexColorModel(visual.getDepth(), numCol,
+                                     rmap, gmap, bmap, amap);
+       break;
+      default:
+       throw new UnsupportedOperationException("not implemented");
+      }
+  }
+  
+  public ColorModel getColorModel(int transparency)
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+    
+  public AffineTransform getDefaultTransform()
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+
+  public AffineTransform getNormalizingTransform()
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+  public Rectangle getBounds()
+  {
+    throw new UnsupportedOperationException("not implemented");
+  }
+
+  Visual getVisual()
+  {
+    return visual;
+  }
+    
+  /* FIXME: This should be moved to XGraphicsDevice... */
+  XFontMetrics getXFontMetrics(java.awt.Font awtFont)
+  {
+    // FIXME: do caching...
+    
+    String family       = "*";
+    String name         = awtFont.getName();
+    String weight       = awtFont.isBold() ? "bold" : "medium";
+    String slant        = awtFont.isItalic() ? "i" : "r";
+    String addStyle     = "*";
+    String pixelSize    = "*";
+    String pointSize    = awtFont.getSize() + "0";
+    String xres         = "*";
+    String yres         = "*";
+    String spacing      = "*";
+    String averageWidth = "*";
+    String charset      = "*";
+    
+    String logicalFontDescription =
+      family    + "-" + name         + "-" + weight    + "-" +
+      slant     + "-" + addStyle     + "-" + pixelSize + "-" +
+      pointSize + "-" + xres         + "-" + yres      + "-" +
+      spacing   + "-" + averageWidth + "-" + charset;
+    
+    Display display = visual.getScreen().getDisplay();
+    gnu.gcj.xlib.Font xfont =
+      new gnu.gcj.xlib.Font(display, logicalFontDescription);
+    return new XFontMetrics(xfont, awtFont);
+  }
+
+  int getPixel(Color color)
+  {
+    int[] components =
+        {
+         color.getRed(),
+         color.getGreen(),
+         color.getBlue(),
+         0xff
+       };
+       
+    ColorModel cm = getColorModel();
+    return cm.getDataElement(components, 0);
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XPanelPeer.java b/libjava/gnu/awt/xlib/XPanelPeer.java
new file mode 100644 (file)
index 0000000..c4ff3f1
--- /dev/null
@@ -0,0 +1,52 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.image.*;
+import gnu.gcj.xlib.WMSizeHints;
+import gnu.gcj.xlib.WindowAttributes;
+import gnu.gcj.xlib.Display;
+import gnu.gcj.xlib.Visual;
+import gnu.gcj.xlib.Screen;
+
+public class XPanelPeer extends XCanvasPeer implements PanelPeer
+{
+
+  public XPanelPeer(Panel panel)
+  {
+    super(panel);
+  }
+
+  // no reason to override yet
+  //void initWindowProperties();
+  //gnu.gcj.xlib.Window getParentWindow();
+  
+
+  // Implementing ContainerPeer:
+  
+  // Default is no insets...
+  static final Insets INSETS_0_PROTOTYPE = new Insets(0, 0, 0, 0);
+
+  public Insets getInsets()
+  {
+    return (Insets) INSETS_0_PROTOTYPE.clone();
+  }
+
+  public void beginValidate()
+  {
+    // NOP
+  }
+  
+  public void endValidate()
+  {
+    // NOP
+  }
+}
diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java
new file mode 100644 (file)
index 0000000..e400b05
--- /dev/null
@@ -0,0 +1,333 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.awt.xlib;
+
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.image.ImageProducer;
+import java.awt.image.ImageObserver;
+import java.net.*;
+import java.awt.datatransfer.Clipboard;
+
+import gnu.gcj.xlib.Display;
+import gnu.gcj.xlib.Screen;
+import gnu.gcj.xlib.Visual;
+
+public class XToolkit extends Toolkit
+{
+  static XToolkit INSTANCE;
+  
+  Display display;
+
+  EventQueue queue;
+  XEventLoop eventLoop;
+
+  XGraphicsConfiguration defaultConfig;
+
+  public XToolkit()
+  {
+    INSTANCE = this;
+    display = new Display();
+    synchronized (display)
+      {
+       queue = new XEventQueue(display);
+       eventLoop = new XEventLoop(display, queue);
+      }
+  }
+
+  public void flushIfIdle()
+  {
+    eventLoop.flushIfIdle();
+  }
+
+  protected ButtonPeer createButton(Button frontend)
+  {
+    // FIXME: Stubbed out, needs Swing:
+    /*
+    XCanvasPeer realPeer = new XCanvasPeer(frontend);
+    SButtonPeer sbPeer = new SButtonPeer(frontend, realPeer);
+    return sbPeer;
+    */
+    return null;
+  }
+    
+  protected TextFieldPeer createTextField(TextField frontend)
+  {
+    return null; // FIXME
+  }
+    
+  protected LabelPeer createLabel(Label frontend) 
+  {
+    return null; // FIXME
+  }
+    
+  protected ListPeer createList(List frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected CheckboxPeer createCheckbox(Checkbox frontend) 
+  {
+    return null; // FIXME
+  }
+    
+  protected ScrollbarPeer createScrollbar(Scrollbar frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected ScrollPanePeer createScrollPane(ScrollPane frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected TextAreaPeer createTextArea(TextArea frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected ChoicePeer createChoice(Choice frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected FramePeer createFrame(Frame frontend) {
+    return new XFramePeer(frontend);
+  }
+
+  protected CanvasPeer createCanvas(Canvas frontend) {
+    XCanvasPeer peer = new XCanvasPeer(frontend);
+    return peer;
+  }
+  
+  protected PanelPeer createPanel(Panel frontend) {
+    return new XPanelPeer(frontend);
+  }
+
+  protected WindowPeer createWindow(Window frontend) 
+  {
+    return null; // FIXME
+  }
+    
+  protected DialogPeer createDialog(Dialog frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected MenuBarPeer createMenuBar(MenuBar frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected MenuPeer createMenu(Menu frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected PopupMenuPeer createPopupMenu(PopupMenu frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected MenuItemPeer createMenuItem(MenuItem frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected FileDialogPeer createFileDialog(FileDialog frontend) 
+  {
+    return null; // FIXME
+  }
+  
+  protected CheckboxMenuItemPeer
+      createCheckboxMenuItem(CheckboxMenuItem frontend) 
+  {
+    return null; // FIXME
+  }
+
+  protected java.awt.peer.FontPeer getFontPeer(String name, int style) 
+  {
+    return null;
+  }
+
+  public Dimension getScreenSize()
+  { 
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public int getScreenResolution()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public java.awt.image.ColorModel getColorModel()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public String[] getFontList()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public FontMetrics getFontMetrics(Font font)
+  {
+    return defaultConfig.getXFontMetrics(font);
+  }
+
+  public void sync()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+    
+  public Image getImage(String filename)
+  {
+    return createImage(filename);
+  }
+  
+  public Image getImage(URL url)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public Image createImage(String filename)
+  {
+    // FIXME: Stubbed out. We need a proper image I/O API.
+
+    /*
+    BufferedImage jpeg;
+    FileInputStream fis = openFile(filename);
+    if (fis == null)
+      return null;
+    
+    BasicRasterImageConsumer consumer = new BasicRasterImageConsumer();
+    JPEGImageDecoder jid = new JPEGImageDecoder(fis);
+
+    jid.startProduction(consumer);
+    jpeg = consumer.getImage();
+    
+    int w = jpeg.getWidth();
+    int h = jpeg.getHeight();
+    
+    BufferedImage img =
+      getDefaultXGraphicsConfiguration().createCompatibleImage(w, h);
+    
+    Renderers renderers = Renderers.getInstance();
+    
+    RasterOp renderer = renderers.createRenderer(jpeg.getColorModel(),
+                                                jpeg.getSampleModel(),
+                                                img.getColorModel(),
+                                                img.getSampleModel());
+       
+    if (renderer == null)
+      {
+       throw new UnsupportedOperationException("couldn't find renderer");
+      }
+
+    renderer.filter(jpeg.getRaster(), img.getRaster());
+    
+    return img;
+    */
+
+    return null;
+  }
+
+  public Image createImage(URL url)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public boolean prepareImage(Image image,
+                             int width,
+                             int height,
+                             ImageObserver observer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public int checkImage(Image image,
+                       int width,
+                       int height,
+                       ImageObserver observer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+  
+  public Image createImage(ImageProducer producer)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public Image createImage(byte[] imagedata,
+                          int imageoffset,
+                          int imagelength)
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  /*
+    public PrintJob getPrintJob(Frame frame,
+                               String jobtitle,
+                               Properties props);
+  */
+
+  public void beep()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+
+  public Clipboard getSystemClipboard() 
+  {
+    return null; // FIXME
+  }
+    
+  protected EventQueue getSystemEventQueueImpl()
+  {
+    return queue;
+  }
+    
+  XGraphicsConfiguration getDefaultXGraphicsConfiguration()
+  {
+    if (defaultConfig == null)
+      {
+       Screen screen = display.getDefaultScreen();
+       Visual visual = screen.getRootVisual();
+       defaultConfig = new XGraphicsConfiguration(visual);
+
+       // ASSERT:
+       if (!defaultConfig.getVisual().getScreen().equals(screen))
+         {
+           String msg = "screen of graphics configuration is not " +
+             "default screen";
+           throw new Error(msg);
+         }
+      }
+    
+    return defaultConfig;
+  }
+
+
+    /*
+    public DragSourceContextPeer
+       createDragSourceContextPeer(DragGestureEvent dge)
+       throws InvalidDnDOperationException;
+
+    public DragGestureRecognizer
+       createDragGestureRecognizer(Class abstractRecognizerClass,
+                                   DragSource ds, Component c,
+                                   int srcActions, DragGestureListener dgl) {
+       throw new UnsupportedOperationException("not implemented");
+    }
+    */
+
+    
+    /*
+    public Map mapInputMethodHighlight(InputMethodHighlight highlight);
+    */
+}
diff --git a/libjava/gnu/gcj/xlib/Clip.java b/libjava/gnu/gcj/xlib/Clip.java
new file mode 100644 (file)
index 0000000..28bb02a
--- /dev/null
@@ -0,0 +1,35 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+import java.awt.Rectangle;
+
+/**
+ * Describes a clip that is used to constrain drawing using a GC
+ * within a specific region. Currently it supports clip regions
+ * consisting of the union of multiple rectangles. Other clip forms
+ * may be implented later. This class is used internally by the GC
+ * class, and wraps a native XRectVector[].
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+final class Clip
+{
+  public Clip(Rectangle[] rects)
+  {
+    init(rects);
+  }
+
+  private native void init(Rectangle[] rects);
+
+  public native void finalize();
+
+  RawData xrects;
+}
diff --git a/libjava/gnu/gcj/xlib/Colormap.java b/libjava/gnu/gcj/xlib/Colormap.java
new file mode 100644 (file)
index 0000000..538782e
--- /dev/null
@@ -0,0 +1,84 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/**
+ * An X11 color map resource.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public final class Colormap extends XID
+{
+  Screen screen;
+  
+  public static final byte FLAG_SHARED = 1;
+  public static final byte FLAG_NOT_SHARED = 2;
+  
+  public Colormap(Screen screen, int xid)
+  {
+    super(screen.getDisplay(), xid);
+    this.screen = screen;
+  }
+  
+  /**
+   * Allocate color pixel.
+   *
+   * @param color The color to be allocated.  If allocation is
+   * successful, this object will be modified to reflect the actual
+   * color that was allocated.
+   *
+   * @return the pixel value of the allocated color.
+   */
+  public native long allocateColorPixel(XColor color);
+
+  /**
+   * Allocate a color consisting of the given RGB-triplet.
+   *
+   * @return a color object describing the allocated color.
+   */
+  public XColor allocateColor(int r, int g, int b)
+  {
+    XColor color = new XColor(r, g, b);
+    allocateColorPixel(color);
+    
+    return color;
+  }
+
+  /**
+   * Get an array of all colors that currently resides in shared (read
+   * only) color-cells in this color map.
+   */
+  public native XColor[] getSharedColors();
+
+
+  /**
+   * Get all colors currently residing in this color map.  Colors that
+   * are shared (read only) are marked as such by the color flags.
+   * The indexes of the returned array will correspond to the
+   * colorcells of the color map.  Given a color <code>XColor
+   * color</code> from a given color-cell, the expression
+   * <code>color.getFlags() == Colormap.FLAG_SHARED</code> will check
+   * whether the color-cell is shared.
+   */
+  public native XColor[] getXColors();
+
+  /**
+   * Convenience method used by native code to create fully
+   * initialized arrays of XColor objects.
+   */
+  private XColor[] newXColorArray(int n)
+  {
+    XColor[] array = new XColor[n];
+    for (int i=0; i<n; i++)
+      array[i] = new XColor();
+    return array;
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/Display.java b/libjava/gnu/gcj/xlib/Display.java
new file mode 100644 (file)
index 0000000..50ff129
--- /dev/null
@@ -0,0 +1,105 @@
+/* Copyright (C) 1999, 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.Enumeration;
+
+import gnu.gcj.RawData;
+
+/**
+ * A connection to an X11 display.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+
+public class Display
+{
+  static
+  {
+    staticInit();
+  }
+
+  public Display()
+  {
+    init();
+  }
+    
+  private static native void staticInit();
+  private native void init();
+  protected native void finalize();
+
+  RawData display = null;
+
+  /* TODO?: Rather than storing such data here, we might consider
+     using the context manager facilities provided by Xlib... */
+  private Dictionary xids = new Hashtable();
+
+  protected final void addXID(int xid, XID window)
+  {
+    xids.put(new Integer(xid), window);
+  }
+  
+  protected final void removeXID(int xid)
+  {
+    xids.remove(new Integer(xid));
+  }
+
+  public final Window getDefaultRootWindow()
+  {
+    int rootXID = getDefaultRootWindowXID();
+    return getWindow(rootXID);
+  }
+
+  public final XID getXID(int xid)
+  {
+    return (XID) xids.get(new Integer(xid));
+  }
+
+  public final Window getWindow(int xid)
+  {
+    Window window = (Window) getXID(xid);
+    if (window == null)
+      {
+       window = new Window(this, xid);
+       addXID(xid, window);
+      }
+    return window;
+  }
+
+  public final Screen getDefaultScreen()
+  {
+    /* Screens objects are not cached since they are lightweight.
+       We just create a new object when requested. */
+    return new Screen(this, getDefaultScreenNumber());
+  }
+
+  public final native int getDefaultScreenNumber();
+
+  private final native int getDefaultRootWindowXID();
+    
+  private Dictionary atoms = new Hashtable();
+
+  public final int getAtom(String name)
+  {
+    Integer atomInt = (Integer) atoms.get(name);
+    if (atomInt == null)
+      return internAtom(name);
+    return atomInt.intValue();
+  }
+
+  // TODO?: cache reverse lookup too?
+  public final native String getAtomName(int atom);
+
+  private final native int internAtom(String name);
+
+  public native void flush();
+}
diff --git a/libjava/gnu/gcj/xlib/Drawable.java b/libjava/gnu/gcj/xlib/Drawable.java
new file mode 100644 (file)
index 0000000..5652792
--- /dev/null
@@ -0,0 +1,82 @@
+/* Copyright (C) 1999, 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import java.awt.Rectangle;
+
+/** An X11 drawable.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class Drawable extends XID
+{
+  public Drawable(Display display, int xid)
+  {
+    super(display, xid);
+  }
+
+  /**
+   * Gets as much as possible of the image data within the requested
+   * region. Data from obscured parts of windows may not be
+   * retrievable.
+   *  
+   * @param dest where to place the image data.
+   * 
+   * @return the actual region of image data that was retrieved.
+   */
+  public Rectangle copyIntoXImage(XImage dest, Rectangle bounds,
+                                 int destX, int destY)
+  {
+    Rectangle newBounds = null;
+    int tries = 5;
+    while (!bounds.isEmpty())
+      {
+       if (copyIntoXImageImpl(dest, bounds.x, bounds.y,
+                              bounds.width, bounds.height,
+                              destX, destY))
+         return bounds;
+           
+       // failed, likely due to wrong bounds...
+       
+       newBounds = getBounds(newBounds);
+       
+       bounds = newBounds.intersection(bounds);
+       
+       tries--;
+       
+       if (tries < 0)
+       throw new RuntimeException("copyIntoXImage is buggy");
+       
+      }
+    
+    return bounds; // always empty
+  }
+
+
+
+  /**
+   * Performs an XGetSubImage. This method will fail if the X server
+   * does not possess the requested image data. This might occur when
+   * requesting the image date of a window that is partially obscured.
+   *
+   * @param desitantionImage where to place the image data
+   *
+   * @return false if method was unable to read the requested region.
+   */
+  private native boolean copyIntoXImageImpl(XImage destinationImage,
+                                           int x, int y,
+                                           int width, int height,
+                                           int destX, int destY);
+
+  public native Rectangle getBounds(Rectangle rv);
+  
+  private static final String MSG_XGETSUBIMAGE_FAILED =
+    "XGetSubImage() failed.";
+    
+}
diff --git a/libjava/gnu/gcj/xlib/Font.java b/libjava/gnu/gcj/xlib/Font.java
new file mode 100644 (file)
index 0000000..cd2fff9
--- /dev/null
@@ -0,0 +1,51 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/**
+ * An X11 Font, implemented as a wrapper around an X11 Font XID and
+ * the associated Xlib XFontStruct structure.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public final class Font extends XID
+{
+
+  /**
+   * @param lfdNamePattern a font name pattern following the
+   * <em>X Logical Font Description Conventions</em>.
+   */
+  public Font(Display display, String lfdNamePattern)
+  {
+    this(display, loadFont(display, lfdNamePattern));
+  }
+
+  Font(Display display, RawData struct)
+  {
+    super(display, getXIDFromStruct(struct));
+    structure = struct;
+  }
+
+  static native RawData loadFont(Display display, String lfdNamePattern);
+
+  static native int getXIDFromStruct(RawData structure);
+
+  public native int getAscent();
+  public native int getDescent();
+  public native int getMaxAscent();
+  public native int getMaxDescent();
+
+  public native int getStringWidth(String str);
+
+  protected native void finalize();
+
+  RawData structure;
+}
diff --git a/libjava/gnu/gcj/xlib/GC.java b/libjava/gnu/gcj/xlib/GC.java
new file mode 100644 (file)
index 0000000..6b33715
--- /dev/null
@@ -0,0 +1,113 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+import java.awt.Rectangle;
+
+/**
+ * An X11 graphics context.  Unlike a traditional X11 graphics
+ * context, the target drawable is part of the GC state.
+ *
+ * Implementation notes: There is no need to do coalescing of changes
+ * since Xlib will do this for us.  The implementation relies on the
+ * Xlib GC cache and will not try to be clever.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class GC implements Cloneable
+{
+  
+  public GC(Drawable target)
+  {
+    this.target = target;
+    initStructure(null);
+  }
+
+  public Object clone()
+  {
+    GC gcClone = (GC) super.clone();
+    gcClone.structure = null;
+    gcClone.initStructure(this);
+    gcClone.updateClip();
+    return gcClone;
+  }
+
+  private native void initStructure(GC copyFrom);
+
+  public GC create()
+  {
+    return (GC) clone();
+  }
+
+  public void finalize()
+  {
+    disposeImpl();
+  }
+
+  public void dispose()
+  {
+    disposeImpl();
+  }
+
+  public synchronized native void disposeImpl();
+
+  public native void setForeground(long pixel);
+  public native void setFont(gnu.gcj.xlib.Font font);
+
+  /**
+   * Set the clip region for the graphics operations performed by the
+   * GC.
+   *
+   * This is one of the few costly operations of this class.  It is
+   * suggested that the clip is only set or changed if really
+   * necessary.  Higher level APIs can make such optimizations
+   * transparent.
+   *
+   * @param rectangles the union of these rectangles describe the clip
+   * region.
+   */
+  public void setClipRectangles(Rectangle[] rectangles)
+  {
+    clip = new Clip(rectangles);
+    updateClip();
+  }
+
+  public native void drawString(String text, int x, int y);
+  public native void drawLine(int x1, int y1, int x2, int y2);
+  public native void drawRectangle(int x, int y, int w, int h);
+
+  public native void fillRectangle(int x, int y, int w, int h);
+
+  /** 
+   * 
+   * Clear area using the background pixel or pixmap of the drawable.
+   * Note that this operation does not adhere to the current clip.
+   */
+  public native void clearArea(int x, int y, int w, int h,
+                              boolean exposures);
+
+
+  public native void putImage(XImage image,
+                             int srcX, int srcY,
+                             int destX, int destY,
+                             int width, int height);
+
+  public Drawable getDrawable()
+  {
+    return target;
+  }
+
+  private native void updateClip();
+
+  private Drawable target;
+  private RawData structure;
+  private Clip clip;
+}
+
diff --git a/libjava/gnu/gcj/xlib/Pixmap.java b/libjava/gnu/gcj/xlib/Pixmap.java
new file mode 100644 (file)
index 0000000..a81f55c
--- /dev/null
@@ -0,0 +1,43 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+/**
+ * An X11 Pixmap. A pixmap is an offscreen drawable that resides on
+ * the X server. A pixmap is bound to the screen it was created for.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class Pixmap extends Drawable
+{
+  public Pixmap(XImage image, Screen screen)
+  {
+    this(screen.getRootWindow(),
+        image.getWidth(), image.getHeight(),
+        image.getDepth());
+    
+    /* FIXME: don't create a new GC all the time.  This might actually
+    not be as bad as initially believed.  The GC cache of Xlib makes
+    this opertation less costly. */
+    GC gc = new GC(this);
+    
+    gc.putImage(image, 0, 0, 0, 0, image.getWidth(), image.getHeight());
+  }
+
+  public Pixmap(Drawable sameScreenAs, int width, int height, int depth)
+  {
+    super(sameScreenAs.getDisplay(), 
+         createXID(sameScreenAs, width, height, depth));
+  }
+
+  protected static native int createXID(Drawable sameScreenAs,
+                                       int width, int height, int depth);
+
+  protected native void finalize();
+}
diff --git a/libjava/gnu/gcj/xlib/Screen.java b/libjava/gnu/gcj/xlib/Screen.java
new file mode 100644 (file)
index 0000000..675ed1b
--- /dev/null
@@ -0,0 +1,86 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/**
+ * A flyweight class that denotes an X11 screen.  Display and screen
+ * number is the only data kept by this class.  The real screen
+ * structure is stored in the display.  There may exist several
+ * objects denoting the same screen.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public final class Screen
+{
+  static final int UNKNOWN = -1;
+
+  Display display;
+  int screenNumber = UNKNOWN;
+  RawData structure;
+  
+  Screen(Display display, RawData screenStructure)
+  {
+    structure = screenStructure;
+    this.display = display;
+  }
+
+  public Screen(Display display)
+  {
+    this(display, display.getDefaultScreenNumber());
+  }
+
+  public Screen(Display display, int screenNumber)
+  {
+    this.display = display;
+    this.screenNumber = screenNumber;
+    initStructure();
+  }
+
+  public final Display getDisplay()
+  {
+    return display;
+  }
+
+  public Window getRootWindow()
+  {
+    int rootXID = getRootWindowXID();
+    return display.getWindow(rootXID);
+  }
+
+  public Visual getRootVisual()
+  {
+    RawData visualStructure = getRootVisualStructure();
+    int depth = getRootDepth();
+    return new Visual(visualStructure, this, depth);
+  }
+
+  private native RawData getRootVisualStructure();
+
+  public native int getRootDepth();
+  public native int getRootWindowXID();
+  public native int getDefaultColormapXID();
+
+  native void initStructure();
+
+  public Colormap getDefaultColormap()
+  {
+    return new Colormap(this, getDefaultColormapXID());
+  }
+  
+  public final int getScreenNumber()
+  {
+    if (screenNumber == UNKNOWN)
+      screenNumber = findScreenNumber();
+    return screenNumber;
+  }
+
+  public native int findScreenNumber();
+}
diff --git a/libjava/gnu/gcj/xlib/Visual.java b/libjava/gnu/gcj/xlib/Visual.java
new file mode 100644 (file)
index 0000000..46fd3ee
--- /dev/null
@@ -0,0 +1,152 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/** 
+ * A visual determines how a color is encoded into a pixel/bitfield
+ * value.  It does not determine how the pixel/bitfield value is
+ * encoded into the image data.
+ * 
+ * <p>This class encapsulates all three Xlib representations of a
+ * visual.
+ * 
+ * <ul>
+ * 
+ * <li>int: visual id.
+ * 
+ * <li>Visual: opaque data structure used by a lot of Xlib functions.
+ * 
+ * <li>VisualInfo: transparent data structure that binds the visual to
+ * a certain screen and depth.
+ * 
+ * </ul>
+ * 
+ * <p>Implementation note: This class does not examine nor manipulate
+ * the Visual structure, since the X manual says the structure is
+ * opaque, and that XVisualInfo should be used instead.</p>
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public final class Visual
+{
+  public static final int VC_STATIC_GRAY  = 0,
+                         VC_GRAY_SCALE   = 1,
+                          VC_STATIC_COLOR = 2,
+                          VC_PSEUDO_COLOR = 3,
+                         VC_TRUE_COLOR   = 4,
+                          VC_DIRECT_COLOR = 5;
+  
+  protected static final int MASK_ID            = 1 << 0,
+                             MASK_SCREEN        = 1 << 1,
+                             MASK_DEPTH         = 1 << 2,
+                             MASK_CLASS         = 1 << 3,
+                             MASK_RED           = 1 << 4,
+                             MASK_GREEN         = 1 << 5,
+                             MASK_BLUE          = 1 << 6,
+                             MASK_COLORMAP_SIZE = 1 << 7,
+                             MASK_BITS_PER_RGB  = 1 << 8;
+
+  protected static final int MASK_ALL = MASK_ID
+      | MASK_SCREEN
+      | MASK_DEPTH
+      | MASK_CLASS
+      | MASK_RED
+      | MASK_GREEN
+      | MASK_BLUE
+      | MASK_COLORMAP_SIZE
+      | MASK_BITS_PER_RGB;
+
+  private static final int MASK_VISUAL_STRUCTURE = 1 << 31;
+
+  Display display;
+  RawData xVisualInfo;
+  int infoMask;
+  Screen screen;
+
+  Visual(RawData structure, Screen screen, int depth )
+  {
+    this.display = screen.getDisplay();
+    this.screen = screen;
+    init(structure, depth);
+  }
+
+  Visual(Display display, RawData structure, int depth )
+  {
+    this.display = display;
+    init(structure, depth);
+  }
+
+  protected native void init(RawData structure, int depth);
+
+  protected native void finalize();
+
+  /**
+   *
+   * Returns the a reference to the visual structure.  This method has
+   * package accessibility since the data visual structure is only
+   * useful for direct Xlib calls.
+   *
+   * @return a pointer to the visual structure.
+   */
+  native RawData getVisualStructure();
+
+    
+  // These methods only make sense if the visual is decomposed:
+
+  public native int getRedMask();
+  public native int getGreenMask();
+  public native int getBlueMask();
+
+  public native int getScreenNumber();
+  public native int getDepth();
+
+  public Screen getScreen()
+  {
+    if (screen == null)
+      screen = new Screen(display, getScreenNumber());
+    return screen;
+  }
+
+  public native int getVisualClass();
+
+  public boolean hasRGBSubfields()
+  {
+    switch (getVisualClass())
+      {
+      case VC_TRUE_COLOR:
+      case VC_DIRECT_COLOR:
+       return true;
+      default:
+       return false;
+      }
+  }
+
+  protected native void ensureXVisualInfo(int requiredMask);
+
+
+  public String toString()
+  {
+    int missingInfo = ~infoMask;
+    boolean hasSubfieldInfo =
+      (missingInfo & (MASK_CLASS|MASK_RED|MASK_GREEN|MASK_BLUE)) == 0;
+
+    boolean hasDepth = (missingInfo & MASK_DEPTH) == 0;
+       
+    return getClass().getName() + "[" +
+      (hasDepth ? "depth=" + getDepth() : "") +
+      (hasRGBSubfields() ?
+       (", redMask=" + Integer.toHexString(getRedMask()) +
+       ", greenMask=" + Integer.toHexString(getGreenMask()) +
+       ", blueMask=" + Integer.toHexString(getBlueMask())) :
+       ", no-subfields") + ", class=" + getVisualClass() +
+      "]";
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/WMSizeHints.java b/libjava/gnu/gcj/xlib/WMSizeHints.java
new file mode 100644 (file)
index 0000000..29344ee
--- /dev/null
@@ -0,0 +1,44 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/** 
+ * Size hints for an X11 window in its normal state. This class wraps
+ * the Xlib XSizeHints stucture.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class WMSizeHints implements Cloneable
+{
+  public WMSizeHints()
+  {
+    init(null);
+  }
+
+  private native void init(WMSizeHints copyFrom);
+  protected native void finalize();
+
+  public Object clone() {
+    WMSizeHints hints = (WMSizeHints) super.clone();
+    // In case of an exception before the stucture is copied.
+    hints.structure = null;
+
+    hints.init(this);
+    return hints;
+  }
+
+  public native void applyNormalHints(Window window);
+
+  public native void setMinSize(int width, int height);
+  public native void setMaxSize(int width, int height);
+  
+  RawData structure;
+}
diff --git a/libjava/gnu/gcj/xlib/Window.java b/libjava/gnu/gcj/xlib/Window.java
new file mode 100644 (file)
index 0000000..ae3dbfd
--- /dev/null
@@ -0,0 +1,104 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+import java.awt.Rectangle;
+
+/**
+ * An X11 window.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class Window extends Drawable
+{
+  // Must correspond with X.h definitions:
+  public static final int COPY_FROM_PARENT = 0;
+  public static final int INPUT_OUTPUT     = 1;
+  public static final int INPUT_ONLY       = 2;
+
+  public Window(Window parent, Rectangle bounds,
+               WindowAttributes attributes)
+  {
+    this(parent, bounds, attributes, null);
+  }
+  
+  public Window(Window parent, Rectangle bounds,
+               WindowAttributes attributes, Visual visual)
+  {
+    this(parent, bounds, 0, attributes, COPY_FROM_PARENT, visual);
+  }
+
+  public Window(Window parent, Rectangle bounds, int borderWidth,
+               WindowAttributes attributes, int windowIOClass,
+               Visual visual)
+  {
+    this(parent.display,
+        parent.createChildXID(bounds, borderWidth, attributes, 
+                              windowIOClass, visual));
+    this.owned = true;
+  }
+
+  protected Window(Display display, int xid)
+  {
+    super(display, xid);
+    display.addXID(xid, this);
+  }
+
+  protected void finalize()
+  {
+    display.removeXID(xid);
+    if (owned)
+      {
+       destroy();
+       owned = false;
+      }
+  }
+
+  protected native void destroy();
+
+  protected native int createChildXID(Rectangle bounds,
+                                     int borderWidth,
+                                     WindowAttributes attributes,
+                                     int windowIOClass, 
+                                     Visual visual);
+
+  public native void setAttributes(WindowAttributes attributes);
+
+  public native void map();
+  public native void unmap();
+  
+  protected boolean owned = false;
+
+  public native void setProperty(int nameAtom, int typeAtom, byte[] data);
+  
+  public void setProperty(int nameAtom, int typeAtom, String data)
+  {
+    int length = data.length();
+    byte[] byteData = new byte[length];
+    
+    for (int i=0; i<length; i++)
+      byteData[i] = (byte) data.charAt(i);
+
+    setProperty(nameAtom, typeAtom, byteData);
+  }
+
+  public native void setWMProtocols(int[] atoms);
+  public native int[] getWMProtocols();
+
+  public void setProperty(String nameAtom, String typeAtom, String data)
+  {
+    int xaName = display.getAtom(nameAtom);
+    int xaType = display.getAtom(typeAtom);
+    
+    setProperty(xaName, xaType, data);
+  }
+
+  public native void setBounds(int x, int y, int width, int height);
+}
diff --git a/libjava/gnu/gcj/xlib/WindowAttributes.java b/libjava/gnu/gcj/xlib/WindowAttributes.java
new file mode 100644 (file)
index 0000000..72a3bb8
--- /dev/null
@@ -0,0 +1,106 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+import gnu.gcj.RawData;
+
+/**
+ * 
+ * Collection of attributes that can be applied to or read from an
+ * X11 window.
+ *
+ * <p>TODO: Split this class into two classes. One for the structure
+ * XSetWindowAttributes and one for the XWindowAttributes.  However
+ * they should still share this common base class.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> */
+public class WindowAttributes
+{
+  // Must match definitions in X.h:
+  public final static long MASK_BUTTON_PRESS     = 1L<< 2,
+                           MASK_BUTTON_RELEASE   = 1L<< 3,
+                           MASK_EXPOSURE         = 1L<<15,
+                           MASK_STRUCTURE_NOTIFY = 1L<<17;
+
+  public WindowAttributes()
+  {
+    init(null);
+  }
+  
+  public WindowAttributes(Window from)
+  {
+    initFromWindow(from);
+  }
+
+  private native void initFromWindow(Window from);
+  private native void init(WindowAttributes copyFrom);
+  protected native void finalize();
+    
+  public Object clone()
+  {
+    WindowAttributes attributes = (WindowAttributes) super.clone();
+    // In case of an exception before the stucture is copied.
+    attributes.in  = 0;
+    attributes.out = 0;
+    
+    // FIXME: do anything else?
+       
+    attributes.init(this);
+    return attributes;
+  }
+
+  public native void setBackground(long pixel);
+  public native void setBackground(Pixmap pixmap);
+  public native void setEventMask(long eventMask);
+
+  public void setVisual(Visual visual)
+  {
+    this.visual = visual;
+  }
+
+  /**
+   * Retrieve the visual. 
+   *
+   * @return the visual that is or should be used by a window.  null
+   * means CopyFormParent. 
+   */
+  public native Visual getVisual();
+
+  Display display;
+
+  /**
+   * Reference to XWindowAttribute structure containing attributes
+   * read from a window.
+   */
+  RawData in = 0;
+
+  /**
+   * Reference to XSetWindowAttribute structure containing attributes
+   * to be applied to a window.
+   */
+  RawData out = 0;
+
+  long mask;
+
+  /** null means CopyFromParent during window creation. */
+  Visual visual = null;
+
+  public native void apply(Window window);
+
+  final RawData getXSetWindowAttributesStructure()
+  {
+    if (out == null)
+      initOut();
+    return out;
+  }
+  
+  void initOut()
+  {
+    throw new UnsupportedOperationException("not implemented yet");
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/XAnyEvent.java b/libjava/gnu/gcj/xlib/XAnyEvent.java
new file mode 100644 (file)
index 0000000..e7a4a02
--- /dev/null
@@ -0,0 +1,75 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/** 
+ * Mutable event structure that can contain any data from any event
+ * type.  Events can be constructed or loaded from the event queue.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public final class XAnyEvent
+{
+  // Must match the definitions in X.h:
+  public static final int TYPE_BUTTON_PRESS     =  4,
+                          TYPE_BUTTON_RELEASE   =  5,
+                         TYPE_EXPOSE           = 12,
+                         TYPE_UNMAP_NOTIFY     = 18,
+                         TYPE_MAP_NOTIFY       = 19,
+                         TYPE_REPARENT_NOTIFY  = 21,
+                         TYPE_CONFIGURE_NOTIFY = 22,
+                         TYPE_CLIENT_MESSAGE   = 33;
+    
+  // Must match the definitions in X.h:
+  public final static long MASK_SUBSTRUCTURE_NOTIFY   = 1L<<19,
+                          MASK_SUBSTRUCTURE_REDIRECT = 1L<<20;
+
+  XAnyEvent(Display display)
+  {
+    this.display = display;
+    init();
+  }
+
+  private native void init();
+  protected native void finalize();
+
+  /**
+   * Load next event into the event structure.
+   */
+  public native void loadNext();
+
+  public native int getType();
+  public native void setType(int type);
+
+  public native Window getWindow();
+  public native void setWindow(Window window);
+  
+  /**
+   * @returns the number of the last request processed by the server.
+   */
+  public native long getSerial();
+
+  public native void send(Window destination, boolean propagate,
+                         long mask);
+
+  RawData structure;
+  Display display;
+
+  public String toString()
+  {
+    if (structure == null)
+      return getClass().getName() + "[no-structure]";
+
+    return getClass().getName() +
+      "[type=" + getType() +
+      ",window=" + getWindow() + "]";
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/XButtonEvent.java b/libjava/gnu/gcj/xlib/XButtonEvent.java
new file mode 100644 (file)
index 0000000..032830b
--- /dev/null
@@ -0,0 +1,53 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+/**
+ * Interprets data from an Xlib XButtonEvent into members of java
+ * primitive types.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XButtonEvent extends XEvent
+{
+
+  // Must match the definition in X.h:
+  public static final int MASK_SHIFT   = 1<<0,
+                          MASK_LOCK    = 1<<1,
+                          MASK_CONTROL = 1<<2,
+                          MASK_MOD1    = 1<<3,
+                          MASK_MOD2    = 1<<4,
+                          MASK_MOD3    = 1<<5,
+                          MASK_MOD4    = 1<<6,
+                          MASK_MOD5    = 1<<7;
+  public XButtonEvent(XAnyEvent event)
+  {
+    super(event);
+
+    // FIXME: Avoid double checking?
+    if ((event.getType() != XAnyEvent.TYPE_BUTTON_PRESS) &&
+       (event.getType() != XAnyEvent.TYPE_BUTTON_RELEASE))
+      {
+       throw new IllegalArgumentException("Wrong event type");
+      }
+    init();
+  }
+
+  native void init();
+  
+  public long time;
+  public int  x;
+  public int  y;
+  public int  state;
+  public int  button;
+}
+
+
+
diff --git a/libjava/gnu/gcj/xlib/XColor.java b/libjava/gnu/gcj/xlib/XColor.java
new file mode 100644 (file)
index 0000000..7abcc17
--- /dev/null
@@ -0,0 +1,42 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/**
+ * A color or color-cell on the X server.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public final class XColor
+{
+  public XColor(int r, int g, int b)
+  {
+    this();
+    setRGB(r, g, b);
+  }
+
+  public XColor()
+  {
+    init();
+  }
+
+  private native void init();
+  protected native void finalize();
+
+  public final native void setRGB(int r, int g, int b);
+  public final native int getRed();
+  public final native int getGreen();
+  public final native int getBlue();
+  public final native byte getFlags();
+  public final native long getPixelValue();
+  
+  RawData structure = 0;
+}
diff --git a/libjava/gnu/gcj/xlib/XConfigureEvent.java b/libjava/gnu/gcj/xlib/XConfigureEvent.java
new file mode 100644 (file)
index 0000000..0d069ea
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import java.awt.Rectangle;
+
+/**
+ * Interprets and retrieves data from an Xlib XConfigureEvent.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XConfigureEvent extends XEvent
+{
+  public XConfigureEvent(XAnyEvent event)
+  {
+    super(event);
+    // FIXME: Avoid double checking?
+    if (event.getType() != XAnyEvent.TYPE_CONFIGURE_NOTIFY)
+      throw new IllegalArgumentException("Wrong event type");
+  }
+  
+  public native Rectangle getBounds();
+}
+
+
+
diff --git a/libjava/gnu/gcj/xlib/XConnectException.java b/libjava/gnu/gcj/xlib/XConnectException.java
new file mode 100644 (file)
index 0000000..829da66
--- /dev/null
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import java.io.IOException;
+
+/**
+ * Indicates that something went wrong with the connection to an X11
+ * display.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XConnectException extends IOException
+{
+  public XConnectException()
+  {
+    super();
+  }
+
+  public XConnectException(String message)
+  {
+    super(message);
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/XEvent.java b/libjava/gnu/gcj/xlib/XEvent.java
new file mode 100644 (file)
index 0000000..75f602a
--- /dev/null
@@ -0,0 +1,45 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/**
+ * Base class for interpreters of specific X event types.  For methods
+ * concerning all X events, see XAnyEvent.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XEvent
+{
+  public XEvent(XAnyEvent event)
+  {
+    this.event = event;
+  }
+  
+  public XEvent(int type, Display display)
+  {
+    this(new XAnyEvent(display));
+    event.setType(type);
+  }
+
+  XAnyEvent event;
+
+  public XAnyEvent getXAnyEvent()
+  {
+    return event;
+  }
+
+  public String toString()
+  {
+    if (event == null)
+      return super.toString();
+    return event.toString();
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/XException.java b/libjava/gnu/gcj/xlib/XException.java
new file mode 100644 (file)
index 0000000..73b10a1
--- /dev/null
@@ -0,0 +1,27 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+/**
+ * Runtime exception that occured during an Xlib opertation. 
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XException extends RuntimeException
+{  
+  public XException() {}
+  public XException(String msg) { super(msg); }
+  
+  public XException(Display display, int status)
+  {
+    super(toString(display, status));
+  }
+  
+  static native String toString(Display display, int status);
+}
diff --git a/libjava/gnu/gcj/xlib/XExposeEvent.java b/libjava/gnu/gcj/xlib/XExposeEvent.java
new file mode 100644 (file)
index 0000000..2c29cf1
--- /dev/null
@@ -0,0 +1,33 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import java.awt.Rectangle;
+
+/**
+ * Interprets data from an Xlib XExposeEvent.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XExposeEvent extends XEvent
+{
+  public XExposeEvent(XAnyEvent event)
+  {
+    super(event);
+
+    // FIXME: Avoid double checking?
+    if (event.getType() != XAnyEvent.TYPE_EXPOSE)
+      throw new IllegalArgumentException("Wrong event type");
+  }
+
+  public native Rectangle getBounds();
+}
+
+
+
diff --git a/libjava/gnu/gcj/xlib/XID.java b/libjava/gnu/gcj/xlib/XID.java
new file mode 100644 (file)
index 0000000..f7bb9cf
--- /dev/null
@@ -0,0 +1,58 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+/**
+ * Common base class for all resources that are stored on the server
+ * and refered to on the client side using XIDs.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XID
+{
+  public XID(Display display, int xid)
+  {
+    this.display = display;
+    this.xid = xid;
+  }
+
+  public final int getXID()
+  {
+    return xid;
+  }
+
+  public final Display getDisplay()
+  {
+    return display;
+  }
+
+  protected Display display;
+  protected int xid;
+
+  private Object clientData;
+  public final Object getClientData()
+  {
+    return clientData;
+  }
+  public final void setClientData(Object clientData)
+  {
+    this.clientData = clientData;
+  }
+
+  protected String params()
+  {
+    return "display=" + display + ",xid=" + Integer.toHexString(xid);
+  }
+  
+  public String toString()
+  {
+    return getClass().getName() +
+      "[" + params() + "]";
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/XImage.java b/libjava/gnu/gcj/xlib/XImage.java
new file mode 100644 (file)
index 0000000..25a8005
--- /dev/null
@@ -0,0 +1,226 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+import gnu.gcj.RawData;
+
+/** 
+ * Structure containing image data that resides on the client side.
+ * The format, depth and offset attributes of an XImage determines how
+ * bitfields are encoded in a raster image. However, it does not
+ * determine how a color is encoded into a bitfield. I.e. the XImage
+ * pixel values in a specific structure, but does not determine what
+ * colors that will be used to represent these pixel values on the
+ * screen.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XImage
+{
+  /** This object reference points to the data, hindering garbage
+      collection of the data. */
+  Object dataRef;
+
+  // Must match definitions in X.h:
+  public static final int XYBITMAP_FORMAT = 0,
+                          XYPIXMAP_FORMAT = 1,
+                          ZPIXMAP_FORMAT  = 2;
+  
+  // Must match definitions in X.h:
+  public static final int LEAST_SIGNIFICANT_B_FIRST_ORDER  = 0,
+                          MOST_SIGNIFICANT_B_FIRST_ORDER   = 1;
+  
+  public XImage(Visual visual, int depth, int format, int xoffset,
+               int width, int height, int bitmapPad,
+               int bytesPerLine)
+  {
+    this(visual, depth, format, xoffset, width, height, bitmapPad,
+        bytesPerLine,
+        0 // bitsPerPixel
+        );
+  }
+
+  public XImage(Visual visual, int depth, int format, int xoffset,
+               int width, int height, int bitmapPad,
+               int bytesPerLine, int bitsPerPixel)
+  {
+    if (visual == null) throw new 
+      NullPointerException("a visual must be specified");
+       
+    init(visual, depth, format, xoffset, width, height,
+        bitmapPad, bytesPerLine, bitsPerPixel);
+  }
+
+  public native void init(Visual visual, int depth, int format, int xoffset,
+                         int width, int height, int bitmapPad,
+                         int bytesPerLine, int bitsPerPixel);
+  
+  private native void init(Visual visual, int width, int height);
+
+    
+  public XImage(Visual visual, int width, int height)
+  {
+    this(visual, width, height,
+        true // Automatically allocate memory
+        );
+  }
+
+  /** 
+   * Create a new XImage.
+   *
+   * @param allocate specifies whether to automatically allocate
+   * memory for the image.  It is possible to create the data array
+   * elsewhere, so that we can for instance use a DataBufferUShort as
+   * data.  Ie. not limit ourself to byte arrays.  This is done by
+   * passing false and calling a setData() method manually after
+   * creation.
+   */
+  public XImage(Visual visual, int width, int height, boolean allocate)
+  {
+    if (visual == null)
+      throw new NullPointerException("a visual must be specified");
+    
+    init(visual, width, height);
+
+    if (allocate)
+      {
+       /* Now that Xlib has figured out the appropriate bytes per
+          line, we can allocate memory for the image.  */
+       // FIXME: What about formats with several layers/bands?
+       byte[] data = new byte[getBytesPerLine()*height];
+
+       setData(data, 0);
+      }
+  }
+
+  /**
+   * Attach image data to this XImage.
+   *
+   * @param offset the index of the first actual data element in the array.
+   */
+  public void setData(byte[] data, int offset)
+  {
+    dataRef = data;
+    internalSetData(data, offset);
+  }
+
+  /**
+   * Attach image data to this XImage. 
+   *
+   * @param offset the index of the first actual data element in the
+   *  array.  Note: this is short offset, not a byte offset.
+   */
+  public void setData(short[] data, int offset)
+  {
+    dataRef = data;
+    internalSetData(data, offset);
+  }
+
+  /**
+   * Attach image data to this XImage
+   * 
+   * @param offset the index of the first actual data element in the array.
+   * Note: this is not a byte offset.
+   */
+  public void setData(int[] data, int offset)
+  {
+    dataRef = data;
+    internalSetData(data, offset);
+  }
+  
+  private native void internalSetData(byte[] data, int offset);
+  private native void internalSetData(short[] data, int offset);
+  private native void internalSetData(int[] data, int offset);
+    
+  protected native void finalize();
+
+  boolean ownsData = false;
+  RawData structure = 0;
+
+  public final native int getWidth();
+  public final native int getHeight();
+  public final native int getDepth();
+  public final native int getFormat();
+
+  public final boolean isZPixmapFormat()
+  {
+    return getFormat() == ZPIXMAP_FORMAT;
+  } 
+
+
+  /** 
+   * Get the xoffset. The xoffset avoids the need of shifting the
+   * scanlines into place.
+   */
+  public final native int getXOffset();
+
+  public native final int getBytesPerLine();
+  public native final int getBitsPerPixel();
+
+  public native final int getImageByteOrder();
+  public native final int getBitmapBitOrder();
+  public native final int getBitmapUnit();
+  public native final int getBitmapPad();
+
+
+  // True/Direct Color specific:
+  public native int getRedMask();
+  public native int getGreenMask();
+  public native int getBlueMask();
+
+
+  /**
+   * Set a pixel value at a given position in the image. This method
+   * is slow. Don't use it, except as a fall-back.
+   */
+  public native final void setPixel(int x, int y, int pixel);
+
+  public String toString()
+  {
+    String format;
+    switch(getFormat())
+      {
+      case ZPIXMAP_FORMAT:
+       format = "ZPixmapFormat";
+      }
+    
+    String imageByteOrder;
+    switch(getImageByteOrder())
+      {
+      case LEAST_SIGNIFICANT_B_FIRST_ORDER:
+       imageByteOrder = "leastSignificantByteFirst";
+       break;
+      case MOST_SIGNIFICANT_B_FIRST_ORDER:
+       imageByteOrder = "mostSignificantByteFirst";
+      }
+    
+    String bitmapBitOrder;
+    switch(getBitmapBitOrder())
+      {
+      case LEAST_SIGNIFICANT_B_FIRST_ORDER:
+       bitmapBitOrder = "leastSignificantBitFirst";
+       break;
+      case MOST_SIGNIFICANT_B_FIRST_ORDER:
+       bitmapBitOrder = "mostSignificantBitFirst";
+      }
+    
+    return getClass().getName() + "[" + format +
+      ", width=" + getWidth() +
+      ", height=" + getHeight() +
+      ", bytesPerLine=" + getBytesPerLine() +
+      ", xoffset=" + getXOffset() +
+      ", depth=" + getDepth() +
+      ", bitsPerPixel=" + getBitsPerPixel() +
+      ", bitmapUnit=" + getBitmapUnit() +
+      ", bitmapPad=" + getBitmapPad() +
+      ", byteOrder=" + imageByteOrder +
+      ", bitOrder=" + bitmapBitOrder +
+      "]";
+  }
+}
diff --git a/libjava/gnu/gcj/xlib/XUnmapEvent.java b/libjava/gnu/gcj/xlib/XUnmapEvent.java
new file mode 100644 (file)
index 0000000..803bdba
--- /dev/null
@@ -0,0 +1,33 @@
+/* Copyright (C) 2000  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.  */
+
+package gnu.gcj.xlib;
+
+/**
+ * Interprets data from an Xlib XUnmapEvent.
+ *
+ * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ */
+public class XUnmapEvent extends XEvent
+{
+  public XUnmapEvent(Display display, Window eventWindow,
+                    Window unmappedWindow,
+                    boolean fromConfigure)
+  {
+    super(XAnyEvent.TYPE_UNMAP_NOTIFY, display);
+    getXAnyEvent().setWindow(eventWindow);
+    setUnmappedWindow(unmappedWindow);
+    setFromConfigure(fromConfigure);
+  }
+
+  public native void setUnmappedWindow(Window unmappedWindow);
+  public native void setFromConfigure(boolean fromConfigure);
+}
+
+
+
diff --git a/libjava/gnu/gcj/xlib/natClip.cc b/libjava/gnu/gcj/xlib/natClip.cc
new file mode 100644 (file)
index 0000000..51426c8
--- /dev/null
@@ -0,0 +1,52 @@
+/* Copyright (C) 2000  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.  */
+
+// Needed to avoid linking in libstdc++
+#ifndef __STL_USE_EXCEPTIONS
+#   include <java/lang/OutOfMemoryError.h>
+#   define __THROW_BAD_ALLOC throw new java::lang::OutOfMemoryError()
+#endif 
+
+#include <vector>
+
+#include <X11/Xlib.h>
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+#include <java/awt/Rectangle.h>
+
+#include "gnu/gcj/xlib/Clip.h"
+
+typedef java::awt::Rectangle AWTRect;
+typedef JArray<AWTRect*> AWTRectArray;
+typedef std::vector<XRectangle> XRectVector;
+
+void gnu::gcj::xlib::Clip::init(AWTRectArray* rectangles)
+{
+  // Prepare rectangles:
+  
+  int numRect = JvGetArrayLength(rectangles);
+  XRectVector* xrectvector = new XRectVector(numRect);
+  
+  for (int i=0; i<numRect; i++)
+    {
+      AWTRect* awtrect = elements(rectangles)[i];
+      XRectangle& xrect = (*xrectvector)[i];
+      
+      xrect.x      = awtrect->x;
+      xrect.y      = awtrect->y;
+      xrect.width  = awtrect->width;
+      xrect.height = awtrect->height;
+    }
+
+  xrects = reinterpret_cast<gnu::gcj::RawData*>(xrectvector);
+}
+
+void gnu::gcj::xlib::Clip::finalize()
+{
+  delete xrects; xrects = 0;
+}
diff --git a/libjava/gnu/gcj/xlib/natColormap.cc b/libjava/gnu/gcj/xlib/natColormap.cc
new file mode 100644 (file)
index 0000000..83c897e
--- /dev/null
@@ -0,0 +1,147 @@
+/* Copyright (C) 2000  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.  */
+
+// Needed to avoid linking in libstdc++
+#ifndef __STL_USE_EXCEPTIONS
+#   include <java/lang/OutOfMemoryError.h>
+#   define __THROW_BAD_ALLOC throw new java::lang::OutOfMemoryError()
+#endif
+
+#include <vector>
+
+#include <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <java/lang/RuntimeException.h>
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Screen.h>
+#include <gnu/gcj/xlib/Colormap.h>
+#include <gnu/gcj/xlib/XColor.h>
+#include <gnu/gcj/RawData.h>
+
+jlong gnu::gcj::xlib::Colormap::allocateColorPixel(XColor* color)
+{
+  ::Display* dpy = (::Display*) (screen->getDisplay()->display);
+  ::XColor* col = (::XColor*) (color->structure);
+  Status result = XAllocColor(dpy, xid, col);
+  if (result == 0)
+    throw new java::lang::RuntimeException(
+      JvNewStringLatin1("Unable to allocate color pixel."));
+
+  return col->pixel;
+}
+
+typedef JArray<gnu::gcj::xlib::XColor*>* xcolorarray;
+
+xcolorarray gnu::gcj::xlib::Colormap::getSharedColors()
+{
+  ::Display* dpy = (::Display*) (screen->getDisplay()->display);
+  unsigned int nCells = CellsOfScreen(ScreenOfDisplay(dpy, screen->screenNumber));
+
+  typedef ::XColor xcolor;
+  std::vector<xcolor> colors(nCells);
+  for (unsigned int i=0; i<nCells; i++)
+    colors[i].pixel = i;
+  ::XColor* cols = colors.get_allocator().address(colors.front());
+  XQueryColors(dpy, xid, cols,
+              nCells);
+
+  int nShared = 0;
+  for (unsigned int i=0; i<nCells; i++)
+    {
+      ::XColor color = colors[i];
+
+      if (!XAllocColor(dpy, xid, &color))
+       continue;
+
+      /* FIXME: In some cases this algorithm may identify a free
+        color cell as a shared one. */
+      if (color.pixel != i)
+       {
+         // Oops, the color wasn't shared. Free it.
+         XFreeColors(dpy, xid, &(color.pixel), 1, 0);
+         colors[i].flags = FLAG_NOT_SHARED;
+         continue;
+       }
+      
+      // FIXME: Shared or free?
+      
+      nShared++;
+      colors[i].flags = FLAG_SHARED;
+    }
+  
+  JArray<XColor*>* shared = newXColorArray(nShared);
+  int si=0;
+  for (unsigned int i=0; i<nCells; i++)
+    {
+      if (colors[i].flags != FLAG_SHARED)
+       continue;
+      
+      XColor* col = elements(shared)[si++];
+      gnu::gcj::RawData* colorData = col->structure;
+      ::XColor* colStruct = reinterpret_cast<xcolor*>(colorData);
+      *colStruct = colors[i];
+    }
+
+  return shared;
+}
+
+xcolorarray gnu::gcj::xlib::Colormap::getXColors()
+{
+  ::Display* dpy = (::Display*) (screen->getDisplay()->display);
+  unsigned int nCells =
+    CellsOfScreen(ScreenOfDisplay(dpy, screen->screenNumber));
+  
+  typedef ::XColor xcolor;
+  std::vector<xcolor> colors(nCells);
+  
+  JArray<XColor*>* colArray = newXColorArray(nCells);
+  
+  for (unsigned int i=0; i<nCells; i++)
+    colors[i].pixel = i;
+  
+  XQueryColors(dpy, xid, &(colors.front()), nCells);
+
+  /* TODO: The current problem with this code is that it relies on
+     (color.pixel == i) as an indicator that the color is
+     shared. However, (color.pixel == i), may also occur simply
+     because color cell i simply was the next free in the list of
+     unallocated color cells.  IDEA: run through the list both
+     backwards and forwards, and only pick out the colorcells that
+     have been identified as shared during both passes.  Reversing the
+     traversal direction might prevent i from corresponding to the
+     next free colorcell, atleast in one of the passes. */
+  for (unsigned int i=0; i<nCells; i++)
+    {
+      ::XColor color = colors[i];
+      
+      char flag = FLAG_NOT_SHARED;
+      if (XAllocColor(dpy, xid, &color))
+       {
+         if (color.pixel == i)
+           {
+             flag = FLAG_SHARED;
+           }
+         else
+           {
+             // Oops, the color wasn't shared. Free it.
+             XFreeColors(dpy, xid, &(color.pixel), 1, 0);
+           }
+       }
+      
+      // Copy color data into object in array
+      XColor* col = elements(colArray)[i];
+      gnu::gcj::RawData* colorData = col->structure;
+      ::XColor* colStruct = reinterpret_cast<xcolor*>(colorData);
+      *colStruct = colors[i];
+      colStruct->flags = flag;
+    }
+  
+  return colArray;
+}
+
diff --git a/libjava/gnu/gcj/xlib/natDisplay.cc b/libjava/gnu/gcj/xlib/natDisplay.cc
new file mode 100644 (file)
index 0000000..fadf4fb
--- /dev/null
@@ -0,0 +1,132 @@
+/* Copyright (C) 1999, 2000  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 <X11/Xproto.h>
+#include <X11/Xlib.h>
+#include <stdio.h>
+
+#include <java/lang/System.h>
+#include <java/lang/RuntimeException.h>
+#include <java/io/PrintStream.h>
+#include <gcj/cni.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/XConnectException.h>
+#include <gnu/gcj/xlib/XException.h>
+
+void gnu::gcj::xlib::Display::init()
+{
+  ::Display* openedDisplay = XOpenDisplay(0); // default display
+  
+  if (openedDisplay == 0) {
+    jstring msg = JvNewStringLatin1("Unable to open display");
+    throw new gnu::gcj::xlib::XConnectException(msg);
+  }
+  
+  display = reinterpret_cast<gnu::gcj::RawData*>(openedDisplay); 
+}
+
+void gnu::gcj::xlib::Display::finalize()
+{
+  if (display == 0) return;
+  ::Display* dpy = (::Display*) display;
+  XCloseDisplay(dpy);
+}
+
+jint gnu::gcj::xlib::Display::getDefaultScreenNumber()
+{
+  ::Display* dpy = (::Display*) display;
+  return DefaultScreen(dpy);
+}
+
+jint gnu::gcj::xlib::Display::getDefaultRootWindowXID()
+{
+  ::Display* dpy = (::Display*) display;
+  return DefaultRootWindow(dpy);
+}
+
+jint gnu::gcj::xlib::Display::internAtom(jstring name)
+{
+  ::Display* dpy = (::Display*) display;
+  int len = JvGetStringUTFLength(name);
+  char cName[len+1];
+  JvGetStringUTFRegion(name, 0, name->length(), cName);
+  cName[len] = '\0';
+  bool onlyIfExists = false;
+  return XInternAtom(dpy, cName, onlyIfExists);
+}
+
+jstring gnu::gcj::xlib::Display::getAtomName(jint atom)
+{
+  ::Display* dpy = (::Display*) display;
+  char* cName = XGetAtomName(dpy, atom);
+  jstring name = JvNewStringLatin1(cName);
+  XFree(cName);
+  return name;
+}
+
+static int handleXError(Display* dpy, XErrorEvent* xee)
+{
+  const int ERROR_TEXT_LENGTH = 256;
+  char errorText[ERROR_TEXT_LENGTH];
+  XGetErrorText(dpy, xee->error_code, errorText, ERROR_TEXT_LENGTH);
+  int requestCode = xee->request_code;
+  
+  if (requestCode == X_GetImage)
+    {
+      /* The current implementation of Drawable.copyIntoXImage()
+        will generate harmless X_GetImage errors if the initially
+        requested area is not completly within the drawable. Until
+        we find a better solution, simply ignore these errors. */
+      return 0;
+    }
+
+  java::lang::System::err->print(JvNewStringLatin1("X error: "));
+  java::lang::System::err->print(JvNewStringLatin1(errorText));
+  java::lang::System::err->print(JvNewStringLatin1(", serial="));
+  java::lang::System::err->print((jlong) xee->serial);
+  java::lang::System::err->print(JvNewStringLatin1(", requestCode="));
+  java::lang::System::err->print((jint) requestCode);
+  
+  if (requestCode < 128)
+    {
+      char number[8];
+      snprintf(number, 8, "%d", requestCode);
+      number[7] = '\0';
+
+      XGetErrorDatabaseText(dpy, "XRequest", number,
+                           "", errorText, ERROR_TEXT_LENGTH);
+      java::lang::System::err->print(JvNewStringLatin1(" ("));
+      java::lang::System::err->print(JvNewStringLatin1(errorText));
+      java::lang::System::err->print(JvNewStringLatin1(")"));
+    }
+
+  java::lang::System::err->print(JvNewStringLatin1(", minorCode="));
+  java::lang::System::err->print((jint) xee->minor_code);
+  java::lang::System::err->print(JvNewStringLatin1(", XID="));
+  java::lang::System::err->println((jlong) xee->resourceid);
+  
+  return 0;
+}
+
+void gnu::gcj::xlib::Display::staticInit()
+{
+  if (XInitThreads() == 0)
+    {
+      char msg[] = "threads is not supported on this platform";
+      throw new java::lang::RuntimeException(JvNewStringLatin1(msg));
+    }
+  
+  XSetErrorHandler(&handleXError);
+}
+
+void gnu::gcj::xlib::Display::flush() 
+{
+  ::Display* dpy = (::Display*) display;
+  XFlush(dpy);
+}
diff --git a/libjava/gnu/gcj/xlib/natDrawable.cc b/libjava/gnu/gcj/xlib/natDrawable.cc
new file mode 100644 (file)
index 0000000..c6e253a
--- /dev/null
@@ -0,0 +1,79 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <gnu/gcj/xlib/XException.h>
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Drawable.h>
+#include <gnu/gcj/xlib/XImage.h>
+
+#include <java/awt/Rectangle.h>
+
+jboolean gnu::gcj::xlib::Drawable::copyIntoXImageImpl(XImage* image,
+                                                     jint x, jint y,
+                                                     jint width, jint height,
+                                                     jint destX, jint destY)
+{
+  ::Display* dpy = (::Display*) (getDisplay()->display);
+  ::XImage* ximage = (::XImage*) image->structure;
+  int format = image->getFormat();
+  int xid = getXID();
+
+  ::XImage* result = XGetSubImage(dpy, xid,
+                                 x, y, width, height,
+                                 ~0, // plane mask
+                                 format,
+                                 ximage,
+                                 destX, destY);
+  if (result == 0)
+    return false;
+    
+  if (result != ximage)
+    throw new XException(MSG_XGETSUBIMAGE_FAILED);
+
+  return true;
+}
+
+java::awt::Rectangle*
+gnu::gcj::xlib::Drawable::getBounds(java::awt::Rectangle* rv)
+{
+  ::Display* dpy = (::Display*) (getDisplay()->display);
+
+  ::Window root;
+  int x, y;
+  unsigned int w, h, bw, depth;
+
+  Status status = XGetGeometry(dpy, getXID(), &root,
+                              &x, &y, &w, &h,
+                              &bw, &depth);
+  
+  switch (status)
+    {
+    case BadDrawable:
+      JvThrow(new XException(display, status));
+    default:
+      ; // All OK, NOP.
+    }
+  if (rv == 0)
+    {
+      rv = new java::awt::Rectangle(x, y, w, h);
+    }
+  else
+    {
+      rv->x = x;
+      rv->y = y;
+      rv->width = w;
+      rv->height = h;
+    }
+  return rv;
+}
diff --git a/libjava/gnu/gcj/xlib/natFont.cc b/libjava/gnu/gcj/xlib/natFont.cc
new file mode 100644 (file)
index 0000000..7e6b3f7
--- /dev/null
@@ -0,0 +1,95 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+#include <java/lang/String.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Font.h>
+#include <gnu/gcj/xlib/XException.h>
+
+gnu::gcj::RawData* gnu::gcj::xlib::Font::loadFont(Display* display,
+                                                 jstring lfdNamePattern)
+{
+  ::Display* dpy = (::Display*) display->display;
+  int len = JvGetStringUTFLength(lfdNamePattern);
+  char cName[len+1];
+  JvGetStringUTFRegion(lfdNamePattern, 0, lfdNamePattern->length(),
+                      cName);
+  cName[len] = '\0';
+
+  XFontStruct* fontStruct = XLoadQueryFont(dpy, cName);
+  if (fontStruct == 0)
+    {
+      JvThrow(new XException(JvNewStringLatin1("font not found")));
+    }
+
+  return reinterpret_cast<gnu::gcj::RawData*>(fontStruct);
+}
+
+jint gnu::gcj::xlib::Font::getXIDFromStruct(gnu::gcj::RawData* structure)
+{
+  XFontStruct* fontStruct = (XFontStruct*) structure;
+  return fontStruct->fid;
+}
+
+jint gnu::gcj::xlib::Font::getMaxAscent()
+{
+  XFontStruct* fontStruct = (XFontStruct*) structure;
+  return fontStruct->max_bounds.ascent;
+}
+
+jint gnu::gcj::xlib::Font::getMaxDescent()
+{
+  XFontStruct* fontStruct = (XFontStruct*) structure;
+  return fontStruct->max_bounds.descent;
+}
+
+jint gnu::gcj::xlib::Font::getAscent()
+{
+  XFontStruct* fontStruct = (XFontStruct*) structure;
+  return fontStruct->ascent;
+}
+
+jint gnu::gcj::xlib::Font::getDescent()
+{
+  XFontStruct* fontStruct = (XFontStruct*) structure;
+  return fontStruct->ascent;
+}
+
+jint gnu::gcj::xlib::Font::getStringWidth(java::lang::String* text)
+{
+  XFontStruct* fontStruct = (XFontStruct*) structure;
+  
+  // FIXME: make proper unicode conversion
+  int len = JvGetStringUTFLength(text);
+  char ctxt[len+1];
+  JvGetStringUTFRegion(text, 0, text->length(), ctxt);
+  ctxt[len] = '\0';
+  int width = XTextWidth(fontStruct, ctxt, len);
+  return width;
+}
+
+void gnu::gcj::xlib::Font::finalize()
+{
+  if (structure != 0)
+    {
+      ::Display* dpy = (::Display*) display->display;
+      XFontStruct* fontStruct = (XFontStruct*) structure;
+      int result = XFreeFont(dpy, fontStruct);
+
+      if (result == BadFont) 
+       throw new XException(display, result);
+      
+      structure = 0; xid = 0;
+    }
+}
+
diff --git a/libjava/gnu/gcj/xlib/natGC.cc b/libjava/gnu/gcj/xlib/natGC.cc
new file mode 100644 (file)
index 0000000..66de35f
--- /dev/null
@@ -0,0 +1,207 @@
+/* Copyright (C) 2000  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 <vector>
+
+#include <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+#include <java/lang/String.h>
+#include <java/awt/Rectangle.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/XID.h>
+#include <gnu/gcj/xlib/Drawable.h>
+#include <gnu/gcj/xlib/Font.h>
+#include <gnu/gcj/xlib/XImage.h>
+#include <gnu/gcj/xlib/XException.h>
+#include <gnu/gcj/xlib/Clip.h>
+#include <gnu/gcj/xlib/GC.h>
+#include <gnu/gcj/xlib/XException.h>
+
+typedef java::awt::Rectangle AWTRect;
+typedef JArray<AWTRect*> AWTRectArray;
+typedef std::vector<XRectangle> XRectVector;
+
+void gnu::gcj::xlib::GC::initStructure(GC* copyFrom)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::Drawable drawableXID = target->getXID();
+    
+  ::GC gc = XCreateGC(dpy, drawableXID, 0, 0);
+  
+  if (gc == 0) 
+    throw new XException(JvNewStringLatin1("GC creation failed"));
+
+  if (copyFrom != 0)
+    {
+      ::GC fromGC = (::GC) copyFrom->structure;
+      XCopyGC(dpy, fromGC, ~0, gc);
+      // no fast fail
+    }
+
+  structure = reinterpret_cast<gnu::gcj::RawData*>(gc);
+}
+
+void gnu::gcj::xlib::GC::disposeImpl()
+{
+  gnu::gcj::RawData* lStructure = structure;
+  Drawable* lTargetType = target;
+
+  if ((lStructure == 0) || (lTargetType == 0))
+    return;
+    
+  structure = 0;
+  target = 0;
+       
+  Display* display = lTargetType->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::GC gc = (::GC) lStructure;
+       
+  XFreeGC(dpy, gc);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::setForeground(jlong pixel)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::GC gc = (::GC) structure;
+  XSetForeground(dpy, gc, pixel);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::setFont(Font* font)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::GC gc = (::GC) structure;
+  XSetFont(dpy, gc, font->getXID());
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::drawString(jstring text, jint x, jint y)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::Drawable drawableXID = target->getXID();
+  ::GC gc = (::GC) structure;
+  
+  /*
+    FIXME: do something along the lines of the following instead:
+
+    jint length = text->length();
+    jchar* txt = JvGetStringChars(text);
+
+    XChar2b xwchars[length];
+    
+    // FIXME: Add convertion and caching
+
+    for (int i=0; i<length; i++)
+      {
+       XChar2b* xc = &(xwchars[i]);
+       jchar jc = txt[i];
+       xc->byte1 = jc & 0xff;
+       xc->byte2 = jc >> 8;
+      }
+
+     XDrawString16(dpy, drawableXID, gc, x, y, xwchars, length);
+    */
+  
+  // FIXME, temporary code:
+  int len = JvGetStringUTFLength(text);
+  char ctxt[len+1];
+  JvGetStringUTFRegion(text, 0, text->length(), ctxt);
+  ctxt[len] = '\0';
+  XDrawString(dpy, drawableXID, gc, x, y, ctxt, len);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::drawLine(jint x1, jint y1, jint x2, jint y2)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::Drawable drawableXID = target->getXID();
+  ::GC gc = (::GC) structure;
+  XDrawLine(dpy, drawableXID, gc, x1, y1, x2, y2);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::drawRectangle(jint x, jint y, jint w, jint h)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::Drawable drawableXID = target->getXID();
+  ::GC gc = (::GC) structure;
+  XDrawRectangle(dpy, drawableXID, gc, x, y, w, h);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::fillRectangle(jint x, jint y, jint w, jint h)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::Drawable drawableXID = target->getXID();
+  ::GC gc = (::GC) structure;
+  XFillRectangle(dpy, drawableXID, gc, x, y, w, h);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::clearArea(jint x, jint y, jint w, jint h,
+                                  jboolean exposures)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::Drawable drawableXID = target->getXID();
+  
+  XClearArea(dpy, drawableXID, x, y, w, h,
+            exposures ? True : False);
+  // no fast fail
+}
+
+
+void gnu::gcj::xlib::GC::putImage(XImage* image,
+                                 jint srcX, jint srcY,
+                                 jint destX, jint destY,
+                                 jint width, jint height)
+{
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::Drawable drawableXID = target->getXID();
+  ::GC gc = (::GC) structure;
+  ::XImage* ximage = (::XImage*) (image->structure);
+  
+  XPutImage(dpy, drawableXID, gc, ximage,
+           srcX, srcY,
+           destX, destY,
+           width, height);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::GC::updateClip()
+{
+  if (clip == 0)
+    return;
+  
+  Display* display = target->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  ::GC gc = (::GC) structure;
+  
+  XRectVector* xrectvector = (XRectVector*) (clip->xrects);
+  int numRect = xrectvector->size();
+  
+  int originX = 0;
+  int originY = 0;
+  int ordering = Unsorted;
+  XSetClipRectangles(dpy, gc, originX, originY,
+                    &(xrectvector->front()), numRect,
+                    ordering);
+  // no fast fail
+}
diff --git a/libjava/gnu/gcj/xlib/natPixmap.cc b/libjava/gnu/gcj/xlib/natPixmap.cc
new file mode 100644 (file)
index 0000000..459f5bf
--- /dev/null
@@ -0,0 +1,39 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <java/lang/OutOfMemoryError.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Screen.h>
+#include <gnu/gcj/xlib/Visual.h>
+#include <gnu/gcj/xlib/Drawable.h>
+#include <gnu/gcj/xlib/XImage.h>
+#include <gnu/gcj/xlib/Pixmap.h>
+
+jint gnu::gcj::xlib::Pixmap::createXID(Drawable* drawable,
+                                      jint width, jint height,
+                                      jint depth)
+{
+  Display* display = drawable->getDisplay();
+  ::Display* dpy = (::Display*) (display->display);
+  jint xid = drawable->getXID();
+  
+  return XCreatePixmap(dpy, xid, width, height, depth);
+}
+
+void gnu::gcj::xlib::Pixmap::finalize()
+{
+  ::Display* dpy = (::Display*) (getDisplay()->display);
+  XFreePixmap(dpy, getXID());
+}
diff --git a/libjava/gnu/gcj/xlib/natScreen.cc b/libjava/gnu/gcj/xlib/natScreen.cc
new file mode 100644 (file)
index 0000000..9459c1f
--- /dev/null
@@ -0,0 +1,53 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Screen.h>
+
+void gnu::gcj::xlib::Screen::initStructure()
+{
+  ::Display* dpy = (::Display*) (display->display);
+  ::Screen* screen = ScreenOfDisplay(dpy, screenNumber);
+  
+  structure = reinterpret_cast<gnu::gcj::RawData*>(screen);
+}
+
+
+jint gnu::gcj::xlib::Screen::getRootDepth()
+{
+  ::Screen* screen = (::Screen*) structure;
+  return screen->root_depth;
+}
+
+jint gnu::gcj::xlib::Screen::getRootWindowXID()
+{
+  ::Screen* screen = (::Screen*) structure;
+  return RootWindowOfScreen(screen);
+}
+
+jint gnu::gcj::xlib::Screen::getDefaultColormapXID()
+{
+  ::Screen* screen = (::Screen*) structure;
+  return DefaultColormapOfScreen(screen);
+}
+
+jint gnu::gcj::xlib::Screen::findScreenNumber()
+{
+  ::Screen* screen = (::Screen*) structure;
+  return XScreenNumberOfScreen(screen);
+}
+
+gnu::gcj::RawData* gnu::gcj::xlib::Screen::getRootVisualStructure()
+{
+  ::Screen* screen = (::Screen*) structure;
+  ::Visual* visual = DefaultVisualOfScreen(screen);
+  return reinterpret_cast<gnu::gcj::RawData*>(visual);
+}
diff --git a/libjava/gnu/gcj/xlib/natVisual.cc b/libjava/gnu/gcj/xlib/natVisual.cc
new file mode 100644 (file)
index 0000000..56e03b5
--- /dev/null
@@ -0,0 +1,146 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/xlib/Visual.h>
+#include <gnu/gcj/xlib/Screen.h>
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/XException.h>
+#include <gnu/gcj/RawData.h>
+
+using namespace gnu::gcj;
+
+void gnu::gcj::xlib::Visual::init(RawData* visual, jint depth)
+{
+  XVisualInfo* info = new XVisualInfo;
+  xVisualInfo = reinterpret_cast<gnu::gcj::RawData*>(info);
+  infoMask = 0;
+    
+  if (visual != 0)
+    {
+      ::Visual* visualStructure = (::Visual*) visual;
+      info->visual = visualStructure;
+      info->visualid = XVisualIDFromVisual(visualStructure);
+      infoMask |= MASK_ID | MASK_VISUAL_STRUCTURE;
+    }
+
+  if (depth  != 0)
+    {
+      info->depth = depth;
+      infoMask |= MASK_DEPTH;
+    }
+}
+
+void gnu::gcj::xlib::Visual::finalize()
+{
+  if (xVisualInfo != 0)
+    {
+      delete xVisualInfo;
+      xVisualInfo = 0;
+    }
+}
+
+RawData* gnu::gcj::xlib::Visual::getVisualStructure()
+{
+    ensureXVisualInfo(MASK_ALL); // Make sure structure is set
+    XVisualInfo* info = (XVisualInfo*) xVisualInfo;
+    return reinterpret_cast<gnu::gcj::RawData*>(info->visual);
+}
+
+jint gnu::gcj::xlib::Visual::getRedMask()
+{
+  ensureXVisualInfo(MASK_RED);
+  XVisualInfo* info = (XVisualInfo*) xVisualInfo;
+  return info->red_mask;
+}
+
+jint gnu::gcj::xlib::Visual::getGreenMask()
+{
+  ensureXVisualInfo(MASK_GREEN);
+  XVisualInfo* info = (XVisualInfo*) xVisualInfo;
+  return info->green_mask;
+}
+
+jint gnu::gcj::xlib::Visual::getBlueMask()
+{
+  ensureXVisualInfo(MASK_BLUE);
+  XVisualInfo* info = (XVisualInfo*) xVisualInfo;
+  return info->blue_mask;
+}
+
+jint gnu::gcj::xlib::Visual::getScreenNumber()
+{
+  if (screen != 0)
+    return screen->getScreenNumber();
+
+  ensureXVisualInfo(MASK_SCREEN);
+  XVisualInfo* info = (XVisualInfo*) xVisualInfo;
+  return info->screen;
+}
+
+jint gnu::gcj::xlib::Visual::getDepth()
+{
+  ensureXVisualInfo(MASK_DEPTH);
+  
+  XVisualInfo* info = (XVisualInfo*) xVisualInfo;
+  return info->depth;
+}
+
+jint gnu::gcj::xlib::Visual::getVisualClass()
+{
+  ensureXVisualInfo(MASK_CLASS);
+  ::XVisualInfo* info = (::XVisualInfo*) xVisualInfo;
+  return info->c_class;
+}
+
+void gnu::gcj::xlib::Visual::ensureXVisualInfo(jint requiredMask)
+{
+  int missingInformation = ~infoMask;
+  if ((missingInformation & requiredMask) == 0)
+    return;
+  
+  // We need more info...
+
+  XVisualInfo* info = (XVisualInfo*) xVisualInfo;
+
+  // Store everything we know into template
+  if (screen != 0)
+    {
+      info->screen = screen->getScreenNumber();
+      infoMask |= MASK_SCREEN;
+    }
+  
+  // Aquire info using the current info as template for matching
+  ::Display* dpy = (::Display*) display->display;
+  int visualInfoCount;
+
+  long mask = infoMask & MASK_ALL & (~MASK_VISUAL_STRUCTURE);
+  XVisualInfo* matches = XGetVisualInfo(dpy, mask,
+                                         info, &visualInfoCount);
+  if (matches != 0)
+    {
+      (*info) = matches[0];
+
+      // redundant?
+      xVisualInfo = reinterpret_cast<gnu::gcj::RawData*>(info);
+
+      infoMask = ~0; // ALL
+      XFree(matches);
+    } 
+  else 
+    {
+      char msg[] = 
+       "XGetVisualInfo failed to find any matching visuals. The template "
+       "describes a combination of properties that does not exist on "
+       "this X server.";
+      throw new XException(JvNewStringLatin1(msg));
+    }
+}
diff --git a/libjava/gnu/gcj/xlib/natWMSizeHints.cc b/libjava/gnu/gcj/xlib/natWMSizeHints.cc
new file mode 100644 (file)
index 0000000..f38ea38
--- /dev/null
@@ -0,0 +1,75 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+#include <java/lang/OutOfMemoryError.h>
+
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/WMSizeHints.h>
+
+void gnu::gcj::xlib::WMSizeHints::init(WMSizeHints* copyFrom)
+{
+  XSizeHints* hints = XAllocSizeHints();
+  if (hints == 0)
+    {
+      jstring errorMessage = JvNewStringLatin1("XAllocSizeHints failed");
+      JvThrow(new java::lang::OutOfMemoryError(errorMessage));
+    }
+
+  if (copyFrom != 0)
+    {
+      XSizeHints* from = (XSizeHints*) copyFrom->structure;
+      (*hints) = (*from);
+    } 
+  else
+    {
+      // Is this necessary?
+      hints->flags = 0;
+    }
+  structure = reinterpret_cast<gnu::gcj::RawData*>(hints);
+}
+
+void gnu::gcj::xlib::WMSizeHints::finalize()
+{
+  delete structure;
+}
+
+void gnu::gcj::xlib::WMSizeHints::applyNormalHints(gnu::gcj::xlib::Window* window)
+{
+  Display* display = window->display;
+  ::Display* dpy = (::Display*) display->display;
+  ::Window win = window->getXID();
+  XSizeHints* hints = (XSizeHints*) structure;
+  
+  XSetWMNormalHints(dpy, win, hints);
+  /* FIXME, alternative?
+     // X11 source reports XSetWMNormalHints() as an old routine. (?)
+     XSetWMSizeHints(dpy, win, hints, display->getAtom("WM_NORMAL_HINTS"));
+  */
+}
+
+void gnu::gcj::xlib::WMSizeHints::setMinSize(jint width, jint height)
+{
+  XSizeHints* hints = (XSizeHints*) structure;
+  hints->min_width = width;
+  hints->min_height = height;
+  hints->flags = hints->flags | PMinSize;
+}
+
+void gnu::gcj::xlib::WMSizeHints::setMaxSize(jint width, jint height)
+{
+  XSizeHints* hints = (XSizeHints*) structure;
+  hints->max_width = width;
+  hints->max_height = height;
+  hints->flags = hints->flags | PMaxSize;
+}
diff --git a/libjava/gnu/gcj/xlib/natWindow.cc b/libjava/gnu/gcj/xlib/natWindow.cc
new file mode 100644 (file)
index 0000000..6600795
--- /dev/null
@@ -0,0 +1,171 @@
+/* Copyright (C) 2000  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.  */
+
+// Needed to avoid linking in libstdc++
+#ifndef __STL_USE_EXCEPTIONS
+#   include <java/lang/OutOfMemoryError.h>
+#   define __THROW_BAD_ALLOC throw new java::lang::OutOfMemoryError()
+#endif
+
+#include <vector>
+
+#include <X11/Xlib.h>
+#include <gcj/cni.h>
+#include <java/awt/Rectangle.h>
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/WindowAttributes.h>
+#include <gnu/gcj/xlib/Visual.h>
+#include <gnu/gcj/xlib/XException.h>
+
+jint gnu::gcj::xlib::Window::createChildXID(java::awt::Rectangle* bounds,
+                                       jint borderWidth,
+                                       WindowAttributes* attributes,
+                                       jint windowIOClass, 
+                                       Visual* visual)
+{
+  ::Window parentXID = xid;
+  
+  int x      = bounds->x;
+  int y      = bounds->y;
+  int width  = bounds->width;
+  int height = bounds->height;
+  
+  long mask = attributes->mask;
+  XSetWindowAttributes* attr = (XSetWindowAttributes*)
+    attributes->getXSetWindowAttributesStructure();
+  
+  ::Visual* vis = CopyFromParent;
+  int depth = CopyFromParent;
+  if (visual != 0)
+    {
+      vis = (::Visual*) visual->getVisualStructure();
+      depth = visual->getDepth();
+    }
+
+  ::Window childXID = XCreateWindow((::Display*) (display->display),
+                                   parentXID,
+                                   x, y, width, height,
+                                   borderWidth, depth, windowIOClass,
+                                   vis,
+                                   mask, attr);
+  // no fast fail
+  return childXID;
+}
+
+void gnu::gcj::xlib::Window::destroy()
+{
+  ::Display* dpy = (::Display*) (display->display);
+  ::Window window = xid;
+  XDestroyWindow(dpy, window);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::Window::setAttributes(WindowAttributes* attributes)
+{
+  ::Display* dpy = (::Display*) (display->display);
+  ::Window window = xid;
+  ::XSetWindowAttributes* attr = (::XSetWindowAttributes*)
+      attributes->getXSetWindowAttributesStructure();
+
+  XChangeWindowAttributes(dpy, window, attributes->mask, attr);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::Window::map()
+{
+  ::Display* dpy = (::Display*) (display->display);
+  ::Window window = xid;
+  XMapWindow(dpy, window);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::Window::unmap()
+{
+  ::Display* dpy = (::Display*) (display->display);
+  ::Window window = xid;
+  XUnmapWindow(dpy, window);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::Window::setProperty(jint nameAtom, jint typeAtom, 
+                                        jbyteArray data)
+{
+  ::Display* dpy = (::Display*) (display->display);
+  int format = 8;
+  int mode = PropModeReplace;
+  unsigned char* pData = (unsigned char*) elements(data);
+  int len = data->length;
+  
+  XChangeProperty(dpy, xid, nameAtom, typeAtom, format, mode,
+                 pData, len);
+  // no fast fail
+}
+
+void gnu::gcj::xlib::Window::setWMProtocols(jintArray atoms)
+{
+  ::Display* dpy = (::Display*) (display->display);
+  
+  size_t length = atoms->length;
+  jint* atomsBegin = elements(atoms);
+  jint* atomsEnd   = atomsBegin + length;
+  
+  // Avoid confusion between Xlib.h and Atom.java "Atom" types.
+  typedef ::Atom XLibAtom;
+  
+  std::vector<XLibAtom> atomVector(atomsBegin, atomsEnd);
+  XLibAtom* atomsArray = &(atomVector.front());
+  
+  XSetWMProtocols(dpy, xid, atomsArray, length);
+  // no fail fast
+}
+
+jintArray gnu::gcj::xlib::Window::getWMProtocols()
+{
+  ::Display* dpy = (::Display*) (display->display);
+  
+  ::Atom* protocolsReturn;
+  int countReturn;
+  
+  Status success = XGetWMProtocols(dpy, xid, &protocolsReturn,
+                                  &countReturn);
+  
+  if (!success)
+    throw new XException(JvNewStringLatin1("cannot get "
+                                          "WM protocols "));
+  
+  jintArray atoms;
+  try
+    {
+      ::Atom* protocolsBegin = protocolsReturn;
+      ::Atom* protocolsEnd = protocolsBegin + countReturn;
+      
+      atoms = JvNewIntArray(countReturn);
+      jint* atomsBegin = elements(atoms);
+      
+      std::copy(protocolsBegin, protocolsEnd, atomsBegin);
+      
+    }
+  catch (...)
+    {
+      XFree(protocolsReturn);
+      throw;
+    }
+  XFree(protocolsReturn);
+  
+  return atoms;
+}
+
+void gnu::gcj::xlib::Window::setBounds(jint x, jint y,
+                                      jint width, jint height)
+{
+  ::Display* dpy = (::Display*) (display->display);
+  
+  XMoveResizeWindow(dpy, xid, x, y, width, height);
+  // no fast fail
+}
diff --git a/libjava/gnu/gcj/xlib/natWindowAttributes.cc b/libjava/gnu/gcj/xlib/natWindowAttributes.cc
new file mode 100644 (file)
index 0000000..5281acb
--- /dev/null
@@ -0,0 +1,109 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/WindowAttributes.h>
+#include <gnu/gcj/xlib/Pixmap.h>
+#include <gnu/gcj/xlib/XException.h>
+#include <gnu/gcj/xlib/Screen.h>
+#include <gnu/gcj/xlib/Visual.h>
+
+
+void gnu::gcj::xlib::WindowAttributes::initFromWindow(Window* from)
+{
+  display = from->getDisplay();
+  ::Display* dpy = (::Display*) display->display;
+  ::Window win = from->getXID();
+  
+  XWindowAttributes* attributesIn  = new XWindowAttributes;
+  in = reinterpret_cast<gnu::gcj::RawData*>(attributesIn);
+
+  Status status = XGetWindowAttributes(dpy, win, attributesIn);
+  if ((status == BadDrawable) | (status == BadWindow))
+    JvThrow(new XException(display, status));
+}
+
+
+void gnu::gcj::xlib::WindowAttributes::init(WindowAttributes* copyFrom)
+{
+  XSetWindowAttributes* attributes = new XSetWindowAttributes;
+
+  if (copyFrom != 0)
+    {
+      XSetWindowAttributes* from = 
+       (XSetWindowAttributes*) copyFrom->out;
+      (*attributes) = (*from);
+    } 
+  
+  out = reinterpret_cast<gnu::gcj::RawData*>(attributes);
+}
+
+void gnu::gcj::xlib::WindowAttributes::finalize()
+{
+  delete in; in = 0;
+  delete out; out = 0;
+}
+
+void gnu::gcj::xlib::WindowAttributes::setBackground(jlong pixel)
+{
+  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
+  
+  attributes->background_pixel = pixel;
+  mask = mask | CWBackPixel;
+}
+
+void gnu::gcj::xlib::WindowAttributes::setBackground(Pixmap* pixmap)
+{
+  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
+
+  attributes->background_pixmap = pixmap->getXID();
+  mask = mask | CWBackPixmap;
+}
+
+void gnu::gcj::xlib::WindowAttributes::setEventMask(jlong eventMask)
+{
+  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
+
+  attributes->event_mask = eventMask;
+  mask = mask | CWEventMask;
+}
+
+gnu::gcj::xlib::Visual* gnu::gcj::xlib::WindowAttributes::getVisual()
+{
+  if (in == 0)
+    return 0;
+
+  XWindowAttributes* attributesIn = (XWindowAttributes*) in;
+
+  gnu::gcj::RawData* screenRef =
+    reinterpret_cast<gnu::gcj::RawData*>(attributesIn->screen);
+
+  Screen* screen = new Screen(display, screenRef);
+
+  gnu::gcj::RawData* visualRef =
+    reinterpret_cast<gnu::gcj::RawData*>(attributesIn->visual);
+
+  return new gnu::gcj::xlib::Visual(visualRef, screen, attributesIn->depth);
+}
+
+
+void gnu::gcj::xlib::WindowAttributes::apply(Window* window)
+{
+  ::Display* dpy = (::Display*) window->getDisplay()->display;
+  ::Window win = window->getXID();
+  XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
+  
+  XChangeWindowAttributes(dpy, win, mask, attributes);
+}
+
diff --git a/libjava/gnu/gcj/xlib/natXAnyEvent.cc b/libjava/gnu/gcj/xlib/natXAnyEvent.cc
new file mode 100644 (file)
index 0000000..439f204
--- /dev/null
@@ -0,0 +1,99 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <java/lang/RuntimeException.h>
+
+#include <java/lang/System.h>
+#include <java/io/PrintStream.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/XAnyEvent.h>
+#include <gnu/gcj/xlib/XExposeEvent.h>
+#include <gnu/gcj/xlib/XException.h>
+
+void gnu::gcj::xlib::XAnyEvent::init()
+{
+  ::XEvent* event = new ::XEvent;
+  structure = reinterpret_cast<gnu::gcj::RawData*>(event);
+}
+
+void gnu::gcj::xlib::XAnyEvent::finalize()
+{
+  delete structure;
+  structure = 0;
+}
+
+void gnu::gcj::xlib::XAnyEvent::loadNext()
+{
+  ::Display* dpy = (::Display*) display->display;
+  ::XEvent* evt = (::XEvent*) structure;
+  XNextEvent(dpy, evt);
+  // What does XNextEvent return?
+}
+
+jint gnu::gcj::xlib::XAnyEvent::getType()
+{
+  ::XEvent* event = (::XEvent*) structure;
+  return event->type;
+}
+
+void gnu::gcj::xlib::XAnyEvent::setType(jint type)
+{
+  ::XEvent* event = (::XEvent*) structure;
+  event->type = type;
+}
+
+gnu::gcj::xlib::Window* gnu::gcj::xlib::XAnyEvent::getWindow()
+{
+  ::XEvent* event = (::XEvent*) structure;
+  return display->getWindow(event->xany.window);
+}
+
+void gnu::gcj::xlib::XAnyEvent::setWindow(gnu::gcj::xlib::Window* window)
+{
+  ::XEvent* event = (::XEvent*) structure;
+  event->xany.window = window->getXID();
+}
+
+jlong gnu::gcj::xlib::XAnyEvent::getSerial()
+{
+  ::XEvent* event = (::XEvent*) structure;
+  return event->xany.serial;
+}
+
+void gnu::gcj::xlib::XAnyEvent::send(gnu::gcj::xlib::Window* destination,
+                                    jboolean propagate, jlong mask)
+{
+  ::Display* dpy = (::Display*) display->display;
+  ::XEvent* event = (::XEvent*) structure;
+
+  Status status = 
+    XSendEvent(dpy, destination->getXID(), propagate ? True : False,
+              mask, event);
+
+  switch (status)
+    {
+    case 0:
+      throw new XException(JvNewStringLatin1("conversion to wire "
+                                            "protocol failed"));
+    case BadWindow:
+    case BadValue:
+      throw new XException(display, status);
+
+    default:
+      /* All other return values indicate success.  Ie. (status ==
+        1) indicates success, not BadRequest. */
+      ; // NOP
+    }
+}
diff --git a/libjava/gnu/gcj/xlib/natXButtonEvent.cc b/libjava/gnu/gcj/xlib/natXButtonEvent.cc
new file mode 100644 (file)
index 0000000..fa02df8
--- /dev/null
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/XAnyEvent.h>
+#include <gnu/gcj/xlib/XEvent.h>
+#include <gnu/gcj/xlib/XButtonEvent.h>
+
+void gnu::gcj::xlib::XButtonEvent::init()
+{
+  ::XButtonEvent* evt = (::XButtonEvent*) event->structure;
+  
+  time = evt->time;
+  x = evt->x;
+  y = evt->y;
+  state = evt->state;
+  button = evt->button;
+}
+
diff --git a/libjava/gnu/gcj/xlib/natXColor.cc b/libjava/gnu/gcj/xlib/natXColor.cc
new file mode 100644 (file)
index 0000000..4e76cf9
--- /dev/null
@@ -0,0 +1,61 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+#include <gnu/gcj/xlib/XColor.h>
+
+void gnu::gcj::xlib::XColor::init()
+{
+  structure = reinterpret_cast<gnu::gcj::RawData*>(new ::XColor);
+}
+
+void gnu::gcj::xlib::XColor::finalize()
+{
+  delete structure;
+}
+
+void gnu::gcj::xlib::XColor::setRGB(jint r, jint g, jint b)
+{
+  ::XColor* color = (::XColor*) structure;
+  color->red   = r;
+  color->green = g;
+  color->blue  = b;
+}
+
+jint gnu::gcj::xlib::XColor::getRed()
+{
+  ::XColor* color = (::XColor*) structure;
+  return color->red;
+}
+
+jint gnu::gcj::xlib::XColor::getGreen()
+{
+  ::XColor* color = (::XColor*) structure;
+  return color->green;
+}
+
+jint gnu::gcj::xlib::XColor::getBlue()
+{
+  ::XColor* color = (::XColor*) structure;
+  return color->blue;
+}
+
+jbyte gnu::gcj::xlib::XColor::getFlags()
+{
+  ::XColor* color = (::XColor*) structure;
+  return color->flags;
+}
+
+jlong gnu::gcj::xlib::XColor::getPixelValue()
+{
+  ::XColor* color = (::XColor*) structure;
+  return color->pixel;
+}
diff --git a/libjava/gnu/gcj/xlib/natXConfigureEvent.cc b/libjava/gnu/gcj/xlib/natXConfigureEvent.cc
new file mode 100644 (file)
index 0000000..a65c0b3
--- /dev/null
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/XAnyEvent.h>
+#include <gnu/gcj/xlib/XEvent.h>
+#include <gnu/gcj/xlib/XConfigureEvent.h>
+#include <java/awt/Rectangle.h>
+
+using java::awt::Rectangle;
+
+java::awt::Rectangle* gnu::gcj::xlib::XConfigureEvent::getBounds()
+{
+  ::XConfigureEvent* evt = (::XConfigureEvent*) event->structure;
+  Rectangle* rectangle = new Rectangle(evt->x, evt->y,
+                                      evt->width, evt->height);
+                                        
+  return rectangle;
+}
+
diff --git a/libjava/gnu/gcj/xlib/natXException.cc b/libjava/gnu/gcj/xlib/natXException.cc
new file mode 100644 (file)
index 0000000..4bf7197
--- /dev/null
@@ -0,0 +1,24 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/XException.h>
+
+jstring gnu::gcj::xlib::XException::toString(Display* display, jint status)
+{
+  ::Display* dpy = (::Display*) (display->display);
+  
+  const int ERROR_TEXT_LENGTH = 256;
+  char errorText[ERROR_TEXT_LENGTH];
+  
+  XGetErrorText(dpy, status, errorText, ERROR_TEXT_LENGTH);
+  return JvNewStringLatin1(errorText);
+}
diff --git a/libjava/gnu/gcj/xlib/natXExposeEvent.cc b/libjava/gnu/gcj/xlib/natXExposeEvent.cc
new file mode 100644 (file)
index 0000000..6dad170
--- /dev/null
@@ -0,0 +1,31 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/XAnyEvent.h>
+#include <gnu/gcj/xlib/XEvent.h>
+#include <gnu/gcj/xlib/XExposeEvent.h>
+#include <java/awt/Rectangle.h>
+
+using java::awt::Rectangle;
+
+java::awt::Rectangle* gnu::gcj::xlib::XExposeEvent::getBounds()
+{
+  ::XExposeEvent* evt = (::XExposeEvent*) event->structure;
+  Rectangle* rectangle = new Rectangle(evt->x, evt->y,
+                                      evt->width, evt->height);
+                                        
+  return rectangle;
+}
+
diff --git a/libjava/gnu/gcj/xlib/natXImage.cc b/libjava/gnu/gcj/xlib/natXImage.cc
new file mode 100644 (file)
index 0000000..a527e8e
--- /dev/null
@@ -0,0 +1,220 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <java/lang/OutOfMemoryError.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Screen.h>
+#include <gnu/gcj/xlib/Visual.h>
+#include <gnu/gcj/xlib/XImage.h>
+#include <java/lang/System.h>
+#include <java/io/PrintStream.h>
+
+void gnu::gcj::xlib::XImage::init(Visual* visual, jint depth,
+                                 jint format, jint xoffset,
+                                 jint width, jint height,
+                                 jint bitmapPad, jint bytesPerLine,
+                                 jint bitsPerPixel)
+{
+  ::Display* dpy = (::Display*) visual->display->display;
+  ::Visual* vis = (::Visual*) visual->getVisualStructure();
+
+  char* data = 0; // no preallocated data
+  ::XImage* ximage = XCreateImage(dpy, vis, depth, format, xoffset,
+                                 data,
+                                 width, height, 
+                                 bitmapPad,
+                                 bytesPerLine
+                                 );
+  if (ximage == 0)
+    {
+      jstring errorMessage = JvNewStringLatin1("XCreateImage failed");
+      JvThrow(new java::lang::OutOfMemoryError(errorMessage));
+    }
+    
+  bool reinitialize = false;
+    
+  if ((bitsPerPixel != 0) && (ximage->bits_per_pixel != bitsPerPixel))
+    {
+      ximage->bits_per_pixel = bitsPerPixel;
+      reinitialize = true;
+    }
+    
+  // FIXME: make autoconf test?
+  jshort endianTestShort[] = { 1 };
+  jbyte* endianTestByte = reinterpret_cast<jbyte*>(endianTestShort);
+    
+  jint byteOrder;
+  if (endianTestByte[0] == 1)
+    {
+      // little endian machine
+      byteOrder = LEAST_SIGNIFICANT_B_FIRST_ORDER;
+    }
+  else
+    {
+      // big endian machine
+      byteOrder = MOST_SIGNIFICANT_B_FIRST_ORDER;
+    }
+  /* NB: This doesn't consider those weird machines out there with
+     middle-endian byte order. */
+    
+  if (byteOrder != ximage->byte_order)
+    {
+      ximage->byte_order = byteOrder;
+      reinitialize = true;
+    }
+    
+  if (reinitialize)
+    XInitImage(ximage);
+    
+  structure = reinterpret_cast<gnu::gcj::RawData*>(ximage);
+  // Notice that no image data has been allocated at this point
+}
+
+void gnu::gcj::xlib::XImage::init(Visual* visual, 
+                                 jint width,
+                                 jint height)
+{
+  int depth = visual->getDepth();
+    
+  int format = ZPixmap; // Chunky, not planar.
+  int offset = 0;
+  int bitmapPad = 32; // FIXME, don't hardcode this
+  int bytesPerLine = 0; // Let the server figure it out
+
+  init(visual, depth, format, offset, width, height, bitmapPad,
+       bytesPerLine, 0);
+}
+
+void gnu::gcj::xlib::XImage::internalSetData(jbyteArray data, jint offset)
+{
+  ::XImage* ximage = (::XImage*) structure;
+  ximage->data = reinterpret_cast<char*>(elements(data)+offset);
+}
+
+void gnu::gcj::xlib::XImage::internalSetData(jshortArray data, jint offset)
+{
+  ::XImage* ximage = (::XImage*) structure;
+  ximage->data = reinterpret_cast<char*>(elements(data)+offset);
+}
+
+void gnu::gcj::xlib::XImage::internalSetData(jintArray data, jint offset)
+{
+  ::XImage* ximage = (::XImage*) structure;
+  ximage->data = reinterpret_cast<char*>(elements(data)+offset);
+}
+
+void gnu::gcj::xlib::XImage::finalize()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  if (ownsData)
+    delete ximage->data;
+  
+  ximage->data = 0; // Never allow XLib to free the data allocation.
+  dataRef = 0;
+  XDestroyImage(ximage);
+}
+
+jint gnu::gcj::xlib::XImage::getWidth()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->width;
+}
+
+jint gnu::gcj::xlib::XImage::getHeight()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->height;
+}
+
+jint gnu::gcj::xlib::XImage::getDepth()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->depth;
+}
+
+jint gnu::gcj::xlib::XImage::getFormat()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->format;
+}
+
+jint gnu::gcj::xlib::XImage::getXOffset()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->xoffset;
+}
+
+jint gnu::gcj::xlib::XImage::getImageByteOrder()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->byte_order;
+}
+
+jint gnu::gcj::xlib::XImage::getBitmapBitOrder()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->bitmap_bit_order;
+}
+
+jint gnu::gcj::xlib::XImage::getBitmapUnit()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->bitmap_unit;
+}
+
+jint gnu::gcj::xlib::XImage::getBitmapPad()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->bitmap_pad;
+}
+
+jint gnu::gcj::xlib::XImage::getBytesPerLine()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->bytes_per_line;
+}
+
+jint gnu::gcj::xlib::XImage::getBitsPerPixel()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->bits_per_pixel;
+}
+
+
+// True/Direct Color specific:
+
+jint gnu::gcj::xlib::XImage::getRedMask()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->red_mask;
+}
+
+jint gnu::gcj::xlib::XImage::getGreenMask()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->green_mask;
+}
+
+jint gnu::gcj::xlib::XImage::getBlueMask()
+{
+  ::XImage* ximage = (::XImage*) structure;
+  return ximage->blue_mask;
+}
+
+void gnu::gcj::xlib::XImage::setPixel(jint x, jint y, jint pixel)
+{
+  ::XImage* ximage = (::XImage*) structure;
+  XPutPixel(ximage, x, y, pixel);
+}
diff --git a/libjava/gnu/gcj/xlib/natXUnmapEvent.cc b/libjava/gnu/gcj/xlib/natXUnmapEvent.cc
new file mode 100644 (file)
index 0000000..d91a778
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright (C) 2000  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 <X11/Xlib.h>
+
+#include <gcj/cni.h>
+#include <gnu/gcj/RawData.h>
+
+#include <gnu/gcj/xlib/Display.h>
+#include <gnu/gcj/xlib/Window.h>
+#include <gnu/gcj/xlib/XAnyEvent.h>
+#include <gnu/gcj/xlib/XEvent.h>
+#include <gnu/gcj/xlib/XUnmapEvent.h>
+
+void gnu::gcj::xlib::XUnmapEvent::setUnmappedWindow(gnu::gcj::xlib::Window*
+                                                   unmappedWindow)
+{
+  ::XUnmapEvent* evt = (::XUnmapEvent*) event->structure;
+  evt->window = unmappedWindow->getXID();
+}
+
+void gnu::gcj::xlib::XUnmapEvent::setFromConfigure(jboolean fromConfigure)
+{
+  ::XUnmapEvent* evt = (::XUnmapEvent*) event->structure;
+  evt->from_configure = fromConfigure ? True : False;
+}
+
index cf2e7a676d915efd893dc1f4ce701235a641f0b3..1887fcfecc6a420ea21d8f9cfae31d288f0fddc3 100644 (file)
@@ -24,6 +24,7 @@ class EventDispatchThread extends Thread
     setName("AWT-EventQueue-" + dispatchThreadNum++);
     this.queue = queue;
     setPriority(NORM_PRIORITY + 1);
+    start();
   }
 
   public void run()