aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2004-02-13 13:16:04 +0000
committerDiego Novillo <dnovillo@redhat.com>2004-02-13 13:16:04 +0000
commitbd5d511254066692f7d3a5925b4a48d68c7c3fe1 (patch)
tree1896204e319d0262090325bcf5af1975512cb7b7 /libjava
parent983f8d2440b07e1ff17a836d602caac760b121ee (diff)
Mainline merge as of 2004-02-11.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@77756 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog537
-rw-r--r--libjava/Makefile.am2
-rw-r--r--libjava/Makefile.in9
-rwxr-xr-xlibjava/configure1499
-rw-r--r--libjava/configure.in16
-rw-r--r--libjava/glib-2.0.m4212
-rw-r--r--libjava/gnu/awt/xlib/XCanvasPeer.java26
-rw-r--r--libjava/gnu/awt/xlib/XGraphics.java12
-rw-r--r--libjava/gnu/awt/xlib/XToolkit.java94
-rw-r--r--libjava/gnu/java/awt/EmbeddedWindow.java4
-rw-r--r--libjava/gnu/java/awt/peer/ClasspathFontPeer.java2
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java2
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java2
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java3
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java50
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java35
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java38
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkListPeer.java20
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java6
-rw-r--r--libjava/gnu/java/lang/ClassHelper.java14
-rw-r--r--libjava/gnu/java/net/PlainSocketImpl.java29
-rw-r--r--libjava/gnu/java/net/protocol/http/Connection.java2
-rw-r--r--libjava/gnu/java/nio/DatagramChannelImpl.java57
-rw-r--r--libjava/gnu/java/nio/NIOServerSocket.java3
-rw-r--r--libjava/gnu/java/nio/ServerSocketChannelImpl.java10
-rw-r--r--libjava/gnu/java/nio/SocketChannelImpl.java61
-rw-r--r--libjava/gtk-2.0.m4196
-rw-r--r--libjava/include/i386-signal.h2
-rw-r--r--libjava/include/jvm.h3
-rw-r--r--libjava/include/powerpc-signal.h63
-rw-r--r--libjava/include/x86_64-signal.h2
-rw-r--r--libjava/java/awt/BorderLayout.java46
-rw-r--r--libjava/java/awt/Button.java1
-rw-r--r--libjava/java/awt/CardLayout.java4
-rw-r--r--libjava/java/awt/CheckboxGroup.java28
-rw-r--r--libjava/java/awt/Choice.java2
-rw-r--r--libjava/java/awt/Component.java178
-rw-r--r--libjava/java/awt/Container.java202
-rw-r--r--libjava/java/awt/FontMetrics.java4
-rw-r--r--libjava/java/awt/Frame.java19
-rw-r--r--libjava/java/awt/GridBagLayout.java831
-rw-r--r--libjava/java/awt/LayoutManager2.java6
-rw-r--r--libjava/java/awt/List.java119
-rw-r--r--libjava/java/awt/Menu.java13
-rw-r--r--libjava/java/awt/MenuBar.java12
-rw-r--r--libjava/java/awt/MenuItem.java29
-rw-r--r--libjava/java/awt/Polygon.java32
-rw-r--r--libjava/java/awt/Rectangle.java49
-rw-r--r--libjava/java/awt/ScrollPane.java40
-rw-r--r--libjava/java/awt/Scrollbar.java139
-rw-r--r--libjava/java/awt/TextArea.java96
-rw-r--r--libjava/java/awt/TextField.java47
-rw-r--r--libjava/java/awt/datatransfer/DataFlavor.java14
-rw-r--r--libjava/java/awt/geom/AffineTransform.java55
-rw-r--r--libjava/java/awt/image/renderable/RenderContext.java12
-rw-r--r--libjava/java/io/BufferedReader.java14
-rw-r--r--libjava/java/io/InputStreamReader.java38
-rw-r--r--libjava/java/io/ObjectInputStream.java801
-rw-r--r--libjava/java/io/ObjectStreamClass.java121
-rw-r--r--libjava/java/io/ObjectStreamField.java125
-rw-r--r--libjava/java/lang/Class.java25
-rw-r--r--libjava/java/lang/Thread.java711
-rw-r--r--libjava/java/lang/natPosixProcess.cc6
-rw-r--r--libjava/java/net/DatagramSocket.java7
-rw-r--r--libjava/java/net/ServerSocket.java12
-rw-r--r--libjava/java/net/Socket.java10
-rw-r--r--libjava/java/nio/ByteBuffer.java10
-rw-r--r--libjava/java/nio/ByteBufferHelper.java136
-rw-r--r--libjava/java/nio/ByteBufferImpl.java91
-rw-r--r--libjava/java/nio/CharViewBufferImpl.java94
-rw-r--r--libjava/java/nio/DirectByteBufferImpl.java124
-rw-r--r--libjava/java/nio/DoubleViewBufferImpl.java80
-rw-r--r--libjava/java/nio/FloatViewBufferImpl.java83
-rw-r--r--libjava/java/nio/IntViewBufferImpl.java83
-rw-r--r--libjava/java/nio/LongViewBufferImpl.java83
-rw-r--r--libjava/java/nio/MappedByteBufferImpl.java133
-rw-r--r--libjava/java/nio/ShortViewBufferImpl.java83
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelectableChannel.java9
-rw-r--r--libjava/java/nio/natDirectByteBufferImpl.cc9
-rw-r--r--libjava/java/util/zip/Deflater.java257
-rw-r--r--libjava/java/util/zip/DeflaterOutputStream.java2
-rw-r--r--libjava/java/util/zip/GZIPInputStream.java142
-rw-r--r--libjava/javax/swing/AbstractCellEditor.java28
-rw-r--r--libjava/javax/swing/Box.java11
-rw-r--r--libjava/javax/swing/ButtonGroup.java8
-rw-r--r--libjava/javax/swing/CellEditor.java93
-rw-r--r--libjava/javax/swing/CellRendererPane.java6
-rw-r--r--libjava/javax/swing/DefaultListModel.java1
-rw-r--r--libjava/javax/swing/DefaultListSelectionModel.java53
-rw-r--r--libjava/javax/swing/JApplet.java2
-rw-r--r--libjava/javax/swing/JComboBox.java2
-rw-r--r--libjava/javax/swing/JComponent.java150
-rw-r--r--libjava/javax/swing/JEditorPane.java36
-rw-r--r--libjava/javax/swing/JFileChooser.java23
-rw-r--r--libjava/javax/swing/JFormattedTextField.java14
-rw-r--r--libjava/javax/swing/JLabel.java2
-rw-r--r--libjava/javax/swing/JList.java23
-rw-r--r--libjava/javax/swing/SwingUtilities.java639
-rw-r--r--libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java20
-rw-r--r--libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java5
-rw-r--r--libjava/javax/swing/table/AbstractTableModel.java24
-rw-r--r--libjava/javax/swing/table/JTableHeader.java2
-rw-r--r--libjava/jni.cc2
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c19
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c130
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c21
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c131
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c94
-rw-r--r--libjava/libart.m4168
-rw-r--r--libjava/verify.cc2
110 files changed, 5401 insertions, 4586 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2b335733371..ba68afef486 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,9 +1,542 @@
+2004-02-10 David Jee <djee@redhat.com>
+
+ * java/awt/BorderLayout.java
+ (calcCompSize): Invisible components get zero dimensions.
+ * java/awt/Button.java
+ (setLabel): Set actionCommand.
+ * java/awt/Component.java
+ (show): Invalidate component and parent container.
+ (hide): Likewise.
+
+2004-02-10 David Jee <djee@redhat.com>
+
+ * java/awt/GridBagLayout.java
+ (GridBagLayout): New private field, internalcomptable.
+ (lookupInternalConstraints): New method.
+ (ArrangeGrid): Use components' MINSIZE. Use internalcomptable.
+ (GetLayoutInfo): Reimplement.
+ (calcCellSizes): Ignore rows/columns with size 0.
+
+2004-02-10 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/EmbeddedWindow.java
+ (setHandle): Use java.awt.Component.getPeer() instead of
+ java.awt.Component.peer directly.
+
+2004-02-10 David Jee <djee@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java
+ (gtkSetLabel): New native method definition.
+ (setLabel): Use gtkSetLabel.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel): New method.
+
+2004-02-10 Alan Modra <amodra@bigpond.net.au>
+
+ * include/powerpc-signal.h: Revert 2004-01-21 change.
+ (INIT_SEGV, INIT_FPE): Provide powerpc64 versions. Check return
+ from syscall for ppc32 versions.
+
+2004-02-08 Per Bothner <per@bothner.com>
+
+ * java/nio/ByteBuffer.java (shiftDown): New helper method.
+ * java/nio/natDirectByteBufferImpl.cc (shiftDown): New implementation.
+ * java/nio/ByteBufferImpl.java (compact): Use new shiftDown method.
+ * sava/nio/ByteBufferHelper.java: Remove redundant 'final' specifiers.
+ Pass ByteOrder parameter to most methods, since the underlying
+ ByteBuffer's order isn't always what we should use.
+ * java/nio/ByteBufferImpl.java: Pass byte-order various places.
+ * java/nio/DirectByteBufferImpl.java: Likewise.
+ Use ByteBufferHelper methods.
+ * java/nio/MappedByteBufferImpl.java: Likewise.
+ (compact): Use shiftDown.
+ * java/nio/CharViewBufferImpl.java (<init>): Pass byte-order.
+ (get, put): Use ByteBufferHelper.
+ (compact): Use new shiftDown method.
+ (duplicate(boolean)): New helper method.
+ (duplicate, asReadOnlyBuffer): Use it.
+ (order): Return endian field.
+ * java/nio/DoubleViewBufferImpl.java: Likewise.
+ * java/nio/FloatViewBufferImpl.java: Likewise.
+ * java/nio/IntViewBufferImpl.java: Likewise.
+ * java/nio/LongViewBufferImpl.java: Likewise.
+ * java/nio/ShortViewBufferImpl.java: Likewise.
+ * java/nio/CharViewBufferImpl.java (subsequence): Redundant test.
+ * java/nio/DirectByteBufferImpl.java (shiftDown): New native method.
+ (compact): Re-implement using shiftDown.
+
+2004-02-08 Andreas Jaeger <aj@suse.de>
+
+ * include/x86_64-signal.h: Fix typo.
+
2004-02-08 Diego Novillo <dnovillo@redhat.com>
- * include/i386-signal.h (MAKE_THROW_FRAME): Add volatile qualifier
- to _regs.
+ * include/i386-signal.h (MAKE_THROW_FRAME): Add volatile
+ qualifier to _regs.
(HANDLE_DIVIDE_OVERFLOW): Likewise.
+2004-02-06 Michael Koch <konqueror@gmx.de>
+
+ * java/io/ObjectInputStream.java
+ (currentClassLoader): Reverted to old version of this method.
+
+2004-02-06 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java: Made all calls
+ to dumpElement[ln] conditional on dump flag. (readObject): Changed to
+ use cached info from ObjectStreamClass. (readClassDescriptor):
+ Cache more information in ObjectStreamClass. (processResolution,
+ readFields): Use cached info from ObjectStreamClass.
+ (newObject): Throw exception instead of returning null for failure.
+ (getField, getMethod, callReadMethod, setBooleanField, setByteField,
+ setCharField, setDoubleField, setFloatField, setIntField,
+ setLongField, setShortField, setObjectField, readObjectParams):
+ Removed. (dumpElement, dumpElementln): Removed dump flag condition
+ check.
+ * java/io/ObjectStreamField.java (hasReadMethod): Removed.
+ (setClass): Added call to cacheMethods() (findMethod): New method.
+ (cacheMethods): New method. (ObjectStreamClass): Added call to
+ cacheMethods(). (setFields): Cache fields. (getClassUID): Use
+ AccessController.doPrivileged to invoke setAccessible.
+ (readObjectMethod, readResolveMethod, realClassIsSerializable,
+ realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
+ New fields.
+ * java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
+ (ObjectStreamField): Removed FIXME workaround. (getTypeString,
+ isPrimitive): Made safe for cases where type == null.
+ (setBooleanField, setByteField, setCharField, setShortField,
+ setIntField, setLongField, setFloatField, setDoubleField,
+ setObjectField): New methods.
+
+2004-02-05 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Component.java (getFont): Return a default font
+ instead of null.
+
+ * java/awt/Scrollbar.java (next_scrollbar_number): New field.
+ (Scrollbar (int, int, int, int, int)): Make default page
+ increment 10.
+ (setValues): Only call peer.setValues if one of the values has
+ changed.
+ (generateName): New method.
+ (getUniqueLong): New method.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
+ (range_scrollbar): Remove structure.
+ (post_adjustment_event): Remove function.
+ (post_change_event): Accept jobject argument.
+ (create): Cast jints to gdoubles. Round scrollbar values to the
+ nearest integer. Clamp min, max and value settings.
+ (connectJObject): Connect hook to widget->window.
+ (connectSignals): Remove range_scrollbar structure variables.
+ Remove "move-slider" connection. Pass global peer reference to
+ "value-changed" callback.
+ (setLineIncrement): Cast jint value to gdouble.
+ (setPageIncrement): Likewise.
+ (setValues): Likewise. Clamp min, max and value settings.
+
+2004-02-05 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractCellEditor.java
+ (getCellEditorValue): Removed.
+ * javax/swing/Box.java: Reformated.
+ (serialVersionUID): New field.
+ * javax/swing/ButtonGroup.java:
+ Removed some weird whitespace.
+ * javax/swing/CellEditor.java: Reformated.
+ * javax/swing/CellRendererPane.java
+ (serialVersionUID): New field.
+ (AccessibleCellRendererPaneserialVersionUID): New field.
+ * javax/swing/DefaultListModel.java
+ (serialVersionUID): New field.
+ * javax/swing/JEditorPane.java
+ (serialVersionUID): New field.
+ (setPage): Throws IOException.
+ (addHyperlinkListener): Implemented.
+ (removeHyperlinkListener): Implemented.
+ (getHyperlinkListener): New method.
+ * javax/swing/JFileChooser.java
+ (serialVersionUID): New field.
+ (AccessibleJFileChooser.serialVersionUID): New field.
+ (addActionListener): Implemented.
+ (removeActionListener): Implemented.
+ (getActionListeners): New method.
+ * javax/swing/JFormattedTextField.java
+ (serialVersionUID): New field.
+ (AbstractFormatter.serialVersionUID): New field.
+ (clone): Throws CloneNotSupportedException
+ (setEditValid): Add missing argument.
+ (stringToValue): Throws ParseExcpetion.
+ (valueToString): Throws ParseException.
+ (commitEdit): Throws ParseException.
+ * javax/swing/JLabel.java
+ (serialVersionUID): New field.
+ * javax/swing/JList.java
+ (serialVersionUID): New field.
+ (addListSelectionListener): Reformated.
+ (removeListSelectionListener): Reformated.
+ (getListSelectionListeners): New method.
+ * javax/swing/colorchooser/AbstractColorChooserPanel.java:
+ Reformated.
+ (serialVersionUID): New field.
+ * javax/swing/table/AbstractTableModel.java
+ (getValueAt): Removed.
+ (getColumnCount): Removed.
+ (getRowCount): Removed.
+
+2004-02-05 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/datatransfer/DataFlavor.java
+ (imageFlavor): Javadoc added.
+ (javaJVMLocalObjectType): Fixed.
+
+2004-02-05 Michael Koch <konqueror@gmx.de>
+
+ * java/lang/Thread.java
+ (Thread): Reordered.
+ (setContextClassLoader): Fixed javadoc comment.
+ (setPriority): Reordered.
+ (yield): Reordered.
+ (initialize_native): Reordered.
+ (gen_name): Reordered.
+
+2004-02-05 Michael Koch <konqueror@gmx.de>
+
+ * java/lang/Thread.java: Reordered fields, reformated much code,
+ no functional changes, some variables renamed, javadoc comments
+ merged.
+
+2004-02-05 Michael Koch <konqueror@gmx.de>
+
+ * java/util/zip/Deflater.java,
+ java/util/zip/DeflaterOutputStream.java,
+ java/util/zip/GZIPInputStream.java:
+ Reformated and javadoc comments merged from classpath.
+
+2004-02-05 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/nio/NIOServerSocket.java
+ (impl): Unused, removed.
+ * gnu/java/nio/SocketChannelImpl.java
+ (finnishConnect): Don't throw NoConnectionPendingException if not
+ connected or no connection pending.
+
+2004-02-02 Graydon Hoare <graydon@redhat.com>
+
+ * javax/swing/SwingUtilities.java: Many new functions.
+ * java/awt/Container.java (LightweightDispatcher): Reimplement.
+ * javax/swing/basic/BasicGraphicsUtils.java
+ (getPreferredButtonSize): Start layout from top-left corner.
+
+2004-02-04 Olga Rodimina <rodimina@redhat.com>
+
+ * java/awt/geom/AffineTransform.java:
+ Corrected comments on the field definitions for
+ m11 and m10.
+ (shear): Fixed few errors that caused shear
+ transformation to be performed incorrectly.
+ (createInverse): Fixed to return correct
+ inverse of the given matrix.
+
+2004-02-03 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/natPosixProcess.cc (startProcess): Handle case where
+ PATH or LD_LIBRARY_PATH is not set in parent environment.
+
+2004-02-03 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkListPeer.java,
+ java/awt/BorderLayout.java, java/awt/CardLayout.java,
+ java/awt/CheckboxGroup.java, java/awt/Choice.java,
+ java/awt/Component.java, java/awt/Container.java,
+ java/awt/FontMetrics.java, java/awt/GridBagLayout.java,
+ java/awt/LayoutManager2.java, java/awt/List.java,
+ java/awt/Menu.java, java/awt/MenuBar.java,
+ java/awt/MenuItem.java, java/awt/Polygon.java,
+ java/awt/Rectangle.java, java/awt/ScrollPane.java,
+ java/awt/Scrollbar.java, java/awt/TextArea.java,
+ java/awt/TextField.java,
+ java/awt/image/renderable/RenderContext.java,
+ javax/swing/JApplet.java: Fix handling of alias methods, where a
+ method has been deprecated in favour of a new one with the same
+ funtion but a different name. Put the method implementation in
+ the deprecated method and have the new method call the
+ deprecated one. Make all other code call the new method.
+
+2004-02-03 Mohan Embar <gnustuff@thisiscool.com>
+
+ * gnu/java/nio/DatagramChannelImpl.java
+ (inChannelOperation): New field.
+ (isInChannelOperation): New accessor.
+ (setInChannelOperation): New modifier.
+ (receive): Use capacity() - position() of destination
+ buffer instead of remaining(). Set and reset our "in
+ channel operation indicator" before and after delegating
+ the receive to our datagram socket. Removed testing code.
+ Update destination buffer's current position if it is
+ backed by a byte array (hasArray() is true).
+ (send): Set and reset our "in channel operation indicator"
+ before and after delegating the send to our datagram socket.
+ Removed testing code. Update source buffer's current position
+ if it is backed by a byte array (hasArray() is true).
+ * gnu/java/nio/SocketChannelImpl.java (read(ByteBuffer)):
+ Use capacity() - position() of destination buffer instead
+ of remaining().
+ * java/net/DatagramSocket.java (receive): Don't throw an
+ IllegalBlockingModeException if we have a non-blocking
+ channel which initiated this operation.
+ (send): Likewise.
+
+2004-02-01 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * configure.in: Add pkgconfig check for glib and gthread.
+ * configure: Regenerate.
+
+2004-02-01 Michael Koch <konqueror@gmx.de>
+
+ * include/jvm.h (MAYBE_UNUSED): New macro tp mark probably unused
+ arguments.
+ * jni.cc (_Jv_LookupJNIMethod): Mark 'args_size' unused.
+ * verify.cc (debug_print): Mark 'fmt' unused.
+
+2004-01-30 Michael Koch <konqueror@gmx.de>
+
+ * configure.in: Use pkg-config to check for GTK 2.2 and libart 2.1.
+ * configure: Regenerated.
+ * glib-2.0.m4: Removed.
+ * gtk-2.0.m4: Removed.
+ * libart.m4: Removed.
+ * pkg.m4: New file.
+
+2004-01-30 Mohan Embar <gnustuff@thisiscool.com>
+
+ * gnu/java/net/PlainSocketImpl.java
+ (inChannelOperation): New field.
+ (isInChannelOperation): New accessor.
+ (setInChannelOperation): New modifier.
+ * gnu/java/nio/ServerSocketChannelImpl.java
+ (accept): Set and reset our server socket's PlainSocketImpl's
+ "in channel operation" indicator before and after delegating
+ the accept to our server socket.
+ * gnu/java/nio/SocketChannelImpl.java
+ (connect): Set and reset our socket's PlainSocketImpl's "in channel
+ operation" indicator before and after delegating the operation to
+ our socket.
+ (read): Likewise.
+ (write): Likewise.
+ * java/net/ServerSocket.java (implAccept): Don't throw an
+ IllegalBlockingModeException if we have a non-blocking
+ channel which initiated this accept operation.
+ * java/net/Socket.java (connect): Don't throw an
+ IllegalBlockingModeException if we have a non-blocking
+ channel which initiated this connect operation.
+ * java/nio/channels/spi/AbstractSelectableChannel.java
+ (configureBlocking): Only call implConfigureBlocking() if
+ the desired blocking mode is different from our current one.
+
+2004-01-29 Mohan Embar <gnustuff@thisiscool.com>
+
+ * java/io/BufferedReader.java (sbuf): New field.
+ (readLine): Use String.valueOf instead of new String() as per
+ Per Bothner's suggestion. Use instance sbuf field instead of a
+ local StringBuffer instance.
+ * java/io/InputStreamReader.java (read(char[],int,int)): Pass the
+ caller's buffer to refill().
+ (read(void)): Pass our internal work buffer to refill if our
+ input queue is empty.
+ (refill): Changed return type to int. Use the specified buffer
+ instead of our work buffer as per Bryce McKinlay's suggestion.
+ Return the number of characters read or -1 for EOF.
+
+2004-01-29 Scott Gilbertson <scottg@mantatest.com>
+
+ * gnu/awt/xlib/XCanvasPeer.java (handleEvent): Implemented.
+
+2004-01-29 Scott Gilbertson <scottg@mantatest.com>
+
+ * Makefile.am: Added gnu/awt/xlib/XFontPeer.java.
+ * Makefile.in: Re-generated.
+ * gnu/awt/xlib/XFontPeer.java: New file.
+ * gnu/awt/xlib/XGraphics.java (setFont): Test for null font.
+ (setClip): Commented out debug printout.
+ * gnu/awt/xlib/XToolkit.java: Change superclass to ClasspathToolkit.
+ (getFontPeer): Return XFontPeer.
+ (getLocalGraphicsEnvironment): New method.
+ (getClasspathFontPeer): New method.
+ (createFont): New method.
+
+2004-01-29 Scott Gilbertson <scottg@mantatest.com>
+
+ * gnu/java/awt/peer/ClasspathFontPeer.java (getTransform): Never
+ return null.
+
+2004-01-29 Kim Ho <kho@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java
+ (gtkLayoutSetVisible): New method
+ (setMenuBar): Hide layout before setting MenuBar
+ and reshow it after.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (gtkLayoutSetVisible): Hide or show the Gtk Layout.
+
+2004-01-28 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/lang/ClassHelper.java
+ (getPackagePortion): Removed.
+
+2004-01-28 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JComponent.java
+ (listenerList): Initalize globally.
+ (ancestor_list): Removed.
+ (veto_list): Removed.
+ (change_list): Removed.
+ (get_veto_list): Removed.
+ (get_change_list): Removed.
+ (get_ancestor_list): Removed.
+ (removeAncestorListener): Reimplemented.
+ (removePropertyChangeListener): Likewise.
+ (removeVetoableChangeListener): Likewise.
+ (addAncestorListener): Likewise.
+ (addPropertyChangeListener): Likewise.
+ (addVetoableChangeListener): Likewise.
+ (getListeners): New method.
+ (getAncestorListeners): Likewise.
+ (getVetoableChangeListeners): Likewise.
+ (fireVetoableChange): Throws PropertyVetoException.
+ * javax/swing/JEditorPane.java
+ (JEditorPane): Throws IOException.
+
+2004-01-28 David Jee <djee@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java
+ (create): Set the default foreground color to
+ java.awt.SystemColor.windowText.
+
+2004-01-27 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java,
+ * gnu/java/awt/peer/gtk/GdkGlyphVector.java:
+ Reindented to merge with classpath.
+
+2004-01-27 David Jee <djee@redhat.com>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (addExposeFilter): Handle GtkFramePeer separately.
+ (removeExposeFilter): Likewise.
+
+2004-01-27 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/protocol/http/Connection.java
+ (getOutputStream): Fixed typo.
+
+2004-01-27 Michael Koch <konqueror@gmx.de>
+
+ * java/lang/Class.java
+ (getConstructor): Removed SecurityException from throws clause.
+ (_getConstructors): Likewise.
+ (getConstructors): Likewise.
+ (getDeclaredConstructor): Likewise.
+ (getDeclaredClasses): Likewise.
+ (getDeclaredConstructors): Likewise.
+ (getDeclaredField): Likewise.
+ (getDeclaredMethod): Likewise.
+ (getDeclaredMethods): Likewise.
+ (getField): Likewise.
+ (getMethod): Likewise.
+ (getMethods): Likewise.
+
+2004-01-27 Kim Ho <kho@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java
+ (removeMenuBarPeer): Remove MenuBarPeer argument.
+ * gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+ (dispose): Call native method.
+ * java/awt/Frame.java (setMenuBar): Create and remove
+ MenuBar peers only if the Frame has a peer.
+ (addNotify): Create the MenuBar peer if one exists.
+ (removeNotify): Remove MenuBar peer if one exists.
+ * java/awt/Menu.java: Fix imports.
+ (addNotify): Don't use full class name.
+ (removeNotify): Call removeNotify on all children.
+ * java/awt/MenuBar.java (removeNotify): Call
+ removeNotify on all children.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (removeMenuBarPeer): Remove MenuBarPeer argument.
+ Iterate through children to find the Frame's MenuBar.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c
+ New file.
+ (dispose): Remove references to the MenuComponent.
+
+2004-01-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractCellEditor.java: Reformated.
+ * javax/swing/DefaultListSelectionModel.java
+ (listenerList): Made protected.
+ (addListSelectionListener): Javadoc added.
+ (removeListSelectionListener): Likewise.
+ (getListeners): Likewise.
+ (getListSelectionListeners): Likewise.
+ * javax/swing/JComboBox.java: Merged copyright year.
+ * javax/swing/plaf/basic/BasicGraphicsUtils.java: Merged empty line.
+
+2004-01-26 Andrew Haley <aph@redhat.com>
+
+ * javax/swing/table/JTableHeader.java: Extend JComponent
+
+2004-01-26 Kim Ho <kho@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar):
+ Fix spacing.
+
+2004-01-26 Kim Ho <kho@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (moveLayout): New
+ method.
+ (setMenuBar): Shift the Gtk layout up/down by the MenuBar
+ height and let the Layout Managers readjust anything that
+ needs to move.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (moveLayout): New method. Shift everything in the Gtk
+ layout in the Y direction by an offset.
+
+2004-01-26 David Jee <djee@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java
+ (handleEvent): Implemented. Handles PaintEvents.
+ (paint): Implemented. Use GTK native methods to queue updates
+ for this heavyweight peer.
+ * gnu/java/awt/peer/gtk/GtkContainerPeer.java
+ (handleEvent): Removed.
+ * java/awt/Component.java
+ (paint): Implemented. Explictly paint the heavyweight peer.
+ (update): Clear the background for heavyweight components.
+ (paintAll): No need to call peer.paint() anymore.
+ (processEvent): Don't process PaintEvents here. It's now done in
+ the peer's handleEvent().
+ (processPaintEvent): Removed.
+ * java/awt/Container.java
+ (paint): No need to call super.paint(). Visit heavyweight
+ children as well.
+ (update): Don't clear the background here. It's done in
+ Component.update().
+ (visitChildren): Added check to not recurse into Containers.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (filter_expose_event_handler): New method. Filter unwanted
+ expose events while painting heavyweight peers.
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter):
+ New method. Connect filter and block pre_event_handler.
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter):
+ New method. Disconnect filter and unblock pre_event_handler.
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetQueueDrawArea):
+ New method. Invalidate and update given area.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+ (pre_event_handler): Add checks for unwanted expose events.
+
+2004-01-26 David Jee <djee@redhat.com>
+
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (find_bg_color_widget): For GtkButton, return its child.
+
2004-01-26 Kim Ho <kho@redhat.com>
* gnu/java/awt/peer/gtk/GtkFramePeer.java (menuBarHeight): Mark
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 43cb2bcdadc..07c996511f0 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -200,6 +200,7 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c \
@@ -2869,6 +2870,7 @@ gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \
+gnu/awt/xlib/XFontPeer.java \
gnu/awt/xlib/XToolkit.java
x_nat_source_files = \
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index 2b2c3a0befb..7c0ef87cc2b 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -292,6 +292,7 @@ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c \
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c \
@@ -2567,6 +2568,7 @@ gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \
+gnu/awt/xlib/XFontPeer.java \
gnu/awt/xlib/XToolkit.java
@@ -2794,6 +2796,7 @@ lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES =
@GTK_CAIRO_FALSE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.lo \
@GTK_CAIRO_FALSE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.lo \
@GTK_CAIRO_FALSE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo \
+@GTK_CAIRO_FALSE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.lo \
@GTK_CAIRO_FALSE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo \
@GTK_CAIRO_FALSE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.lo \
@GTK_CAIRO_FALSE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.lo \
@@ -2874,6 +2877,7 @@ lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES =
@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.lo \
@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.lo \
@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo \
+@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.lo \
@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo \
@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.lo \
@GTK_CAIRO_TRUE@jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.lo \
@@ -2944,8 +2948,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.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/XFontMetrics.P .deps/gnu/awt/xlib/XFontPeer.P \
+.deps/gnu/awt/xlib/XFramePeer.P .deps/gnu/awt/xlib/XGraphics.P \
.deps/gnu/awt/xlib/XGraphicsConfiguration.P \
.deps/gnu/awt/xlib/XOffScreenImage.P .deps/gnu/awt/xlib/XPanelPeer.P \
.deps/gnu/awt/xlib/XToolkit.P .deps/gnu/classpath/Configuration.P \
@@ -4581,6 +4585,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuComponentPeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.P \
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.P \
diff --git a/libjava/configure b/libjava/configure
index 6e837132128..01e34ea0c63 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -73,16 +73,6 @@ ac_help="$ac_help
--enable-java-gc=TYPE choose garbage collector [boehm]"
ac_help="$ac_help
--with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib"
-ac_help="$ac_help
- --disable-gtktest do not try to compile and run a test GTK+ program"
-ac_help="$ac_help
- --disable-glibtest do not try to compile and run a test GLIB program"
-ac_help="$ac_help
- --with-libart-prefix=PFX Prefix where LIBART is installed (optional)"
-ac_help="$ac_help
- --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)"
-ac_help="$ac_help
- --disable-libarttest Do not try to compile and run a test LIBART program"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -601,7 +591,7 @@ fi
ORIGINAL_LD_FOR_MULTILIBS=$LD
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:605: checking whether ln -s works" >&5
+echo "configure:595: 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
@@ -655,7 +645,7 @@ am__api_version="1.4"
# 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:659: checking for a BSD compatible install" >&5
+echo "configure:649: 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
@@ -708,7 +698,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:712: checking whether build environment is sane" >&5
+echo "configure:702: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -765,7 +755,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:769: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:759: 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
@@ -798,12 +788,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:802: checking for Cygwin environment" >&5
+echo "configure:792: 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 807 "configure"
+#line 797 "configure"
#include "confdefs.h"
int main() {
@@ -814,7 +804,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -831,19 +821,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:835: checking for mingw32 environment" >&5
+echo "configure:825: 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 840 "configure"
+#line 830 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:837: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -970,7 +960,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:974: checking host system type" >&5
+echo "configure:964: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -991,7 +981,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:995: checking target system type" >&5
+echo "configure:985: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -1009,7 +999,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:1013: checking build system type" >&5
+echo "configure:1003: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1038,7 +1028,7 @@ test "$host_alias" != "$target_alias" &&
# 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:1042: checking for $ac_word" >&5
+echo "configure:1032: 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
@@ -1068,7 +1058,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:1072: checking for $ac_word" >&5
+echo "configure:1062: 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
@@ -1119,7 +1109,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:1123: checking for $ac_word" >&5
+echo "configure:1113: 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
@@ -1152,7 +1142,7 @@ fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1156: checking whether we are using GNU C" >&5
+echo "configure:1146: 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
@@ -1161,7 +1151,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1165: \"$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:1155: \"$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
@@ -1180,7 +1170,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:1184: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1174: 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
@@ -1229,7 +1219,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:1233: checking for $ac_word" >&5
+echo "configure:1223: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_glibjava_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1264,7 +1254,7 @@ CXX=$glibjava_CXX
test -z "$glibjava_CXX" && { echo "configure: error: no acceptable c++ found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1268: checking whether we are using GNU C++" >&5
+echo "configure:1258: 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
@@ -1273,7 +1263,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1277: \"$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:1267: \"$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
@@ -1288,7 +1278,7 @@ if test $ac_cv_prog_gxx = yes; then
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1292: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1282: 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
@@ -1337,7 +1327,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6
-echo "configure:1341: checking for working aclocal-${am__api_version}" >&5
+echo "configure:1331: checking for working aclocal-${am__api_version}" >&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.
@@ -1350,7 +1340,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1354: checking for working autoconf" >&5
+echo "configure:1344: 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.
@@ -1363,7 +1353,7 @@ else
fi
echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6
-echo "configure:1367: checking for working automake-${am__api_version}" >&5
+echo "configure:1357: checking for working automake-${am__api_version}" >&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.
@@ -1376,7 +1366,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1380: checking for working autoheader" >&5
+echo "configure:1370: 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.
@@ -1389,7 +1379,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1393: checking for working makeinfo" >&5
+echo "configure:1383: 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.
@@ -1406,7 +1396,7 @@ fi
# 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:1410: checking for $ac_word" >&5
+echo "configure:1400: 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
@@ -1438,7 +1428,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:1442: checking for $ac_word" >&5
+echo "configure:1432: 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
@@ -1470,7 +1460,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:1474: checking for $ac_word" >&5
+echo "configure:1464: 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
@@ -1502,7 +1492,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:1506: checking for $ac_word" >&5
+echo "configure:1496: 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
@@ -1547,7 +1537,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:1551: checking for a BSD compatible install" >&5
+echo "configure:1541: 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
@@ -1601,7 +1591,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:1605: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1595: 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"
@@ -1627,7 +1617,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1631: checking for executable suffix" >&5
+echo "configure:1621: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1637,10 +1627,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.$ac_ext | *.c | *.o | *.obj) ;;
+ *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -1787,7 +1777,7 @@ ac_prog=ld
if test "$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:1791: checking for ld used by GCC" >&5
+echo "configure:1781: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1817,10 +1807,10 @@ echo "configure:1791: 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:1821: checking for GNU ld" >&5
+echo "configure:1811: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1824: checking for non-GNU ld" >&5
+echo "configure:1814: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1855,7 +1845,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:1859: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1849: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1872,7 +1862,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1876: checking for $LD option to reload object files" >&5
+echo "configure:1866: 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
@@ -1884,7 +1874,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:1888: checking for BSD-compatible nm" >&5
+echo "configure:1878: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1922,7 +1912,7 @@ NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1926: checking how to recognise dependant libraries" >&5
+echo "configure:1916: 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
@@ -2097,13 +2087,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:2101: checking for object suffix" >&5
+echo "configure:2091: 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:2107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -2127,7 +2117,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:2131: checking for ${ac_tool_prefix}file" >&5
+echo "configure:2121: 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
@@ -2189,7 +2179,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:2193: checking for file" >&5
+echo "configure:2183: 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
@@ -2260,7 +2250,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:2264: checking for $ac_word" >&5
+echo "configure:2254: 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
@@ -2292,7 +2282,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:2296: checking for $ac_word" >&5
+echo "configure:2286: 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
@@ -2327,7 +2317,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:2331: checking for $ac_word" >&5
+echo "configure:2321: 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
@@ -2359,7 +2349,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:2363: checking for $ac_word" >&5
+echo "configure:2353: 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
@@ -2426,8 +2416,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 2430 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 2420 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if test "$lt_cv_prog_gnu_ld" = yes; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
@@ -2460,7 +2450,7 @@ case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*ELF-32*)
HPUX_IA64_MODE="32"
@@ -2476,7 +2466,7 @@ ia64-*-hpux*)
x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
- if { (eval echo configure:2480: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ if { (eval echo configure:2470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
case $host in
@@ -2520,7 +2510,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2524: checking whether the C compiler needs -belf" >&5
+echo "configure:2514: 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
@@ -2533,14 +2523,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 2537 "configure"
+#line 2527 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2534: \"$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
@@ -2570,7 +2560,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:2574: checking how to run the C++ preprocessor" >&5
+echo "configure:2564: 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
@@ -2583,12 +2573,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 2587 "configure"
+#line 2577 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2582: \"$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
:
@@ -2872,7 +2862,7 @@ INTERPRETER="$libgcj_interpreter"
echo $ac_n "checking for exception model to use""... $ac_c" 1>&6
-echo "configure:2876: checking for exception model to use" >&5
+echo "configure:2866: checking for exception model to use" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2887,7 +2877,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then
:
else
cat > conftest.$ac_ext << EOF
-#line 2891 "configure"
+#line 2881 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -2898,7 +2888,7 @@ void foo()
EOF
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-S
-if { (eval echo configure:2902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2892: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
enable_sjlj_exceptions=yes
elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
@@ -3012,7 +3002,7 @@ case "$TARGET_ECOS" in
PLATFORMH=win32.h
echo $ac_n "checking whether 'ld' is at least 2.13""... $ac_c" 1>&6
-echo "configure:3016: checking whether 'ld' is at least 2.13" >&5
+echo "configure:3006: checking whether 'ld' is at least 2.13" >&5
LD_PROG=`$CC --print-prog-name=ld`
LD_VERSION=`$LD_PROG --version`
LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
@@ -3058,7 +3048,7 @@ esac
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:3062: checking how to run the C preprocessor" >&5
+echo "configure:3052: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -3073,13 +3063,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 3077 "configure"
+#line 3067 "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:3083: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3073: \"$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
:
@@ -3090,13 +3080,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 3094 "configure"
+#line 3084 "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:3100: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3090: \"$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
:
@@ -3107,13 +3097,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 3111 "configure"
+#line 3101 "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:3117: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3107: \"$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
:
@@ -3138,7 +3128,7 @@ fi
echo "$ac_t""$CPP" 1>&6
cat > conftest.$ac_ext <<EOF
-#line 3142 "configure"
+#line 3132 "configure"
#include "confdefs.h"
#include <stdint.h>
EOF
@@ -3153,7 +3143,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3157 "configure"
+#line 3147 "configure"
#include "confdefs.h"
#include <inttypes.h>
EOF
@@ -3168,7 +3158,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3172 "configure"
+#line 3162 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -3183,7 +3173,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3187 "configure"
+#line 3177 "configure"
#include "confdefs.h"
#include <sys/config.h>
EOF
@@ -3200,7 +3190,7 @@ rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3204 "configure"
+#line 3194 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3215,7 +3205,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3219 "configure"
+#line 3209 "configure"
#include "confdefs.h"
#include <time.h>
EOF
@@ -3285,7 +3275,7 @@ ZLIBTESTSPEC=
# 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:3289: checking for X" >&5
+echo "configure:3279: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -3347,12 +3337,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 3351 "configure"
+#line 3341 "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:3356: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3346: \"$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*
@@ -3421,14 +3411,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3425 "configure"
+#line 3415 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:3432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3422: \"$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.
@@ -3534,17 +3524,17 @@ else
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:3538: checking whether -R must be followed by a space" >&5
+echo "configure:3528: 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 3541 "configure"
+#line 3531 "configure"
#include "confdefs.h"
int main() {
; 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:3538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
@@ -3560,14 +3550,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 3564 "configure"
+#line 3554 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:3571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
@@ -3599,7 +3589,7 @@ rm -f conftest*
# 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:3603: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:3593: 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
@@ -3607,7 +3597,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3611 "configure"
+#line 3601 "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
@@ -3618,7 +3608,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:3622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3612: \"$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
@@ -3640,7 +3630,7 @@ 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:3644: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:3634: 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
@@ -3648,7 +3638,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3652 "configure"
+#line 3642 "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
@@ -3659,7 +3649,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:3663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3653: \"$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
@@ -3688,12 +3678,12 @@ fi
# 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:3692: checking for gethostbyname" >&5
+echo "configure:3682: 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 3697 "configure"
+#line 3687 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -3716,7 +3706,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:3720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3710: \"$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
@@ -3737,7 +3727,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:3741: checking for gethostbyname in -lnsl" >&5
+echo "configure:3731: 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
@@ -3745,7 +3735,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3749 "configure"
+#line 3739 "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
@@ -3756,7 +3746,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3750: \"$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
@@ -3786,12 +3776,12 @@ fi
# -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:3790: checking for connect" >&5
+echo "configure:3780: 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 3795 "configure"
+#line 3785 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -3814,7 +3804,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:3818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3808: \"$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
@@ -3835,7 +3825,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:3839: checking for connect in -lsocket" >&5
+echo "configure:3829: 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
@@ -3843,7 +3833,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3847 "configure"
+#line 3837 "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
@@ -3854,7 +3844,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:3858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3848: \"$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
@@ -3878,12 +3868,12 @@ 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:3882: checking for remove" >&5
+echo "configure:3872: 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 3887 "configure"
+#line 3877 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -3906,7 +3896,7 @@ remove();
; return 0; }
EOF
-if { (eval echo configure:3910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3900: \"$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
@@ -3927,7 +3917,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:3931: checking for remove in -lposix" >&5
+echo "configure:3921: 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
@@ -3935,7 +3925,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3939 "configure"
+#line 3929 "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
@@ -3946,7 +3936,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:3950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3940: \"$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
@@ -3970,12 +3960,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:3974: checking for shmat" >&5
+echo "configure:3964: 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 3979 "configure"
+#line 3969 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -3998,7 +3988,7 @@ shmat();
; return 0; }
EOF
-if { (eval echo configure:4002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3992: \"$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
@@ -4019,7 +4009,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:4023: checking for shmat in -lipc" >&5
+echo "configure:4013: 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
@@ -4027,7 +4017,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4031 "configure"
+#line 4021 "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
@@ -4038,7 +4028,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:4042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4032: \"$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
@@ -4071,7 +4061,7 @@ fi
# 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:4075: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:4065: 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
@@ -4079,7 +4069,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4083 "configure"
+#line 4073 "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
@@ -4090,7 +4080,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:4094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4084: \"$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
@@ -4208,7 +4198,7 @@ then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4212: checking for $ac_word" >&5
+echo "configure:4202: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4252,19 +4242,19 @@ fi
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
echo $ac_n "checking for cairo""... $ac_c" 1>&6
-echo "configure:4256: checking for cairo" >&5
+echo "configure:4246: checking for cairo" >&5
if $PKG_CONFIG --exists "cairo" ; then
echo "$ac_t""yes" 1>&6
succeeded=yes
echo $ac_n "checking CAIRO_CFLAGS""... $ac_c" 1>&6
-echo "configure:4263: checking CAIRO_CFLAGS" >&5
+echo "configure:4253: checking CAIRO_CFLAGS" >&5
CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo"`
echo "$ac_t""$CAIRO_CFLAGS" 1>&6
echo $ac_n "checking CAIRO_LIBS""... $ac_c" 1>&6
-echo "configure:4268: checking CAIRO_LIBS" >&5
+echo "configure:4258: checking CAIRO_LIBS" >&5
CAIRO_LIBS=`$PKG_CONFIG --libs "cairo"`
echo "$ac_t""$CAIRO_LIBS" 1>&6
else
@@ -4297,7 +4287,7 @@ echo "configure:4268: checking CAIRO_LIBS" >&5
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4301: checking for $ac_word" >&5
+echo "configure:4291: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4341,19 +4331,19 @@ fi
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
echo $ac_n "checking for pangoft2""... $ac_c" 1>&6
-echo "configure:4345: checking for pangoft2" >&5
+echo "configure:4335: checking for pangoft2" >&5
if $PKG_CONFIG --exists "pangoft2" ; then
echo "$ac_t""yes" 1>&6
succeeded=yes
echo $ac_n "checking PANGOFT2_CFLAGS""... $ac_c" 1>&6
-echo "configure:4352: checking PANGOFT2_CFLAGS" >&5
+echo "configure:4342: checking PANGOFT2_CFLAGS" >&5
PANGOFT2_CFLAGS=`$PKG_CONFIG --cflags "pangoft2"`
echo "$ac_t""$PANGOFT2_CFLAGS" 1>&6
echo $ac_n "checking PANGOFT2_LIBS""... $ac_c" 1>&6
-echo "configure:4357: checking PANGOFT2_LIBS" >&5
+echo "configure:4347: checking PANGOFT2_LIBS" >&5
PANGOFT2_LIBS=`$PKG_CONFIG --libs "pangoft2"`
echo "$ac_t""$PANGOFT2_LIBS" 1>&6
else
@@ -4388,7 +4378,7 @@ fi
libsubdir=.libs
echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
-echo "configure:4392: checking for garbage collector to use" >&5
+echo "configure:4382: 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"
@@ -4440,7 +4430,7 @@ esac
echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
-echo "configure:4444: checking for thread model used by GCC" >&5
+echo "configure:4434: checking for thread model used by GCC" >&5
THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
echo "$ac_t""$THREADS" 1>&6
@@ -4651,12 +4641,12 @@ else
for ac_func in strerror ioctl select fstat open fsync sleep opendir
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4655: checking for $ac_func" >&5
+echo "configure:4645: 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 4660 "configure"
+#line 4650 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4679,7 +4669,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4673: \"$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
@@ -4706,12 +4696,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:4710: checking for $ac_func" >&5
+echo "configure:4700: 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 4715 "configure"
+#line 4705 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4734,7 +4724,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4728: \"$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
@@ -4761,12 +4751,12 @@ done
for ac_func in access stat mkdir rename rmdir unlink realpath utime chmod
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4765: checking for $ac_func" >&5
+echo "configure:4755: 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 4770 "configure"
+#line 4760 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4789,7 +4779,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4783: \"$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
@@ -4816,12 +4806,12 @@ done
for ac_func in nl_langinfo setlocale
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4820: checking for $ac_func" >&5
+echo "configure:4810: 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 4825 "configure"
+#line 4815 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4844,7 +4834,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4848: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4838: \"$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
@@ -4871,12 +4861,12 @@ done
for ac_func in inet_aton inet_addr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4875: checking for $ac_func" >&5
+echo "configure:4865: 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 4880 "configure"
+#line 4870 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4899,7 +4889,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4893: \"$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
@@ -4926,12 +4916,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:4930: checking for $ac_func" >&5
+echo "configure:4920: 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 4935 "configure"
+#line 4925 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4954,7 +4944,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4948: \"$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
@@ -4981,12 +4971,12 @@ done
for ac_func in fork execvp pipe sigaction ftruncate
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4985: checking for $ac_func" >&5
+echo "configure:4975: 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 4990 "configure"
+#line 4980 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5009,7 +4999,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5003: \"$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
@@ -5037,17 +5027,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5041: checking for $ac_hdr" >&5
+echo "configure:5031: 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 5046 "configure"
+#line 5036 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5051: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5041: \"$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*
@@ -5074,12 +5064,12 @@ fi
done
echo $ac_n "checking for backtrace""... $ac_c" 1>&6
-echo "configure:5078: checking for backtrace" >&5
+echo "configure:5068: checking for backtrace" >&5
if eval "test \"`echo '$''{'ac_cv_func_backtrace'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5083 "configure"
+#line 5073 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char backtrace(); below. */
@@ -5102,7 +5092,7 @@ backtrace();
; return 0; }
EOF
-if { (eval echo configure:5106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_backtrace=yes"
else
@@ -5155,7 +5145,7 @@ fi
echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6
-echo "configure:5159: checking for dladdr in -ldl" >&5
+echo "configure:5149: 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
@@ -5163,7 +5153,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5167 "configure"
+#line 5157 "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
@@ -5174,7 +5164,7 @@ int main() {
dladdr()
; return 0; }
EOF
-if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5168: \"$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
@@ -5210,7 +5200,7 @@ do
ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
-echo "configure:5214: checking for $ac_file" >&5
+echo "configure:5204: 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
@@ -5268,7 +5258,7 @@ fi
echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:5272: checking for iconv" >&5
+echo "configure:5262: checking for iconv" >&5
if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5276,7 +5266,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
cat > conftest.$ac_ext <<EOF
-#line 5280 "configure"
+#line 5270 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -5286,7 +5276,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:5290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_func_iconv=yes
else
@@ -5298,7 +5288,7 @@ rm -f conftest*
am_save_LIBS="$LIBS"
LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
cat > conftest.$ac_ext <<EOF
-#line 5302 "configure"
+#line 5292 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <iconv.h>
@@ -5308,7 +5298,7 @@ iconv_t cd = iconv_open("","");
iconv_close(cd);
; return 0; }
EOF
-if { (eval echo configure:5312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_lib_iconv=yes
am_cv_func_iconv=yes
@@ -5329,13 +5319,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
EOF
echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:5333: checking for iconv declaration" >&5
+echo "configure:5323: checking for iconv declaration" >&5
if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5339 "configure"
+#line 5329 "configure"
#include "confdefs.h"
#include <stdlib.h>
@@ -5354,7 +5344,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:5358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_proto_iconv_arg1=""
else
@@ -5385,17 +5375,17 @@ EOF
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5389: checking for $ac_hdr" >&5
+echo "configure:5379: 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 5394 "configure"
+#line 5384 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5399: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5389: \"$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*
@@ -5423,19 +5413,19 @@ done
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:5427: checking for LC_MESSAGES" >&5
+echo "configure:5417: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5432 "configure"
+#line 5422 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:5439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_val_LC_MESSAGES=yes
else
@@ -5456,12 +5446,12 @@ EOF
fi
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:5460: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:5450: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5465 "configure"
+#line 5455 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -5469,7 +5459,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:5473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -5490,12 +5480,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:5494: checking for tm_zone in struct tm" >&5
+echo "configure:5484: checking for tm_zone in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5499 "configure"
+#line 5489 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -5503,7 +5493,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:5507: \"$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*
ac_cv_struct_tm_zone=yes
else
@@ -5523,12 +5513,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:5527: checking for tzname" >&5
+echo "configure:5517: checking for tzname" >&5
if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5532 "configure"
+#line 5522 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@@ -5538,7 +5528,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:5542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
@@ -5563,12 +5553,12 @@ fi
for ac_func in gethostbyname_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5567: checking for $ac_func" >&5
+echo "configure:5557: 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 5572 "configure"
+#line 5562 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5591,7 +5581,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5585: \"$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
@@ -5618,7 +5608,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 5622 "configure"
+#line 5612 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -5638,7 +5628,7 @@ rm -f conftest*
*" -D_REENTRANT "*) ;;
*)
echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
-echo "configure:5642: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+echo "configure:5632: 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
@@ -5651,14 +5641,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 5655 "configure"
+#line 5645 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:5662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=no
else
@@ -5668,14 +5658,14 @@ else
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
cat > conftest.$ac_ext <<EOF
-#line 5672 "configure"
+#line 5662 "configure"
#include "confdefs.h"
#include <netdb.h>
int main() {
gethostbyname_r("", 0, 0);
; return 0; }
EOF
-if { (eval echo configure:5679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_gethostbyname_r_needs_reentrant=yes
else
@@ -5710,12 +5700,12 @@ EOF
esac
echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
-echo "configure:5714: checking for struct hostent_data" >&5
+echo "configure:5704: 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 5719 "configure"
+#line 5709 "configure"
#include "confdefs.h"
#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
@@ -5726,7 +5716,7 @@ int main() {
struct hostent_data data;
; return 0; }
EOF
-if { (eval echo configure:5730: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
libjava_cv_struct_hostent_data=yes
else
@@ -5758,7 +5748,7 @@ done
# to exist where expected. (The root issue: AC_CHECK_FUNCS assumes C
# linkage check is enough, yet C++ code requires proper prototypes.)
cat > conftest.$ac_ext <<EOF
-#line 5762 "configure"
+#line 5752 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -5769,12 +5759,12 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
for ac_func in gethostbyaddr_r
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5773: checking for $ac_func" >&5
+echo "configure:5763: 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 5778 "configure"
+#line 5768 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5797,7 +5787,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5791: \"$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
@@ -5824,7 +5814,7 @@ EOF
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
cat > conftest.$ac_ext <<EOF
-#line 5828 "configure"
+#line 5818 "configure"
#include "confdefs.h"
#include <netdb.h>
EOF
@@ -5851,12 +5841,12 @@ rm -f conftest*
for ac_func in gethostname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5855: checking for $ac_func" >&5
+echo "configure:5845: 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 5860 "configure"
+#line 5850 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5879,7 +5869,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5873: \"$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
@@ -5903,7 +5893,7 @@ EOF
EOF
cat > conftest.$ac_ext <<EOF
-#line 5907 "configure"
+#line 5897 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -5927,12 +5917,12 @@ done
for ac_func in usleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5931: checking for $ac_func" >&5
+echo "configure:5921: 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 5936 "configure"
+#line 5926 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5955,7 +5945,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5949: \"$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
@@ -5975,7 +5965,7 @@ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
EOF
cat > conftest.$ac_ext <<EOF
-#line 5979 "configure"
+#line 5969 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -6006,12 +5996,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:6010: checking for $ac_func" >&5
+echo "configure:6000: 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 6015 "configure"
+#line 6005 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6034,7 +6024,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6028: \"$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
@@ -6064,12 +6054,12 @@ done
for ac_func in sched_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6068: checking for $ac_func" >&5
+echo "configure:6058: 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 6073 "configure"
+#line 6063 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6092,7 +6082,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6086: \"$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
@@ -6114,7 +6104,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:6118: checking for sched_yield in -lrt" >&5
+echo "configure:6108: 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
@@ -6122,7 +6112,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lrt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6126 "configure"
+#line 6116 "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
@@ -6133,7 +6123,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:6137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6127: \"$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
@@ -6159,7 +6149,7 @@ else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:6163: checking for sched_yield in -lposix4" >&5
+echo "configure:6153: 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
@@ -6167,7 +6157,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6171 "configure"
+#line 6161 "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
@@ -6178,7 +6168,7 @@ int main() {
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:6182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6172: \"$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
@@ -6214,7 +6204,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 6218 "configure"
+#line 6208 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -6223,7 +6213,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:6227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6217: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE_M_COUNT 1
@@ -6235,7 +6225,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 6239 "configure"
+#line 6229 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
@@ -6244,7 +6234,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:6248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define PTHREAD_MUTEX_HAVE___M_COUNT 1
@@ -6264,12 +6254,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:6268: checking for $ac_func" >&5
+echo "configure:6258: 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 6273 "configure"
+#line 6263 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6292,7 +6282,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6286: \"$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
@@ -6323,12 +6313,12 @@ done
for ac_func in memmove
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6327: checking for $ac_func" >&5
+echo "configure:6317: 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 6332 "configure"
+#line 6322 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6351,7 +6341,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6345: \"$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
@@ -6381,12 +6371,12 @@ done
for ac_func in memcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6385: checking for $ac_func" >&5
+echo "configure:6375: 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 6390 "configure"
+#line 6380 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6409,7 +6399,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6403: \"$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
@@ -6438,7 +6428,7 @@ done
fi
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:6442: checking for dlopen in -ldl" >&5
+echo "configure:6432: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6446,7 +6436,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6450 "configure"
+#line 6440 "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
@@ -6457,7 +6447,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:6461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6451: \"$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
@@ -6502,7 +6492,7 @@ fi
#--------------------------------------------------------------------
echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:6506: checking for socket libraries" >&5
+echo "configure:6496: 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
@@ -6510,12 +6500,12 @@ else
gcj_checkBoth=0
unset ac_cv_func_connect
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:6514: checking for connect" >&5
+echo "configure:6504: 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 6519 "configure"
+#line 6509 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -6538,7 +6528,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:6542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6532: \"$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
@@ -6561,7 +6551,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:6565: checking for main in -lsocket" >&5
+echo "configure:6555: 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
@@ -6569,14 +6559,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6573 "configure"
+#line 6563 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:6580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6570: \"$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
@@ -6603,12 +6593,12 @@ fi
LIBS="$LIBS -lsocket -lnsl"
unset ac_cv_func_accept
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:6607: checking for accept" >&5
+echo "configure:6597: 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 6612 "configure"
+#line 6602 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
@@ -6631,7 +6621,7 @@ accept();
; return 0; }
EOF
-if { (eval echo configure:6635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6625: \"$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
@@ -6658,12 +6648,12 @@ fi
gcj_oldLibs=$LIBS
LIBS="$LIBS $gcj_cv_lib_sockets"
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:6662: checking for gethostbyname" >&5
+echo "configure:6652: 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 6667 "configure"
+#line 6657 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -6686,7 +6676,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:6690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6680: \"$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
@@ -6704,7 +6694,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:6708: checking for main in -lnsl" >&5
+echo "configure:6698: 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
@@ -6712,14 +6702,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6716 "configure"
+#line 6706 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:6723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6713: \"$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
@@ -6751,7 +6741,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:6755: checking for deflate in -lz" >&5
+echo "configure:6745: 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
@@ -6759,7 +6749,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lz $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6763 "configure"
+#line 6753 "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
@@ -6770,7 +6760,7 @@ int main() {
deflate()
; return 0; }
EOF
-if { (eval echo configure:6774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6764: \"$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
@@ -6795,31 +6785,14 @@ fi
# Test for Gtk stuff, if asked for.
if test "$use_gtk_awt" = yes; then
- # Check whether --enable-gtktest or --disable-gtktest was given.
-if test "${enable_gtktest+set}" = set; then
- enableval="$enable_gtktest"
- :
-else
- enable_gtktest=yes
-fi
-
-
- pkg_config_args=gtk+-2.0
- for module in .
- do
- case "$module" in
- gthread)
- pkg_config_args="$pkg_config_args gthread-2.0"
- ;;
- esac
- done
-
- no_gtk=""
+
+ succeeded=no
- # Extract the first word of "pkg-config", so it can be a program name with args.
+ if test -z "$PKG_CONFIG"; then
+ # Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6823: checking for $ac_word" >&5
+echo "configure:6796: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6852,235 +6825,66 @@ else
echo "$ac_t""no" 1>&6
fi
-
- if test x$PKG_CONFIG != xno ; then
- if pkg-config --atleast-pkgconfig-version 0.7 ; then
- :
- else
- echo *** pkg-config too old; version 0.7 or better required.
- no_gtk=yes
- PKG_CONFIG=no
- fi
- else
- no_gtk=yes
- fi
-
- min_gtk_version=2.2.0
- echo $ac_n "checking for GTK+ - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:6871: checking for GTK+ - version >= $min_gtk_version" >&5
-
- if test x$PKG_CONFIG != xno ; then
- ## don't try to run the test against uninstalled libtool libs
- if $PKG_CONFIG --uninstalled $pkg_config_args; then
- echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
- enable_gtktest=no
- fi
-
- if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
- :
- else
- no_gtk=yes
- fi
fi
- if test x"$no_gtk" = x ; then
- GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
- GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
- gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
- gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
- gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
- if test "x$enable_gtktest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$GTK_LIBS $LIBS"
- rm -f conf.gtktest
- if test "$cross_compiling" = yes; then
- echo $ac_n "cross compiling; assumed OK... $ac_c"
-else
- cat > conftest.$ac_ext <<EOF
-#line 6906 "configure"
-#include "confdefs.h"
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <stdlib.h>
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ echo $ac_n "checking for gtk+-2.0 >= 2.2""... $ac_c" 1>&6
+echo "configure:6840: checking for gtk+-2.0 >= 2.2" >&5
-int
-main ()
-{
- int major, minor, micro;
- char *tmp_version;
+ if $PKG_CONFIG --exists "gtk+-2.0 >= 2.2" ; then
+ echo "$ac_t""yes" 1>&6
+ succeeded=yes
- system ("touch conf.gtktest");
+ echo $ac_n "checking GTK_CFLAGS""... $ac_c" 1>&6
+echo "configure:6847: checking GTK_CFLAGS" >&5
+ GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.2"`
+ echo "$ac_t""$GTK_CFLAGS" 1>&6
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_gtk_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_gtk_version");
- exit(1);
- }
+ echo $ac_n "checking GTK_LIBS""... $ac_c" 1>&6
+echo "configure:6852: checking GTK_LIBS" >&5
+ GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.2"`
+ echo "$ac_t""$GTK_LIBS" 1>&6
+ else
+ GTK_CFLAGS=""
+ GTK_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ GTK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtk+-2.0 >= 2.2"`
+ echo $GTK_PKG_ERRORS
+ fi
- if ((gtk_major_version != $gtk_config_major_version) ||
- (gtk_minor_version != $gtk_config_minor_version) ||
- (gtk_micro_version != $gtk_config_micro_version))
- {
- printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
- $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf ("*** was found! If pkg-config was correct, then it is best\n");
- printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
- printf("*** to point to the correct configuration files\n");
- }
- else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
- (gtk_minor_version != GTK_MINOR_VERSION) ||
- (gtk_micro_version != GTK_MICRO_VERSION))
- {
- printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
- GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
- printf("*** library (version %d.%d.%d)\n",
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- }
- else
- {
- if ((gtk_major_version > major) ||
- ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
- ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
- {
- return 0;
- }
+
+
else
- {
- printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
- major, minor, micro);
- printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
- printf("***\n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
- printf("*** correct copy of pkg-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-
-EOF
-if { (eval echo configure:6981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- no_gtk=yes
-fi
-rm -fr conftest*
-fi
-
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
- if test "x$no_gtk" = x ; then
- echo "$ac_t""yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" 1>&6
- :
- else
- echo "$ac_t""no" 1>&6
- if test "$PKG_CONFIG" = "no" ; then
- echo "*** A new enough version of pkg-config was not found."
- echo "*** See http://pkgconfig.sourceforge.net"
- else
- if test -f conf.gtktest ; then
- :
- else
- echo "*** Could not run GTK+ test program, checking why..."
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$LIBS $GTK_LIBS"
- cat > conftest.$ac_ext <<EOF
-#line 7015 "configure"
-#include "confdefs.h"
-#include <gtk/gtk.h>
-#include <stdio.h>
-
-int main() {
- return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
-; return 0; }
-EOF
-if { (eval echo configure:7025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
- echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."
-fi
-rm -f conftest*
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- GTK_CFLAGS=""
- GTK_LIBS=""
- exit 1
+ if test $succeeded = yes; then
+ :
+ else
+ { echo "configure: error: Library requirements (gtk+-2.0 >= 2.2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." 1>&2; exit 1; }
fi
-
-
- rm -f conf.gtktest
- # Check whether --enable-glibtest or --disable-glibtest was given.
-if test "${enable_glibtest+set}" = set; then
- enableval="$enable_glibtest"
- :
-else
- enable_glibtest=yes
-fi
+
+
+
+ succeeded=no
- pkg_config_args=glib-2.0
- for module in . gthread
- do
- case "$module" in
- gmodule)
- pkg_config_args="$pkg_config_args gmodule-2.0"
- ;;
- gobject)
- pkg_config_args="$pkg_config_args gobject-2.0"
- ;;
- gthread)
- pkg_config_args="$pkg_config_args gthread-2.0"
- ;;
- esac
- done
-
- # Extract the first word of "pkg-config", so it can be a program name with args.
+ if test -z "$PKG_CONFIG"; then
+ # Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7084: checking for $ac_word" >&5
+echo "configure:6888: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -7113,307 +6917,75 @@ else
echo "$ac_t""no" 1>&6
fi
-
- no_glib=""
-
- if test x$PKG_CONFIG != xno ; then
- if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
- :
- else
- echo *** pkg-config too old; version 0.7 or better required.
- no_glib=yes
- PKG_CONFIG=no
- fi
- else
- no_glib=yes
- fi
-
- min_glib_version=2.2.0
- echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6
-echo "configure:7134: checking for GLIB - version >= $min_glib_version" >&5
-
- if test x$PKG_CONFIG != xno ; then
- ## don't try to run the test against uninstalled libtool libs
- if $PKG_CONFIG --uninstalled $pkg_config_args; then
- echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
- enable_glibtest=no
- fi
-
- if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
- :
- else
- no_glib=yes
- fi
fi
- if test x"$no_glib" = x ; then
- GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
- GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
- GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
-
- GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
- GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
- glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
- glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
- glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
- if test "x$enable_glibtest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GLIB_CFLAGS"
- LIBS="$GLIB_LIBS $LIBS"
- rm -f conf.glibtest
- if test "$cross_compiling" = yes; then
- echo $ac_n "cross compiling; assumed OK... $ac_c"
-else
- cat > conftest.$ac_ext <<EOF
-#line 7173 "configure"
-#include "confdefs.h"
-
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+ else
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ echo $ac_n "checking for glib-2.0 >= 2.2 gthread-2.0 >= 2.2""... $ac_c" 1>&6
+echo "configure:6932: checking for glib-2.0 >= 2.2 gthread-2.0 >= 2.2" >&5
-int
-main ()
-{
- int major, minor, micro;
- char *tmp_version;
+ if $PKG_CONFIG --exists "glib-2.0 >= 2.2 gthread-2.0 >= 2.2" ; then
+ echo "$ac_t""yes" 1>&6
+ succeeded=yes
- system ("touch conf.glibtest");
+ echo $ac_n "checking GLIB_CFLAGS""... $ac_c" 1>&6
+echo "configure:6939: checking GLIB_CFLAGS" >&5
+ GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.2 gthread-2.0 >= 2.2"`
+ echo "$ac_t""$GLIB_CFLAGS" 1>&6
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_glib_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_glib_version");
- exit(1);
- }
+ echo $ac_n "checking GLIB_LIBS""... $ac_c" 1>&6
+echo "configure:6944: checking GLIB_LIBS" >&5
+ GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.2 gthread-2.0 >= 2.2"`
+ echo "$ac_t""$GLIB_LIBS" 1>&6
+ else
+ GLIB_CFLAGS=""
+ GLIB_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ GLIB_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 >= 2.2 gthread-2.0 >= 2.2"`
+ echo $GLIB_PKG_ERRORS
+ fi
- if ((glib_major_version != $glib_config_major_version) ||
- (glib_minor_version != $glib_config_minor_version) ||
- (glib_micro_version != $glib_config_micro_version))
- {
- printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
- $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
- glib_major_version, glib_minor_version, glib_micro_version);
- printf ("*** was found! If pkg-config was correct, then it is best\n");
- printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
- printf("*** to point to the correct configuration files\n");
- }
- else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
- (glib_minor_version != GLIB_MINOR_VERSION) ||
- (glib_micro_version != GLIB_MICRO_VERSION))
- {
- printf("*** GLIB header files (version %d.%d.%d) do not match\n",
- GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
- printf("*** library (version %d.%d.%d)\n",
- glib_major_version, glib_minor_version, glib_micro_version);
- }
- else
- {
- if ((glib_major_version > major) ||
- ((glib_major_version == major) && (glib_minor_version > minor)) ||
- ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
- {
- return 0;
- }
+
+
else
- {
- printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
- glib_major_version, glib_minor_version, glib_micro_version);
- printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
- major, minor, micro);
- printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
- printf("***\n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
- printf("*** correct copy of pkg-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-
-EOF
-if { (eval echo configure:7248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- no_glib=yes
-fi
-rm -fr conftest*
-fi
-
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
- if test "x$no_glib" = x ; then
- echo "$ac_t""yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" 1>&6
- :
- else
- echo "$ac_t""no" 1>&6
- if test "$PKG_CONFIG" = "no" ; then
- echo "*** A new enough version of pkg-config was not found."
- echo "*** See http://www.freedesktop.org/software/pkgconfig/"
- else
- if test -f conf.glibtest ; then
- :
- else
- echo "*** Could not run GLIB test program, checking why..."
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GLIB_CFLAGS"
- LIBS="$LIBS $GLIB_LIBS"
- cat > conftest.$ac_ext <<EOF
-#line 7282 "configure"
-#include "confdefs.h"
-
-#include <glib.h>
-#include <stdio.h>
-int main() {
- return ((glib_major_version) || (glib_minor_version) || (glib_micro_version));
-; return 0; }
-EOF
-if { (eval echo configure:7292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GLIB or finding the wrong"
- echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GLIB is incorrectly installed."
-fi
-rm -f conftest*
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- GLIB_CFLAGS=""
- GLIB_LIBS=""
- GLIB_GENMARSHAL=""
- GOBJECT_QUERY=""
- GLIB_MKENUMS=""
- exit 1
+ if test $succeeded = yes; then
+ :
+ else
+ { echo "configure: error: Library requirements (glib-2.0 >= 2.2 gthread-2.0 >= 2.2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." 1>&2; exit 1; }
fi
-
-
-
-
-
- rm -f conf.glibtest
-
- enable_libarttest=no
- # Check whether --with-libart-prefix or --without-libart-prefix was given.
-if test "${with_libart_prefix+set}" = set; then
- withval="$with_libart_prefix"
- libart_prefix="$withval"
-else
- libart_prefix=""
-fi
-
-# Check whether --with-libart-exec-prefix or --without-libart-exec-prefix was given.
-if test "${with_libart_exec_prefix+set}" = set; then
- withval="$with_libart_exec_prefix"
- libart_exec_prefix="$withval"
-else
- libart_exec_prefix=""
-fi
-# Check whether --enable-libarttest or --disable-libarttest was given.
-if test "${enable_libarttest+set}" = set; then
- enableval="$enable_libarttest"
- :
-else
- enable_libarttest=yes
-fi
+
+
+
+ succeeded=no
- if test x$libart_exec_prefix != x ; then
- libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
- if test x${LIBART_CONFIG+set} != xset ; then
- LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
- fi
- fi
- if test x$libart_prefix != x ; then
- libart_args="$libart_args --prefix=$libart_prefix"
- if test x${LIBART_CONFIG+set} != xset ; then
- LIBART_CONFIG=$libart_prefix/bin/libart-config
- fi
- fi
-
- # Extract the first word of "libart2-config", so it can be a program name with args.
-set dummy libart2-config; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7371: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_LIBART_CONFIG'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- case "$LIBART_CONFIG" in
- /*)
- ac_cv_path_LIBART_CONFIG="$LIBART_CONFIG" # Let the user override the test with a path.
- ;;
- ?:/*)
- ac_cv_path_LIBART_CONFIG="$LIBART_CONFIG" # Let the user override the test with a dos path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_LIBART_CONFIG="$ac_dir/$ac_word"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_path_LIBART_CONFIG" && ac_cv_path_LIBART_CONFIG="no"
- ;;
-esac
-fi
-LIBART_CONFIG="$ac_cv_path_LIBART_CONFIG"
-if test -n "$LIBART_CONFIG"; then
- echo "$ac_t""$LIBART_CONFIG" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test "$LIBART_CONFIG" = "no" ; then
- # Extract the first word of "libart-config", so it can be a program name with args.
-set dummy libart-config; ac_word=$2
+ if test -z "$PKG_CONFIG"; then
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7408: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_LIBART_CONFIG'+set}'`\" = set"; then
+echo "configure:6980: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- case "$LIBART_CONFIG" in
+ case "$PKG_CONFIG" in
/*)
- ac_cv_path_LIBART_CONFIG="$LIBART_CONFIG" # Let the user override the test with a path.
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
?:/*)
- ac_cv_path_LIBART_CONFIG="$LIBART_CONFIG" # Let the user override the test with a dos path.
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a dos path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
@@ -7421,191 +6993,80 @@ else
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
- ac_cv_path_LIBART_CONFIG="$ac_dir/$ac_word"
+ ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word"
break
fi
done
IFS="$ac_save_ifs"
- test -z "$ac_cv_path_LIBART_CONFIG" && ac_cv_path_LIBART_CONFIG="no"
+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
-LIBART_CONFIG="$ac_cv_path_LIBART_CONFIG"
-if test -n "$LIBART_CONFIG"; then
- echo "$ac_t""$LIBART_CONFIG" 1>&6
+PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+if test -n "$PKG_CONFIG"; then
+ echo "$ac_t""$PKG_CONFIG" 1>&6
else
echo "$ac_t""no" 1>&6
fi
fi
- min_libart_version=2.1.0
- echo $ac_n "checking for LIBART - version >= $min_libart_version""... $ac_c" 1>&6
-echo "configure:7444: checking for LIBART - version >= $min_libart_version" >&5
- no_libart=""
- if test "$LIBART_CONFIG" = "no" ; then
- no_libart=yes
- else
- LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
- LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
-
- libart_major_version=`$LIBART_CONFIG $libart_args --version | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
- libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
- libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
- if test "x$enable_libarttest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $LIBART_CFLAGS"
- LIBS="$LIBS $LIBART_LIBS"
- rm -f conf.libarttest
- if test "$cross_compiling" = yes; then
- echo $ac_n "cross compiling; assumed OK... $ac_c"
-else
- cat > conftest.$ac_ext <<EOF
-#line 7468 "configure"
-#include "confdefs.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libart_lgpl/libart.h>
-
-char*
-my_strdup (char *str)
-{
- char *new_str;
-
- if (str)
- {
- new_str = malloc ((strlen (str) + 1) * sizeof(char));
- strcpy (new_str, str);
- }
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** The pkg-config script could not be found. Make sure it is"
+ echo "*** in your path, or set the PKG_CONFIG environment variable"
+ echo "*** to the full path to pkg-config."
+ echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
- new_str = NULL;
-
- return new_str;
-}
-
-int main ()
-{
- int major, minor, micro;
- char *tmp_version;
-
- system ("touch conf.libarttest");
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = my_strdup("$min_libart_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_libart_version");
- exit(1);
- }
+ PKG_CONFIG_MIN_VERSION=0.9.0
+ if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+ echo $ac_n "checking for libart-2.0 >= 2.1""... $ac_c" 1>&6
+echo "configure:7024: checking for libart-2.0 >= 2.1" >&5
- if (($libart_major_version > major) ||
- (($libart_major_version == major) && ($libart_minor_version > minor)) ||
- (($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
- printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
- printf("*** best to upgrade to the required version.\n");
- printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
- printf("*** to point to the correct copy of libart-config, and remove the file\n");
- printf("*** config.cache before re-running configure\n");
- return 1;
- }
-}
+ if $PKG_CONFIG --exists "libart-2.0 >= 2.1" ; then
+ echo "$ac_t""yes" 1>&6
+ succeeded=yes
+ echo $ac_n "checking LIBART_CFLAGS""... $ac_c" 1>&6
+echo "configure:7031: checking LIBART_CFLAGS" >&5
+ LIBART_CFLAGS=`$PKG_CONFIG --cflags "libart-2.0 >= 2.1"`
+ echo "$ac_t""$LIBART_CFLAGS" 1>&6
-EOF
-if { (eval echo configure:7526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- no_libart=yes
-fi
-rm -fr conftest*
-fi
+ echo $ac_n "checking LIBART_LIBS""... $ac_c" 1>&6
+echo "configure:7036: checking LIBART_LIBS" >&5
+ LIBART_LIBS=`$PKG_CONFIG --libs "libart-2.0 >= 2.1"`
+ echo "$ac_t""$LIBART_LIBS" 1>&6
+ else
+ LIBART_CFLAGS=""
+ LIBART_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so.
+ LIBART_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libart-2.0 >= 2.1"`
+ echo $LIBART_PKG_ERRORS
+ fi
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
+
+
+ else
+ echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
- if test "x$no_libart" = x ; then
- echo "$ac_t""yes" 1>&6
- :
- else
- echo "$ac_t""no" 1>&6
- if test "$LIBART_CONFIG" = "no" ; then
- echo "*** The libart-config script installed by LIBART could not be found"
- echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the LIBART_CONFIG environment variable to the"
- echo "*** full path to libart-config."
- else
- if test -f conf.libarttest ; then
- :
- else
- echo "*** Could not run LIBART test program, checking why..."
- CFLAGS="$CFLAGS $LIBART_CFLAGS"
- LIBS="$LIBS $LIBART_LIBS"
- cat > conftest.$ac_ext <<EOF
-#line 7560 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#include <libart_lgpl/libart.h>
-int main() {
- return 0;
-; return 0; }
-EOF
-if { (eval echo configure:7570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding LIBART or finding the wrong"
- echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
- echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
- echo "*** may want to edit the libart-config script: $LIBART_CONFIG"
-fi
-rm -f conftest*
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- LIBART_CFLAGS=""
- LIBART_LIBS=""
- exit 1
+ if test $succeeded = yes; then
+ :
+ else
+ { echo "configure: error: Library requirements (libart-2.0 >= 2.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." 1>&2; exit 1; }
fi
-
-
- rm -f conf.libarttest
+
+
fi
# On Solaris, and maybe other architectures, the Boehm collector
# requires -ldl.
if test "$GC" = boehm; then
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:7609: checking for main in -ldl" >&5
+echo "configure:7070: 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
@@ -7613,14 +7074,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7617 "configure"
+#line 7078 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:7624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7085: \"$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
@@ -7741,7 +7202,7 @@ fi
# 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:7745: checking for $ac_word" >&5
+echo "configure:7206: 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
@@ -7773,7 +7234,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:7777: checking for $ac_word" >&5
+echo "configure:7238: 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
@@ -7835,13 +7296,13 @@ exec 5>>./config.log
CPPFLAGS=$GCJ_SAVE_CPPFLAGS
echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:7839: checking size of void *" >&5
+echo "configure:7300: 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
for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence.
cat > conftest.$ac_ext <<EOF
-#line 7845 "configure"
+#line 7306 "configure"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
@@ -7851,7 +7312,7 @@ int main() {
switch (0) case 0: case (sizeof (void *) == $ac_size):;
; return 0; }
EOF
-if { (eval echo configure:7855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sizeof_void_p=$ac_size
else
@@ -7964,17 +7425,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:7968: checking for $ac_hdr" >&5
+echo "configure:7429: 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 7973 "configure"
+#line 7434 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7439: \"$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*
@@ -8004,17 +7465,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:8008: checking for $ac_hdr" >&5
+echo "configure:7469: 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 8013 "configure"
+#line 7474 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7479: \"$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*
@@ -8044,17 +7505,17 @@ for ac_hdr in inttypes.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8048: checking for $ac_hdr" >&5
+echo "configure:7509: 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 8053 "configure"
+#line 7514 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7519: \"$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*
@@ -8090,12 +7551,12 @@ fi
done
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:8094: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:7555: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 8099 "configure"
+#line 7560 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -8111,7 +7572,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:8115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -8133,12 +7594,12 @@ fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:8137: checking for ANSI C header files" >&5
+echo "configure:7598: 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 8142 "configure"
+#line 7603 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -8146,7 +7607,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8150: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7611: \"$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*
@@ -8163,7 +7624,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 8167 "configure"
+#line 7628 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -8181,7 +7642,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 8185 "configure"
+#line 7646 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -8202,7 +7663,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 8206 "configure"
+#line 7667 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -8213,7 +7674,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:8217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -8237,12 +7698,12 @@ EOF
fi
echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:8241: checking for ssize_t" >&5
+echo "configure:7702: 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 8246 "configure"
+#line 7707 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -8271,9 +7732,9 @@ fi
echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
-echo "configure:8275: checking for in_addr_t" >&5
+echo "configure:7736: checking for in_addr_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 8277 "configure"
+#line 7738 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -8287,7 +7748,7 @@ int main() {
in_addr_t foo;
; return 0; }
EOF
-if { (eval echo configure:8291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_IN_ADDR_T 1
@@ -8303,16 +7764,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:8307: checking whether struct ip_mreq is in netinet/in.h" >&5
+echo "configure:7768: checking whether struct ip_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 8309 "configure"
+#line 7770 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ip_mreq mreq;
; return 0; }
EOF
-if { (eval echo configure:8316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IP_MREQ 1
@@ -8328,16 +7789,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:8332: checking whether struct ipv6_mreq is in netinet/in.h" >&5
+echo "configure:7793: checking whether struct ipv6_mreq is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 8334 "configure"
+#line 7795 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct ipv6_mreq mreq6;
; return 0; }
EOF
-if { (eval echo configure:8341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7802: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_IPV6_MREQ 1
@@ -8353,16 +7814,16 @@ fi
rm -f conftest*
echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:8357: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+echo "configure:7818: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 8359 "configure"
+#line 7820 "configure"
#include "confdefs.h"
#include <netinet/in.h>
int main() {
struct sockaddr_in6 addr6;
; return 0; }
EOF
-if { (eval echo configure:8366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_INET6 1
@@ -8378,9 +7839,9 @@ fi
rm -f conftest*
echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:8382: checking for socklen_t in sys/socket.h" >&5
+echo "configure:7843: checking for socklen_t in sys/socket.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 8384 "configure"
+#line 7845 "configure"
#include "confdefs.h"
#define _POSIX_PII_SOCKET
#include <sys/types.h>
@@ -8389,7 +7850,7 @@ int main() {
socklen_t x = 5;
; return 0; }
EOF
-if { (eval echo configure:8393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SOCKLEN_T 1
@@ -8405,16 +7866,16 @@ fi
rm -f conftest*
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:8409: checking for tm_gmtoff in struct tm" >&5
+echo "configure:7870: checking for tm_gmtoff in struct tm" >&5
cat > conftest.$ac_ext <<EOF
-#line 8411 "configure"
+#line 7872 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
struct tm tim; tim.tm_gmtoff = 0;
; return 0; }
EOF
-if { (eval echo configure:8418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define STRUCT_TM_HAS_GMTOFF 1
@@ -8427,16 +7888,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:8431: checking for global timezone variable" >&5
+echo "configure:7892: checking for global timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 8433 "configure"
+#line 7894 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
void i(){long z2 = 2*timezone;}
; return 0; }
EOF
-if { (eval echo configure:8440: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_TIMEZONE 1
@@ -8449,16 +7910,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:8453: checking for global _timezone variable" >&5
+echo "configure:7914: checking for global _timezone variable" >&5
cat > conftest.$ac_ext <<EOF
-#line 8455 "configure"
+#line 7916 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
long z2 = _timezone;
; return 0; }
EOF
-if { (eval echo configure:8462: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_UNDERSCORE_TIMEZONE 1
@@ -8480,19 +7941,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:8484: checking for working alloca.h" >&5
+echo "configure:7945: 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 8489 "configure"
+#line 7950 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:8496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7957: \"$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
@@ -8513,12 +7974,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:8517: checking for alloca" >&5
+echo "configure:7978: 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 8522 "configure"
+#line 7983 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -8546,7 +8007,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:8550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8011: \"$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
@@ -8578,12 +8039,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:8582: checking whether alloca needs Cray hooks" >&5
+echo "configure:8043: 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 8587 "configure"
+#line 8048 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -8608,12 +8069,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:8612: checking for $ac_func" >&5
+echo "configure:8073: 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 8617 "configure"
+#line 8078 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -8636,7 +8097,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:8640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8101: \"$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
@@ -8663,7 +8124,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:8667: checking stack direction for C alloca" >&5
+echo "configure:8128: 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
@@ -8671,7 +8132,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 8675 "configure"
+#line 8136 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -8690,7 +8151,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:8694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8155: \"$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
@@ -8715,17 +8176,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:8719: checking for $ac_hdr" >&5
+echo "configure:8180: 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 8724 "configure"
+#line 8185 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8190: \"$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*
@@ -8754,12 +8215,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8758: checking for $ac_func" >&5
+echo "configure:8219: 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 8763 "configure"
+#line 8224 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -8782,7 +8243,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:8786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8247: \"$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
@@ -8807,7 +8268,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:8811: checking for working mmap" >&5
+echo "configure:8272: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8815,7 +8276,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 8819 "configure"
+#line 8280 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -8955,7 +8416,7 @@ main()
}
EOF
-if { (eval echo configure:8959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -8983,7 +8444,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:8987: checking for $ac_word" >&5
+echo "configure:8448: 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
@@ -9337,10 +8798,6 @@ s%@GTK_CFLAGS@%$GTK_CFLAGS%g
s%@GTK_LIBS@%$GTK_LIBS%g
s%@GLIB_CFLAGS@%$GLIB_CFLAGS%g
s%@GLIB_LIBS@%$GLIB_LIBS%g
-s%@GLIB_GENMARSHAL@%$GLIB_GENMARSHAL%g
-s%@GOBJECT_QUERY@%$GOBJECT_QUERY%g
-s%@GLIB_MKENUMS@%$GLIB_MKENUMS%g
-s%@LIBART_CONFIG@%$LIBART_CONFIG%g
s%@LIBART_CFLAGS@%$LIBART_CFLAGS%g
s%@LIBART_LIBS@%$LIBART_LIBS%g
s%@GCJ@%$GCJ%g
@@ -9775,7 +9232,7 @@ if test "$no_recursion" != yes; then
fi
fi
- cd "$ac_popdir"
+ cd $ac_popdir
done
fi
diff --git a/libjava/configure.in b/libjava/configure.in
index 26f39cc3359..5b3f94122b8 100644
--- a/libjava/configure.in
+++ b/libjava/configure.in
@@ -876,11 +876,17 @@ else
# Test for Gtk stuff, if asked for.
if test "$use_gtk_awt" = yes; then
- AM_PATH_GTK_2_0(2.2.0,,exit 1)
- AM_PATH_GLIB_2_0(2.2.0,,exit 1,gthread)
- dnl XXX Fix me when libart.m4 has the compile test fixed!
- enable_libarttest=no
- AM_PATH_LIBART(2.1.0,,exit 1)
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.2)
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+
+ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.2 gthread-2.0 >= 2.2)
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+
+ PKG_CHECK_MODULES(LIBART, libart-2.0 >= 2.1)
+ AC_SUBST(LIBART_CFLAGS)
+ AC_SUBST(LIBART_LIBS)
fi
# On Solaris, and maybe other architectures, the Boehm collector
diff --git a/libjava/glib-2.0.m4 b/libjava/glib-2.0.m4
deleted file mode 100644
index 28ccef4a5f6..00000000000
--- a/libjava/glib-2.0.m4
+++ /dev/null
@@ -1,212 +0,0 @@
-# Configure paths for GLIB
-# Owen Taylor 1997-2001
-
-dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
-dnl gthread is specified in MODULES, pass to pkg-config
-dnl
-AC_DEFUN(AM_PATH_GLIB_2_0,
-[dnl
-dnl Get the cflags and libraries from pkg-config
-dnl
-AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
- , enable_glibtest=yes)
-
- pkg_config_args=glib-2.0
- for module in . $4
- do
- case "$module" in
- gmodule)
- pkg_config_args="$pkg_config_args gmodule-2.0"
- ;;
- gobject)
- pkg_config_args="$pkg_config_args gobject-2.0"
- ;;
- gthread)
- pkg_config_args="$pkg_config_args gthread-2.0"
- ;;
- esac
- done
-
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-
- no_glib=""
-
- if test x$PKG_CONFIG != xno ; then
- if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
- :
- else
- echo *** pkg-config too old; version 0.7 or better required.
- no_glib=yes
- PKG_CONFIG=no
- fi
- else
- no_glib=yes
- fi
-
- min_glib_version=ifelse([$1], ,2.0.0,$1)
- AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
-
- if test x$PKG_CONFIG != xno ; then
- ## don't try to run the test against uninstalled libtool libs
- if $PKG_CONFIG --uninstalled $pkg_config_args; then
- echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
- enable_glibtest=no
- fi
-
- if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
- :
- else
- no_glib=yes
- fi
- fi
-
- if test x"$no_glib" = x ; then
- GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
- GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
- GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
-
- GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
- GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
- glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x$enable_glibtest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GLIB_CFLAGS"
- LIBS="$GLIB_LIBS $LIBS"
-dnl
-dnl Now check if the installed GLIB is sufficiently new. (Also sanity
-dnl checks the results of pkg-config to some extent)
-dnl
- rm -f conf.glibtest
- AC_TRY_RUN([
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main ()
-{
- int major, minor, micro;
- char *tmp_version;
-
- system ("touch conf.glibtest");
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_glib_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_glib_version");
- exit(1);
- }
-
- if ((glib_major_version != $glib_config_major_version) ||
- (glib_minor_version != $glib_config_minor_version) ||
- (glib_micro_version != $glib_config_micro_version))
- {
- printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
- $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
- glib_major_version, glib_minor_version, glib_micro_version);
- printf ("*** was found! If pkg-config was correct, then it is best\n");
- printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
- printf("*** to point to the correct configuration files\n");
- }
- else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
- (glib_minor_version != GLIB_MINOR_VERSION) ||
- (glib_micro_version != GLIB_MICRO_VERSION))
- {
- printf("*** GLIB header files (version %d.%d.%d) do not match\n",
- GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
- printf("*** library (version %d.%d.%d)\n",
- glib_major_version, glib_minor_version, glib_micro_version);
- }
- else
- {
- if ((glib_major_version > major) ||
- ((glib_major_version == major) && (glib_minor_version > minor)) ||
- ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
- glib_major_version, glib_minor_version, glib_micro_version);
- printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
- major, minor, micro);
- printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
- printf("***\n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
- printf("*** correct copy of pkg-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_glib" = x ; then
- AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT(no)
- if test "$PKG_CONFIG" = "no" ; then
- echo "*** A new enough version of pkg-config was not found."
- echo "*** See http://www.freedesktop.org/software/pkgconfig/"
- else
- if test -f conf.glibtest ; then
- :
- else
- echo "*** Could not run GLIB test program, checking why..."
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GLIB_CFLAGS"
- LIBS="$LIBS $GLIB_LIBS"
- AC_TRY_LINK([
-#include <glib.h>
-#include <stdio.h>
-], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GLIB or finding the wrong"
- echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- GLIB_CFLAGS=""
- GLIB_LIBS=""
- GLIB_GENMARSHAL=""
- GOBJECT_QUERY=""
- GLIB_MKENUMS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(GLIB_CFLAGS)
- AC_SUBST(GLIB_LIBS)
- AC_SUBST(GLIB_GENMARSHAL)
- AC_SUBST(GOBJECT_QUERY)
- AC_SUBST(GLIB_MKENUMS)
- rm -f conf.glibtest
-])
diff --git a/libjava/gnu/awt/xlib/XCanvasPeer.java b/libjava/gnu/awt/xlib/XCanvasPeer.java
index 6ecf7bf3296..18edaf55097 100644
--- a/libjava/gnu/awt/xlib/XCanvasPeer.java
+++ b/libjava/gnu/awt/xlib/XCanvasPeer.java
@@ -279,6 +279,32 @@ public class XCanvasPeer implements CanvasPeer
public void handleEvent(AWTEvent event)
{
+ int id = event.getID ();
+
+ switch (id)
+ {
+ case PaintEvent.PAINT:
+ case PaintEvent.UPDATE:
+ {
+ try
+ {
+ Graphics g = getGraphics ();
+ g.setClip (((PaintEvent)event).getUpdateRect ());
+
+ if (id == PaintEvent.PAINT)
+ component.paint (g);
+ else
+ component.update (g);
+
+ g.dispose ();
+ }
+ catch (InternalError e)
+ {
+ System.err.println (e);
+ }
+ }
+ break;
+ }
}
public boolean isFocusTraversable()
diff --git a/libjava/gnu/awt/xlib/XGraphics.java b/libjava/gnu/awt/xlib/XGraphics.java
index e27b0a18e8b..0e14e25bc71 100644
--- a/libjava/gnu/awt/xlib/XGraphics.java
+++ b/libjava/gnu/awt/xlib/XGraphics.java
@@ -98,10 +98,13 @@ public class XGraphics implements Cloneable, DirectRasterGraphics
public void setFont(Font font)
{
- if ((metrics != null) && font.equals(metrics.getFont())) return;
-
+ if (font == null)
+ return;
+ if ((metrics != null) && font.equals(metrics.getFont()))
+ return;
metrics = config.getXFontMetrics(font);
- context.setFont(metrics.xfont);
+ if (metrics != null)
+ context.setFont(metrics.xfont);
}
public FontMetrics getFontMetrics(Font font)
@@ -130,12 +133,15 @@ public class XGraphics implements Cloneable, DirectRasterGraphics
expose. */
Rectangle newClipBounds = clip.getBounds();
+ /* FIXME: decide whether this test code is worth anything
+ * (as of 2004-01-29, it prints frequently)
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);
diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java
index 3da993f3924..1856d97fe53 100644
--- a/libjava/gnu/awt/xlib/XToolkit.java
+++ b/libjava/gnu/awt/xlib/XToolkit.java
@@ -11,20 +11,23 @@ package gnu.awt.xlib;
import java.awt.*;
import java.awt.dnd.*;
import java.awt.dnd.peer.*;
+import java.awt.font.*;
import java.awt.im.*;
import java.awt.peer.*;
import java.awt.image.ImageProducer;
import java.awt.image.ImageObserver;
import java.net.*;
import java.awt.datatransfer.Clipboard;
-import java.util.Properties;
+import java.io.InputStream;
import java.util.Map;
-
+import java.util.Properties;
import gnu.gcj.xlib.Display;
import gnu.gcj.xlib.Screen;
import gnu.gcj.xlib.Visual;
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.peer.ClasspathFontPeer;
-public class XToolkit extends Toolkit
+public class XToolkit extends ClasspathToolkit
{
static XToolkit INSTANCE;
@@ -158,7 +161,7 @@ public class XToolkit extends Toolkit
protected java.awt.peer.FontPeer getFontPeer(String name, int style)
{
- return null;
+ return new XFontPeer (name,style);
}
public Dimension getScreenSize()
@@ -345,4 +348,87 @@ public class XToolkit extends Toolkit
{
throw new UnsupportedOperationException("not implemented");
}
+
+ /** Returns a shared instance of the local, platform-specific
+ * graphics environment.
+ *
+ * <p>This method is specific to GNU Classpath. It gets called by
+ * the Classpath implementation of {@link
+ * GraphicsEnvironment.getLocalGraphcisEnvironment()}.
+ */
+ public GraphicsEnvironment getLocalGraphicsEnvironment ()
+ {
+ throw new java.lang.UnsupportedOperationException ();
+ }
+
+ /** Acquires an appropriate {@link ClasspathFontPeer}, for use in
+ * classpath's implementation of {@link java.awt.Font}.
+ *
+ * @param name The logical name of the font. This may be either a face
+ * name or a logical font name, or may even be null. A default
+ * implementation of name decoding is provided in
+ * {@link ClasspathFontPeer}, but may be overridden in other toolkits.
+ *
+ * @param attrs Any extra {@link java.awt.font.TextAttribute} attributes
+ * this font peer should have, such as size, weight, family name, or
+ * transformation.
+ */
+ public ClasspathFontPeer getClasspathFontPeer (String name, Map attrs)
+ {
+ int style = Font.PLAIN;
+ float size = 12;
+
+ if (attrs.containsKey (TextAttribute.WEIGHT))
+ {
+ Float weight = (Float) attrs.get (TextAttribute.WEIGHT);
+ if (weight.floatValue () >= TextAttribute.WEIGHT_BOLD.floatValue ())
+ style += Font.BOLD;
+ }
+
+ if (attrs.containsKey (TextAttribute.POSTURE))
+ {
+ Float posture = (Float) attrs.get (TextAttribute.POSTURE);
+ if (posture.floatValue () >= TextAttribute.POSTURE_OBLIQUE.floatValue ())
+ style += Font.ITALIC;
+ }
+
+ if (attrs.containsKey (TextAttribute.SIZE))
+ {
+ Float fsize = (Float) attrs.get (TextAttribute.SIZE);
+ size = fsize.floatValue ();
+ }
+
+ return new XFontPeer (name,style,size);
+ }
+
+ /** Creates a font, reading the glyph definitions from a stream.
+ *
+ * <p>This method provides the platform-specific implementation for
+ * the static factory method {@link Font#createFont(int,
+ * java.io.InputStream)}.
+ *
+ * @param format the format of the font data, such as {@link
+ * Font#TRUETYPE_FONT}. An implementation may ignore this argument
+ * if it is able to automatically recognize the font format from the
+ * provided data.
+ *
+ * @param stream an input stream from where the font data is read
+ * in. The stream will be advanced to the position after the font
+ * data, but not closed.
+ *
+ * @throws IllegalArgumentException if <code>format</code> is
+ * not supported.
+ *
+ * @throws FontFormatException if <code>stream</code> does not
+ * contain data in the expected format, or if required tables are
+ * missing from a font.
+ *
+ * @throws IOException if a problem occurs while reading in the
+ * contents of <code>stream</code>.
+ */
+ public Font createFont (int format, InputStream stream)
+ {
+ throw new java.lang.UnsupportedOperationException ();
+ }
+
}
diff --git a/libjava/gnu/java/awt/EmbeddedWindow.java b/libjava/gnu/java/awt/EmbeddedWindow.java
index 24bd107bd2b..ba0184a6307 100644
--- a/libjava/gnu/java/awt/EmbeddedWindow.java
+++ b/libjava/gnu/java/awt/EmbeddedWindow.java
@@ -108,8 +108,8 @@ public class EmbeddedWindow extends Frame
throw new RuntimeException ("EmbeddedWindow is already embedded");
this.handle = handle;
- if (peer != null)
- ((EmbeddedWindowPeer) peer).embed (this.handle);
+ if (getPeer() != null)
+ ((EmbeddedWindowPeer) getPeer()).embed (this.handle);
}
/**
diff --git a/libjava/gnu/java/awt/peer/ClasspathFontPeer.java b/libjava/gnu/java/awt/peer/ClasspathFontPeer.java
index 3d151c89e83..4f323f7cc8e 100644
--- a/libjava/gnu/java/awt/peer/ClasspathFontPeer.java
+++ b/libjava/gnu/java/awt/peer/ClasspathFontPeer.java
@@ -501,6 +501,8 @@ public abstract class ClasspathFontPeer
public AffineTransform getTransform (Font font)
{
+ if (transform == null)
+ transform = new AffineTransform ();
return transform;
}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java
index 8f96e15ab54..1cf24a98d61 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java
@@ -72,7 +72,7 @@ public class GdkClasspathFontPeer extends ClasspathFontPeer
}
if (GtkToolkit.useGraphics2D ())
- initStaticState ();
+ initStaticState ();
}
native static void initStaticState ();
private final int native_state = GtkGenericPeer.getUniqueInteger ();
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java b/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
index 076a90e7b15..ff6b4cd291a 100644
--- a/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
+++ b/libjava/gnu/java/awt/peer/gtk/GdkGlyphVector.java
@@ -62,7 +62,7 @@ public class GdkGlyphVector extends GlyphVector
}
if (GtkToolkit.useGraphics2D ())
- initStaticState ();
+ initStaticState ();
}
native static void initStaticState ();
private final int native_state = GtkGenericPeer.getUniqueInteger ();
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
index 9a832265b34..cf7260c1179 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
@@ -54,6 +54,7 @@ public class GtkButtonPeer extends GtkComponentPeer
public native void connectSignals ();
native void gtkSetFont(String name, int style, int size);
+ native void gtkSetLabel(String label);
native void gtkWidgetSetForeground (int red, int green, int blue);
public GtkButtonPeer (Button b)
@@ -63,7 +64,7 @@ public class GtkButtonPeer extends GtkComponentPeer
public void setLabel (String label)
{
- set ("label", label);
+ gtkSetLabel(label);
}
public void handleEvent (AWTEvent e)
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index 9a56619e18b..4b29bcc9ec5 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -91,6 +91,9 @@ public class GtkComponentPeer extends GtkGenericPeer
native void gtkWidgetSetCursor (int type);
native void gtkWidgetSetBackground (int red, int green, int blue);
native void gtkWidgetSetForeground (int red, int green, int blue);
+ native void gtkWidgetQueueDrawArea(int x, int y, int width, int height);
+ native void addExposeFilter();
+ native void removeExposeFilter();
void create ()
{
@@ -217,6 +220,37 @@ public class GtkComponentPeer extends GtkGenericPeer
public void handleEvent (AWTEvent event)
{
+ int id = event.getID();
+
+ switch (id)
+ {
+ case PaintEvent.PAINT:
+ case PaintEvent.UPDATE:
+ {
+ try
+ {
+ Graphics g = getGraphics ();
+
+ // Some peers like GtkFileDialogPeer are repainted by Gtk itself
+ if (g == null)
+ break;
+
+ g.setClip (((PaintEvent)event).getUpdateRect());
+
+ if (id == PaintEvent.PAINT)
+ awtComponent.paint (g);
+ else
+ awtComponent.update (g);
+
+ g.dispose ();
+ }
+ catch (InternalError e)
+ {
+ System.err.println (e);
+ }
+ }
+ break;
+ }
}
public boolean isFocusTraversable ()
@@ -235,7 +269,21 @@ public class GtkComponentPeer extends GtkGenericPeer
public void paint (Graphics g)
{
- awtComponent.paint (g);
+ Component parent = awtComponent.getParent();
+ GtkComponentPeer parentPeer = null;
+ if ((parent instanceof Container) && !parent.isLightweight())
+ parentPeer = (GtkComponentPeer) parent.getPeer();
+
+ addExposeFilter();
+ if (parentPeer != null)
+ parentPeer.addExposeFilter();
+
+ Rectangle clip = g.getClipBounds();
+ gtkWidgetQueueDrawArea(clip.x, clip.y, clip.width, clip.height);
+
+ removeExposeFilter();
+ if (parentPeer != null)
+ parentPeer.removeExposeFilter();
}
public Dimension preferredSize ()
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
index e8881728434..361dea7562b 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
@@ -100,41 +100,6 @@ public class GtkContainerPeer extends GtkComponentPeer
return new GdkGraphics (this);
}
- public void handleEvent (AWTEvent event)
- {
- int id = event.getID();
-
- switch (id)
- {
- case PaintEvent.PAINT:
- case PaintEvent.UPDATE:
- {
- try
- {
- Graphics g = getGraphics ();
-
- // Some peers like GtkFileDialogPeer are repainted by Gtk itself
- if (g == null)
- break;
-
- g.setClip (((PaintEvent)event).getUpdateRect());
-
- if (id == PaintEvent.PAINT)
- awtComponent.paint (g);
- else
- awtComponent.update (g);
-
- g.dispose ();
- }
- catch (InternalError e)
- {
- System.err.println (e);
- }
- }
- break;
- }
- }
-
public void beginLayout () { }
public void endLayout () { }
public boolean isPaintPending () { return false; }
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
index 3b69b029bae..c542b63ad31 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -58,27 +58,44 @@ public class GtkFramePeer extends GtkWindowPeer
native int getMenuBarHeight (MenuBarPeer bar);
native void setMenuBarPeer (MenuBarPeer bar);
- native void removeMenuBarPeer (MenuBarPeer bar);
+ native void removeMenuBarPeer ();
+ native void moveLayout (int offset);
+ native void gtkLayoutSetVisible (boolean vis);
public void setMenuBar (MenuBar bar)
{
- if (bar == null && menuBar != null)
+ if (bar == null)
{
- removeMenuBarPeer(menuBar);
- menuBar = null;
- insets.top -= menuBarHeight;
- menuBarHeight = 0;
- awtComponent.doLayout();
+ if (menuBar != null)
+ {
+ gtkLayoutSetVisible(false);
+ removeMenuBarPeer();
+ menuBar = null;
+ moveLayout(menuBarHeight);
+ insets.top -= menuBarHeight;
+ menuBarHeight = 0;
+ awtComponent.doLayout();
+ gtkLayoutSetVisible(true);
+ }
}
- else if (bar != null)
+ else
{
+ gtkLayoutSetVisible(false);
+ int oldHeight = 0;
if (menuBar != null)
- removeMenuBarPeer(menuBar);
+ {
+ removeMenuBarPeer();
+ oldHeight = menuBarHeight;
+ insets.top -= menuBarHeight;
+ }
menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
- setMenuBarPeer(menuBar);
+ setMenuBarPeer(menuBar);
menuBarHeight = getMenuBarHeight (menuBar);
+ if (oldHeight != menuBarHeight)
+ moveLayout(oldHeight - menuBarHeight);
insets.top += menuBarHeight;
awtComponent.doLayout();
+ gtkLayoutSetVisible(true);
}
}
@@ -121,6 +138,7 @@ public class GtkFramePeer extends GtkWindowPeer
// Create a normal decorated window.
create (GDK_WINDOW_TYPE_HINT_NORMAL, true);
setMenuBar(((Frame) awtComponent).getMenuBar());
+ awtComponent.setForeground(java.awt.SystemColor.windowText);
}
public void getArgs (Component component, GtkArgList args)
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
index ac2c361495a..7517c64655f 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
@@ -85,18 +85,12 @@ public class GtkListPeer extends GtkComponentPeer
public Dimension getMinimumSize (int rows)
{
- int dims[] = new int[2];
-
- getSize (rows, dims);
- return (new Dimension (dims[0], dims[1]));
+ return minimumSize (rows);
}
public Dimension getPreferredSize (int rows)
{
- int dims[] = new int[2];
-
- getSize (rows, dims);
- return (new Dimension (dims[0], dims[1]));
+ return preferredSize (rows);
}
public native int[] getSelectedIndexes ();
@@ -104,12 +98,18 @@ public class GtkListPeer extends GtkComponentPeer
public Dimension minimumSize (int rows)
{
- return (getMinimumSize (rows));
+ int dims[] = new int[2];
+
+ getSize (rows, dims);
+ return new Dimension (dims[0], dims[1]);
}
public Dimension preferredSize (int rows)
{
- return (getPreferredSize (rows));
+ int dims[] = new int[2];
+
+ getSize (rows, dims);
+ return new Dimension (dims[0], dims[1]);
}
public void removeAll ()
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
index eeef383ebd3..92f02230621 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
@@ -47,8 +47,6 @@ public class GtkMenuComponentPeer extends GtkGenericPeer
{
super (awtWidget);
}
-
- public void dispose ()
- {
- }
+
+ public native void dispose();
}
diff --git a/libjava/gnu/java/lang/ClassHelper.java b/libjava/gnu/java/lang/ClassHelper.java
index 16d699e3453..7339d6bf5bc 100644
--- a/libjava/gnu/java/lang/ClassHelper.java
+++ b/libjava/gnu/java/lang/ClassHelper.java
@@ -75,20 +75,6 @@ public class ClassHelper
return name.substring(lastInd + 1);
}
- /**
- * Strip the last portion of the name (after the last dot).
- *
- * @param name the name to get package of
- * @return the package name, or "" if no package
- */
- public static String getPackagePortion(String name)
- {
- int lastInd = name.lastIndexOf('.');
- if (lastInd == -1)
- return "";
- return name.substring(0, lastInd);
- }
-
/** Cache of methods found in getAllMethods(). */
private static Map allMethods = new HashMap();
diff --git a/libjava/gnu/java/net/PlainSocketImpl.java b/libjava/gnu/java/net/PlainSocketImpl.java
index 80139115cfe..5680fb30cbe 100644
--- a/libjava/gnu/java/net/PlainSocketImpl.java
+++ b/libjava/gnu/java/net/PlainSocketImpl.java
@@ -1,5 +1,5 @@
/* PlainSocketImpl.java -- Default socket implementation
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -120,6 +120,33 @@ public final class PlainSocketImpl extends SocketImpl
private OutputStream out;
/**
+ * Indicates whether a channel initiated whatever operation
+ * is being invoked on this socket.
+ */
+ private boolean inChannelOperation;
+
+ /**
+ * Indicates whether we should ignore whether any associated
+ * channel is set to non-blocking mode. Certain operations
+ * throw an <code>IllegalBlockingModeException</code> if the
+ * associated channel is in non-blocking mode, <i>except</i>
+ * if the operation is invoked by the channel itself.
+ */
+ public final boolean isInChannelOperation()
+ {
+ return inChannelOperation;
+ }
+
+ /**
+ * Sets our indicator of whether an I/O operation is being
+ * initiated by a channel.
+ */
+ public final void setInChannelOperation(boolean b)
+ {
+ inChannelOperation = b;
+ }
+
+ /**
* Default do nothing constructor
*/
public PlainSocketImpl()
diff --git a/libjava/gnu/java/net/protocol/http/Connection.java b/libjava/gnu/java/net/protocol/http/Connection.java
index bc58ebd8bb7..ac369f4ee6e 100644
--- a/libjava/gnu/java/net/protocol/http/Connection.java
+++ b/libjava/gnu/java/net/protocol/http/Connection.java
@@ -387,7 +387,7 @@ public final class Connection extends HttpURLConnection
{
if (connected)
throw new ProtocolException
- ("You cannot get an outputstream for an existing http connection");
+ ("You cannot get an output stream for an existing http connection");
if (!doOutput)
throw new ProtocolException
diff --git a/libjava/gnu/java/nio/DatagramChannelImpl.java b/libjava/gnu/java/nio/DatagramChannelImpl.java
index 3531803900a..baeac19deb6 100644
--- a/libjava/gnu/java/nio/DatagramChannelImpl.java
+++ b/libjava/gnu/java/nio/DatagramChannelImpl.java
@@ -57,6 +57,33 @@ public final class DatagramChannelImpl extends DatagramChannel
{
private NIODatagramSocket socket;
+ /**
+ * Indicates whether this channel initiated whatever operation
+ * is being invoked on our datagram socket.
+ */
+ private boolean inChannelOperation;
+
+ /**
+ * Indicates whether our datagram socket should ignore whether
+ * we are set to non-blocking mode. Certain operations on our
+ * socket throw an <code>IllegalBlockingModeException</code> if
+ * we are in non-blocking mode, <i>except</i> if the operation
+ * is initiated by us.
+ */
+ public final boolean isInChannelOperation()
+ {
+ return inChannelOperation;
+ }
+
+ /**
+ * Sets our indicator of whether we are initiating an I/O operation
+ * on our socket.
+ */
+ public final void setInChannelOperation(boolean b)
+ {
+ inChannelOperation = b;
+ }
+
protected DatagramChannelImpl (SelectorProvider provider)
throws IOException
{
@@ -178,7 +205,7 @@ public final class DatagramChannelImpl extends DatagramChannel
try
{
DatagramPacket packet;
- int len = dst.remaining();
+ int len = dst.capacity() - dst.position();
if (dst.hasArray())
{
@@ -196,23 +223,23 @@ public final class DatagramChannelImpl extends DatagramChannel
try
{
begin();
+ setInChannelOperation(true);
socket.receive (packet);
completed = true;
}
finally
{
end (completed);
+ setInChannelOperation(false);
}
if (!dst.hasArray())
{
dst.put (packet.getData(), packet.getOffset(), packet.getLength());
}
-
- // FIMXE: remove this testing code.
- for (int i = 0; i < packet.getLength(); i++)
+ else
{
- System.out.println ("Byte " + i + " has value " + packet.getData() [packet.getOffset() + i]);
+ dst.position (dst.position() + packet.getLength());
}
return packet.getSocketAddress();
@@ -246,13 +273,25 @@ public final class DatagramChannelImpl extends DatagramChannel
DatagramPacket packet = new DatagramPacket (buffer, offset, len, target);
- // FIMXE: remove this testing code.
- for (int i = 0; i < packet.getLength(); i++)
+ boolean completed = false;
+ try
+ {
+ begin();
+ setInChannelOperation(true);
+ socket.send(packet);
+ completed = true;
+ }
+ finally
+ {
+ end (completed);
+ setInChannelOperation(false);
+ }
+
+ if (src.hasArray())
{
- System.out.println ("Byte " + i + " has value " + packet.getData() [packet.getOffset() + i]);
+ src.position (src.position() + len);
}
- socket.send (packet);
return len;
}
}
diff --git a/libjava/gnu/java/nio/NIOServerSocket.java b/libjava/gnu/java/nio/NIOServerSocket.java
index 89def3bb5ee..3164247765b 100644
--- a/libjava/gnu/java/nio/NIOServerSocket.java
+++ b/libjava/gnu/java/nio/NIOServerSocket.java
@@ -1,5 +1,5 @@
/* NIOServerSocket.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,6 @@ import java.nio.channels.SocketChannel;
*/
public final class NIOServerSocket extends ServerSocket
{
- private PlainSocketImpl impl;
private ServerSocketChannelImpl channel;
protected NIOServerSocket (ServerSocketChannelImpl channel)
diff --git a/libjava/gnu/java/nio/ServerSocketChannelImpl.java b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
index fd975d20a7a..76e1ce3242f 100644
--- a/libjava/gnu/java/nio/ServerSocketChannelImpl.java
+++ b/libjava/gnu/java/nio/ServerSocketChannelImpl.java
@@ -1,5 +1,5 @@
/* ServerSocketChannelImpl.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,7 +69,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel
{
return serverSocket.getPlainSocketImpl().getNativeFD();
}
-
+
public void finalizer()
{
if (connected)
@@ -107,6 +107,11 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel
try
{
+ begin();
+ serverSocket.getPlainSocketImpl().setInChannelOperation(true);
+ // indicate that a channel is initiating the accept operation
+ // so that the socket ignores the fact that we might be in
+ // non-blocking mode.
NIOSocket socket = (NIOSocket) serverSocket.accept();
completed = true;
return socket.getChannel();
@@ -117,6 +122,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel
}
finally
{
+ serverSocket.getPlainSocketImpl().setInChannelOperation(false);
end (completed);
}
}
diff --git a/libjava/gnu/java/nio/SocketChannelImpl.java b/libjava/gnu/java/nio/SocketChannelImpl.java
index efb5fec481b..d4dd6e05653 100644
--- a/libjava/gnu/java/nio/SocketChannelImpl.java
+++ b/libjava/gnu/java/nio/SocketChannelImpl.java
@@ -1,5 +1,5 @@
/* SocketChannelImpl.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -136,23 +136,35 @@ public final class SocketChannelImpl extends SocketChannel
if (((InetSocketAddress) remote).isUnresolved())
throw new UnresolvedAddressException();
- if (isBlocking())
- {
- // Do blocking connect.
- socket.connect (remote);
- return true;
- }
-
- // Do non-blocking connect.
try
{
- socket.connect (remote, NIOConstants.DEFAULT_TIMEOUT);
- return true;
+ socket.getPlainSocketImpl().setInChannelOperation(true);
+ // indicate that a channel is initiating the accept operation
+ // so that the socket ignores the fact that we might be in
+ // non-blocking mode.
+
+ if (isBlocking())
+ {
+ // Do blocking connect.
+ socket.connect (remote);
+ return true;
+ }
+
+ // Do non-blocking connect.
+ try
+ {
+ socket.connect (remote, NIOConstants.DEFAULT_TIMEOUT);
+ return true;
+ }
+ catch (SocketTimeoutException e)
+ {
+ connectionPending = true;
+ return false;
+ }
}
- catch (SocketTimeoutException e)
+ finally
{
- connectionPending = true;
- return false;
+ socket.getPlainSocketImpl().setInChannelOperation(false);
}
}
@@ -162,7 +174,7 @@ public final class SocketChannelImpl extends SocketChannel
if (!isOpen())
throw new ClosedChannelException();
- if (!connectionPending)
+ if (!isConnected() && !connectionPending)
throw new NoConnectionPendingException();
if (isConnected())
@@ -214,7 +226,7 @@ public final class SocketChannelImpl extends SocketChannel
int offset = 0;
InputStream input = socket.getInputStream();
int available = input.available();
- int len = dst.remaining();
+ int len = dst.capacity() - dst.position();
if (available == 0)
return 0;
@@ -238,12 +250,14 @@ public final class SocketChannelImpl extends SocketChannel
try
{
begin();
+ socket.getPlainSocketImpl().setInChannelOperation(true);
readBytes = input.read (data, offset, len);
completed = true;
}
finally
{
end (completed);
+ socket.getPlainSocketImpl().setInChannelOperation(false);
}
if (readBytes > 0)
@@ -301,7 +315,20 @@ public final class SocketChannelImpl extends SocketChannel
}
OutputStream output = socket.getOutputStream();
- output.write (data, offset, len);
+ boolean completed = false;
+
+ try
+ {
+ begin();
+ socket.getPlainSocketImpl().setInChannelOperation(true);
+ output.write (data, offset, len);
+ completed = true;
+ }
+ finally
+ {
+ end (completed);
+ socket.getPlainSocketImpl().setInChannelOperation(false);
+ }
if (src.hasArray())
{
diff --git a/libjava/gtk-2.0.m4 b/libjava/gtk-2.0.m4
deleted file mode 100644
index a0c53ac11ff..00000000000
--- a/libjava/gtk-2.0.m4
+++ /dev/null
@@ -1,196 +0,0 @@
-# Configure paths for GTK+
-# Owen Taylor 1997-2001
-
-dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
-dnl pass to pkg-config
-dnl
-AC_DEFUN(AM_PATH_GTK_2_0,
-[dnl
-dnl Get the cflags and libraries from pkg-config
-dnl
-AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
- , enable_gtktest=yes)
-
- pkg_config_args=gtk+-2.0
- for module in . $4
- do
- case "$module" in
- gthread)
- pkg_config_args="$pkg_config_args gthread-2.0"
- ;;
- esac
- done
-
- no_gtk=""
-
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-
- if test x$PKG_CONFIG != xno ; then
- if pkg-config --atleast-pkgconfig-version 0.7 ; then
- :
- else
- echo *** pkg-config too old; version 0.7 or better required.
- no_gtk=yes
- PKG_CONFIG=no
- fi
- else
- no_gtk=yes
- fi
-
- min_gtk_version=ifelse([$1], ,2.0.0,$1)
- AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
-
- if test x$PKG_CONFIG != xno ; then
- ## don't try to run the test against uninstalled libtool libs
- if $PKG_CONFIG --uninstalled $pkg_config_args; then
- echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
- enable_gtktest=no
- fi
-
- if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
- :
- else
- no_gtk=yes
- fi
- fi
-
- if test x"$no_gtk" = x ; then
- GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
- GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
- gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x$enable_gtktest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$GTK_LIBS $LIBS"
-dnl
-dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
-dnl checks the results of pkg-config to some extent)
-dnl
- rm -f conf.gtktest
- AC_TRY_RUN([
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main ()
-{
- int major, minor, micro;
- char *tmp_version;
-
- system ("touch conf.gtktest");
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = g_strdup("$min_gtk_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_gtk_version");
- exit(1);
- }
-
- if ((gtk_major_version != $gtk_config_major_version) ||
- (gtk_minor_version != $gtk_config_minor_version) ||
- (gtk_micro_version != $gtk_config_micro_version))
- {
- printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
- $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf ("*** was found! If pkg-config was correct, then it is best\n");
- printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
- printf("*** to point to the correct configuration files\n");
- }
- else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
- (gtk_minor_version != GTK_MINOR_VERSION) ||
- (gtk_micro_version != GTK_MICRO_VERSION))
- {
- printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
- GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
- printf("*** library (version %d.%d.%d)\n",
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- }
- else
- {
- if ((gtk_major_version > major) ||
- ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
- ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
- gtk_major_version, gtk_minor_version, gtk_micro_version);
- printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
- major, minor, micro);
- printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
- printf("***\n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
- printf("*** correct copy of pkg-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_gtk" = x ; then
- AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT(no)
- if test "$PKG_CONFIG" = "no" ; then
- echo "*** A new enough version of pkg-config was not found."
- echo "*** See http://pkgconfig.sourceforge.net"
- else
- if test -f conf.gtktest ; then
- :
- else
- echo "*** Could not run GTK+ test program, checking why..."
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$LIBS $GTK_LIBS"
- AC_TRY_LINK([
-#include <gtk/gtk.h>
-#include <stdio.h>
-], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
- echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- GTK_CFLAGS=""
- GTK_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(GTK_CFLAGS)
- AC_SUBST(GTK_LIBS)
- rm -f conf.gtktest
-])
diff --git a/libjava/include/i386-signal.h b/libjava/include/i386-signal.h
index 59f035998c1..81959725c06 100644
--- a/libjava/include/i386-signal.h
+++ b/libjava/include/i386-signal.h
@@ -26,7 +26,7 @@ static void _name (int _dummy)
do \
{ \
void **_p = (void **)&_dummy; \
- volatile struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p;\
+ volatile struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p; \
\
/* Advance the program counter so that it is after the start of the \
instruction: the x86 exception handler expects \
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h
index e1a5c33bbc6..ee7792b0788 100644
--- a/libjava/include/jvm.h
+++ b/libjava/include/jvm.h
@@ -30,6 +30,9 @@ details. */
#include <gcj/cni.h>
#include <gcj/field.h>
+/* Macro for possible unused arguments. */
+#define MAYBE_UNUSED __attribute__((__unused__))
+
/* Structure of the virtual table. */
struct _Jv_VTable
{
diff --git a/libjava/include/powerpc-signal.h b/libjava/include/powerpc-signal.h
index 386fb18291a..0d5a6627fe7 100644
--- a/libjava/include/powerpc-signal.h
+++ b/libjava/include/powerpc-signal.h
@@ -11,17 +11,15 @@ details. */
#ifndef JAVA_SIGNAL_H
-# define JAVA_SIGNAL_H 1
+#define JAVA_SIGNAL_H 1
-# ifndef __powerpc64__
+#include <signal.h>
+#include <sys/syscall.h>
-# include <signal.h>
-# include <sys/syscall.h>
+#define HANDLE_SEGV 1
+#undef HANDLE_FPE
-# define HANDLE_SEGV 1
-# undef HANDLE_FPE
-
-# define SIGNAL_HANDLER(_name) \
+#define SIGNAL_HANDLER(_name) \
static void _name (int /* _signal */, struct sigcontext *_sc)
/* PPC either leaves PC pointing at a faulting instruction or the
@@ -29,7 +27,7 @@ details. */
the former, so we adjust the saved PC to point to the following
instruction. This is what the handler in libgcc expects. */
-# define MAKE_THROW_FRAME(_exception) \
+#define MAKE_THROW_FRAME(_exception) \
do \
{ \
_sc->regs->nip += 4; \
@@ -53,6 +51,7 @@ while (0)
compatibility hacks in MAKE_THROW_FRAME, as the ucontext layout
on PPC changed during the 2.5 kernel series. */
+#ifndef __powerpc64__
struct kernel_old_sigaction {
void (*k_sa_handler) (int, struct sigcontext *);
unsigned long k_sa_mask;
@@ -60,35 +59,61 @@ struct kernel_old_sigaction {
void (*k_sa_restorer) (void);
};
-# define INIT_SEGV \
+#define INIT_SEGV \
do \
{ \
struct kernel_old_sigaction kact; \
kact.k_sa_handler = catch_segv; \
kact.k_sa_mask = 0; \
kact.k_sa_flags = 0; \
- syscall (SYS_sigaction, SIGSEGV, &kact, NULL); \
+ if (syscall (SYS_sigaction, SIGSEGV, &kact, NULL) != 0) \
+ __asm__ __volatile__ (".long 0"); \
} \
while (0)
-# define INIT_FPE \
+#define INIT_FPE \
do \
{ \
struct kernel_old_sigaction kact; \
kact.k_sa_handler = catch_fpe; \
kact.k_sa_mask = 0; \
kact.k_sa_flags = 0; \
- syscall (SYS_sigaction, SIGFPE, &kact, NULL); \
+ if (syscall (SYS_sigaction, SIGFPE, &kact, NULL) != 0) \
+ __asm__ __volatile__ (".long 0"); \
} \
while (0)
-# else
+#else /* powerpc64 */
+
+struct kernel_sigaction
+{
+ void (*k_sa_handler) (int, struct sigcontext *);
+ unsigned long k_sa_flags;
+ void (*k_sa_restorer)(void);
+ unsigned long k_sa_mask;
+};
-# undef HANDLE_SEGV
-# undef HANDLE_FPE
+#define INIT_SEGV \
+do \
+ { \
+ struct kernel_sigaction kact; \
+ memset (&kact, 0, sizeof (kact)); \
+ kact.k_sa_handler = catch_segv; \
+ if (syscall (SYS_rt_sigaction, SIGSEGV, &kact, NULL, 8) != 0) \
+ __asm__ __volatile__ (".long 0"); \
+ } \
+while (0)
-# define INIT_SEGV do {} while (0)
-# define INIT_FPE do {} while (0)
-# endif
+#define INIT_FPE \
+do \
+ { \
+ struct kernel_sigaction kact; \
+ memset (&kact, 0, sizeof (kact)); \
+ kact.k_sa_handler = catch_fpe; \
+ if (syscall (SYS_rt_sigaction, SIGFPE, &kact, NULL, 8) != 0) \
+ __asm__ __volatile__ (".long 0"); \
+ } \
+while (0)
+#endif
#endif /* JAVA_SIGNAL_H */
diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
index ab59e5e69bc..1aa82a003a0 100644
--- a/libjava/include/x86_64-signal.h
+++ b/libjava/include/x86_64-signal.h
@@ -84,7 +84,7 @@ while (0)
#else /* __x86_64__ */
-/* This is for the 32-bit subsystem on on x86-64. */
+/* This is for the 32-bit subsystem on x86-64. */
#define sigcontext_struct sigcontext
#include <java-signal-aux.h>
diff --git a/libjava/java/awt/BorderLayout.java b/libjava/java/awt/BorderLayout.java
index 930773f0142..7f2b1a00802 100644
--- a/libjava/java/awt/BorderLayout.java
+++ b/libjava/java/awt/BorderLayout.java
@@ -349,7 +349,28 @@ addLayoutComponent(Component component, Object constraints)
if (constraints != null && ! (constraints instanceof String))
throw new IllegalArgumentException("Constraint must be a string");
- String str = (String)constraints;
+ addLayoutComponent((String) constraints, component);
+}
+
+/*************************************************************************/
+
+/**
+ * Adds a component to the layout in the specified constraint position,
+ * which must be one of the string constants defined in this class.
+ *
+ * @param constraints The constraint string.
+ * @param component The component to add.
+ *
+ * @exception IllegalArgumentException If the constraint object is not
+ * one of the specified constants in this class.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>addLayoutComponent(Component, Object)</code>.
+ */
+public void
+addLayoutComponent(String constraints, Component component)
+{
+ String str = constraints;
if (str == null || str.equals(CENTER))
center = component;
@@ -376,27 +397,6 @@ addLayoutComponent(Component component, Object constraints)
/*************************************************************************/
/**
- * Adds a component to the layout in the specified constraint position,
- * which must be one of the string constants defined in this class.
- *
- * @param constraints The constraint string.
- * @param component The component to add.
- *
- * @exception IllegalArgumentException If the constraint object is not
- * one of the specified constants in this class.
- *
- * @deprecated This method is deprecated in favor of
- * <code>addLayoutComponent(Component, Object)</code>.
- */
-public void
-addLayoutComponent(String constraints, Component component)
-{
- addLayoutComponent(component, constraints);
-}
-
-/*************************************************************************/
-
-/**
* Removes the specified component from the layout.
*
* @param component The component to remove from the layout.
@@ -637,7 +637,7 @@ private static final int PREF = 2;
private Dimension
calcCompSize(Component comp, int what)
{
- if (comp == null)
+ if (comp == null || !comp.isVisible())
return new Dimension(0, 0);
if (what == MIN)
return comp.getMinimumSize();
diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java
index e4085e5f61e..a521c8e4f3d 100644
--- a/libjava/java/awt/Button.java
+++ b/libjava/java/awt/Button.java
@@ -148,6 +148,7 @@ public synchronized void
setLabel(String label)
{
this.label = label;
+ actionCommand = label;
if (peer != null)
{
ButtonPeer bp = (ButtonPeer) peer;
diff --git a/libjava/java/awt/CardLayout.java b/libjava/java/awt/CardLayout.java
index 1900a6094e2..c3c9f5381d5 100644
--- a/libjava/java/awt/CardLayout.java
+++ b/libjava/java/awt/CardLayout.java
@@ -90,7 +90,7 @@ public class CardLayout implements LayoutManager2, Serializable
if (! (constraints instanceof String))
throw new IllegalArgumentException ("Object " + constraints
+ " is not a string");
- tab.put (constraints, comp);
+ addLayoutComponent ((String) constraints, comp);
}
/** Add a new component to the layout. The name can be used later
@@ -102,7 +102,7 @@ public class CardLayout implements LayoutManager2, Serializable
*/
public void addLayoutComponent (String name, Component comp)
{
- addLayoutComponent (comp, name);
+ tab.put (name, comp);
}
/** Cause the first component in the container to be displayed.
diff --git a/libjava/java/awt/CheckboxGroup.java b/libjava/java/awt/CheckboxGroup.java
index 64d01951dbf..52af1903a9c 100644
--- a/libjava/java/awt/CheckboxGroup.java
+++ b/libjava/java/awt/CheckboxGroup.java
@@ -95,8 +95,8 @@ CheckboxGroup()
public Checkbox
getSelectedCheckbox()
{
- return(selectedCheckbox);
-}
+ return getCurrent ();
+}
/*************************************************************************/
@@ -126,17 +126,7 @@ getCurrent()
public void
setSelectedCheckbox(Checkbox selectedCheckbox)
{
- if (this.selectedCheckbox != null)
- {
- if (this.selectedCheckbox.getCheckboxGroup() != this)
- return;
-
- this.selectedCheckbox.setState(false);
- }
-
- this.selectedCheckbox = selectedCheckbox;
- if (selectedCheckbox != null)
- selectedCheckbox.setState(true);
+ setCurrent (selectedCheckbox);
}
/*************************************************************************/
@@ -153,7 +143,17 @@ setSelectedCheckbox(Checkbox selectedCheckbox)
public void
setCurrent(Checkbox selectedCheckbox)
{
- setSelectedCheckbox(selectedCheckbox);
+ if (this.selectedCheckbox != null)
+ {
+ if (this.selectedCheckbox.getCheckboxGroup() != this)
+ return;
+
+ this.selectedCheckbox.setState(false);
+ }
+
+ this.selectedCheckbox = selectedCheckbox;
+ if (selectedCheckbox != null)
+ selectedCheckbox.setState(true);
}
/*************************************************************************/
diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java
index d1f601f777d..b2b597ed06f 100644
--- a/libjava/java/awt/Choice.java
+++ b/libjava/java/awt/Choice.java
@@ -111,7 +111,7 @@ private ItemListener item_listeners;
public int
getItemCount()
{
- return(pItems.size());
+ return countItems ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
index b440c510df8..3d2afc9c78b 100644
--- a/libjava/java/awt/Component.java
+++ b/libjava/java/awt/Component.java
@@ -779,9 +779,7 @@ public abstract class Component
*/
public void setEnabled(boolean b)
{
- this.enabled = b;
- if (peer != null)
- peer.setEnabled(b);
+ enable (b);
}
/**
@@ -791,7 +789,9 @@ public abstract class Component
*/
public void enable()
{
- setEnabled(true);
+ this.enabled = true;
+ if (peer != null)
+ peer.setEnabled (true);
}
/**
@@ -802,7 +802,10 @@ public abstract class Component
*/
public void enable(boolean b)
{
- setEnabled(b);
+ if (b)
+ enable ();
+ else
+ disable ();
}
/**
@@ -812,7 +815,9 @@ public abstract class Component
*/
public void disable()
{
- setEnabled(false);
+ this.enabled = false;
+ if (peer != null)
+ peer.setEnabled (false);
}
/**
@@ -856,10 +861,7 @@ public abstract class Component
// Inspection by subclassing shows that Sun's implementation calls
// show(boolean) which then calls show() or hide(). It is the show()
// method that is overriden in subclasses like Window.
- if (b)
- show();
- else
- hide();
+ show (b);
}
/**
@@ -877,6 +879,7 @@ public abstract class Component
this.visible = true;
if (peer != null)
peer.setVisible(true);
+ invalidate();
}
/**
@@ -887,7 +890,10 @@ public abstract class Component
*/
public void show(boolean b)
{
- setVisible(b);
+ if (b)
+ show ();
+ else
+ hide ();
}
/**
@@ -900,6 +906,7 @@ public abstract class Component
if (peer != null)
peer.setVisible(false);
this.visible = false;
+ invalidate();
}
/**
@@ -996,7 +1003,11 @@ public abstract class Component
{
if (font != null)
return font;
- return parent == null ? null : parent.getFont();
+
+ if (parent != null)
+ return parent.getFont ();
+ else
+ return new Font ("Fixed", Font.PLAIN, 12);
}
/**
@@ -1083,7 +1094,7 @@ public abstract class Component
*/
public Point getLocation()
{
- return new Point(x, y);
+ return location ();
}
/**
@@ -1110,7 +1121,7 @@ public abstract class Component
*/
public Point location()
{
- return getLocation();
+ return new Point (x, y);
}
/**
@@ -1125,13 +1136,7 @@ public abstract class Component
*/
public void setLocation(int x, int y)
{
- if (this.x == x && this.y == y)
- return;
- invalidate();
- this.x = x;
- this.y = y;
- if (peer != null)
- peer.setBounds(x, y, width, height);
+ move (x, y);
}
/**
@@ -1145,7 +1150,13 @@ public abstract class Component
*/
public void move(int x, int y)
{
- setLocation(x, y);
+ if (this.x == x && this.y == y)
+ return;
+ invalidate ();
+ this.x = x;
+ this.y = y;
+ if (peer != null)
+ peer.setBounds (x, y, width, height);
}
/**
@@ -1173,7 +1184,7 @@ public abstract class Component
*/
public Dimension getSize()
{
- return new Dimension(width, height);
+ return size ();
}
/**
@@ -1184,7 +1195,7 @@ public abstract class Component
*/
public Dimension size()
{
- return getSize();
+ return new Dimension (width, height);
}
/**
@@ -1197,13 +1208,7 @@ public abstract class Component
*/
public void setSize(int width, int height)
{
- if (this.width == width && this.height == height)
- return;
- invalidate();
- this.width = width;
- this.height = height;
- if (peer != null)
- peer.setBounds(x, y, width, height);
+ resize (width, height);
}
/**
@@ -1215,7 +1220,13 @@ public abstract class Component
*/
public void resize(int width, int height)
{
- setSize(width, height);
+ if (this.width == width && this.height == height)
+ return;
+ invalidate ();
+ this.width = width;
+ this.height = height;
+ if (peer != null)
+ peer.setBounds (x, y, width, height);
}
/**
@@ -1229,7 +1240,7 @@ public abstract class Component
*/
public void setSize(Dimension d)
{
- setSize(d.width, d.height);
+ resize (d);
}
/**
@@ -1241,7 +1252,7 @@ public abstract class Component
*/
public void resize(Dimension d)
{
- setSize(d.width, d.height);
+ resize (d.width, d.height);
}
/**
@@ -1256,7 +1267,7 @@ public abstract class Component
*/
public Rectangle getBounds()
{
- return new Rectangle(x, y, width, height);
+ return bounds ();
}
/**
@@ -1269,7 +1280,7 @@ public abstract class Component
*/
public Rectangle bounds()
{
- return getBounds();
+ return new Rectangle (x, y, width, height);
}
/**
@@ -1289,15 +1300,7 @@ public abstract class Component
*/
public void setBounds(int x, int y, int w, int h)
{
- if (this.x == x && this.y == y && width == w && height == h)
- return;
- invalidate();
- this.x = x;
- this.y = y;
- width = w;
- height = h;
- if (peer != null)
- peer.setBounds(x, y, w, h);
+ reshape (x, y, w, h);
}
/**
@@ -1306,13 +1309,22 @@ public abstract class Component
*
* @param x the X coordinate of the upper left corner of the rectangle
* @param y the Y coordinate of the upper left corner of the rectangle
- * @param w the width of the rectangle
- * @param h the height of the rectangle
+ * @param width the width of the rectangle
+ * @param height the height of the rectangle
* @deprecated use {@link #setBounds(int, int, int, int)} instead
*/
public void reshape(int x, int y, int width, int height)
{
- setBounds(x, y, width, height);
+ if (this.x == x && this.y == y
+ && this.width == width && this.height == height)
+ return;
+ invalidate ();
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ if (peer != null)
+ peer.setBounds (x, y, width, height);
}
/**
@@ -1329,7 +1341,7 @@ public abstract class Component
*/
public void setBounds(Rectangle r)
{
- setBounds(r.x, r.y, r.width, r.height);
+ setBounds (r.x, r.y, r.width, r.height);
}
/**
@@ -1560,7 +1572,7 @@ public abstract class Component
*/
public void doLayout()
{
- // nothing to do unless we're a container
+ layout ();
}
/**
@@ -1571,7 +1583,7 @@ public abstract class Component
*/
public void layout()
{
- doLayout();
+ // Nothing to do unless we're a container.
}
/**
@@ -1702,6 +1714,9 @@ public abstract class Component
*/
public void paint(Graphics g)
{
+ // Paint the heavyweight peer
+ if (!isLightweight() && peer != null)
+ peer.paint(g);
}
/**
@@ -1719,6 +1734,15 @@ public abstract class Component
*/
public void update(Graphics g)
{
+ if (!isLightweight())
+ {
+ Rectangle clip = g.getClipBounds();
+ if (clip == null)
+ g.clearRect(0, 0, width, height);
+ else
+ g.clearRect(clip.x, clip.y, clip.width, clip.height);
+ }
+
paint(g);
}
@@ -1732,8 +1756,6 @@ public abstract class Component
{
if (! visible)
return;
- if (peer != null)
- peer.paint(g);
paint(g);
}
@@ -2066,7 +2088,7 @@ public abstract class Component
*/
public boolean contains(int x, int y)
{
- return x >= 0 && y >= 0 && x < width && y < height;
+ return inside (x, y);
}
/**
@@ -2080,7 +2102,7 @@ public abstract class Component
*/
public boolean inside(int x, int y)
{
- return contains(x, y);
+ return x >= 0 && y >= 0 && x < width && y < height;
}
/**
@@ -2095,7 +2117,7 @@ public abstract class Component
*/
public boolean contains(Point p)
{
- return contains(p.x, p.y);
+ return contains (p.x, p.y);
}
/**
@@ -2110,7 +2132,7 @@ public abstract class Component
*/
public Component getComponentAt(int x, int y)
{
- return contains(x, y) ? this : null;
+ return locate (x, y);
}
/**
@@ -2125,7 +2147,7 @@ public abstract class Component
*/
public Component locate(int x, int y)
{
- return getComponentAt(x, y);
+ return contains (x, y) ? this : null;
}
/**
@@ -2141,7 +2163,7 @@ public abstract class Component
*/
public Component getComponentAt(Point p)
{
- return getComponentAt(p.x, p.y);
+ return getComponentAt (p.x, p.y);
}
/**
@@ -2787,8 +2809,6 @@ public abstract class Component
if (e instanceof FocusEvent)
processFocusEvent((FocusEvent) e);
- else if (e instanceof PaintEvent)
- processPaintEvent((PaintEvent) e);
else if (e instanceof MouseWheelEvent)
processMouseWheelEvent((MouseWheelEvent) e);
else if (e instanceof MouseEvent)
@@ -4225,42 +4245,6 @@ p * <li>the set of backward traversal keys
}
/**
- * Does the work for a paint event.
- *
- * @param event the event to process
- */
- private void processPaintEvent(PaintEvent event)
- {
- // Can't do graphics without peer
- if (peer == null)
- return;
-
- Graphics gfx = getGraphics();
- try
- {
- Shape clip = event.getUpdateRect();
- gfx.setClip(clip);
-
- switch (event.id)
- {
- case PaintEvent.PAINT:
- paint(gfx);
- break;
- case PaintEvent.UPDATE:
- update(gfx);
- break;
- default:
- throw new IllegalArgumentException("unknown paint event");
- }
- event.consume ();
- }
- finally
- {
- gfx.dispose();
- }
- }
-
- /**
* This method is used to implement transferFocus(). CHILD is the child
* making the request. This is overridden by Container; when called for an
* ordinary component there is no child and so we always return null.
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index 5d176beef77..ff1dde1eae4 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -52,6 +52,7 @@ import java.io.Serializable;
import java.util.EventListener;
import java.util.Set;
import javax.accessibility.Accessible;
+import javax.swing.SwingUtilities;
/**
* A generic window toolkit object that acts as a container for other objects.
@@ -106,7 +107,7 @@ public class Container extends Component
*/
public int getComponentCount()
{
- return ncomponents;
+ return countComponents ();
}
/**
@@ -118,7 +119,7 @@ public class Container extends Component
*/
public int countComponents()
{
- return getComponentCount();
+ return ncomponents;
}
/**
@@ -186,10 +187,7 @@ public class Container extends Component
*/
public Insets getInsets()
{
- if (peer == null)
- return new Insets(0, 0, 0, 0);
-
- return ((ContainerPeer) peer).getInsets();
+ return insets ();
}
/**
@@ -201,7 +199,10 @@ public class Container extends Component
*/
public Insets insets()
{
- return getInsets();
+ if (peer == null)
+ return new Insets (0, 0, 0, 0);
+
+ return ((ContainerPeer) peer).getInsets ();
}
/**
@@ -463,8 +464,7 @@ public class Container extends Component
*/
public void doLayout()
{
- if (layoutMgr != null)
- layoutMgr.layoutContainer(this);
+ layout ();
}
/**
@@ -474,7 +474,8 @@ public class Container extends Component
*/
public void layout()
{
- doLayout();
+ if (layoutMgr != null)
+ layoutMgr.layoutContainer (this);
}
/**
@@ -555,7 +556,7 @@ public class Container extends Component
*/
public Dimension getPreferredSize()
{
- return preferredSize();
+ return preferredSize ();
}
/**
@@ -567,10 +568,10 @@ public class Container extends Component
*/
public Dimension preferredSize()
{
- if (layoutMgr != null)
- return layoutMgr.preferredLayoutSize(this);
- else
- return super.preferredSize();
+ if (layoutMgr != null)
+ return layoutMgr.preferredLayoutSize (this);
+ else
+ return super.preferredSize ();
}
/**
@@ -580,7 +581,7 @@ public class Container extends Component
*/
public Dimension getMinimumSize()
{
- return minimumSize();
+ return minimumSize ();
}
/**
@@ -592,10 +593,10 @@ public class Container extends Component
*/
public Dimension minimumSize()
{
- if (layoutMgr != null)
- return layoutMgr.minimumLayoutSize(this);
- else
- return super.minimumSize();
+ if (layoutMgr != null)
+ return layoutMgr.minimumLayoutSize (this);
+ else
+ return super.minimumSize ();
}
/**
@@ -663,8 +664,9 @@ public class Container extends Component
{
if (!isShowing())
return;
- super.paint(g);
- visitChildren(g, GfxPaintVisitor.INSTANCE, true);
+ // Visit heavyweights as well, in case they were
+ // erased when we cleared the background for this container.
+ visitChildren(g, GfxPaintVisitor.INSTANCE, false);
}
/**
@@ -678,11 +680,6 @@ public class Container extends Component
*/
public void update(Graphics g)
{
- Rectangle clip = g.getClipBounds();
- if (clip == null)
- g.clearRect(0, 0, width, height);
- else
- g.clearRect(clip.x, clip.y, clip.width, clip.height);
super.update(g);
}
@@ -837,23 +834,7 @@ public class Container extends Component
*/
public Component getComponentAt(int x, int y)
{
- synchronized (getTreeLock ())
- {
- if (! contains(x, y))
- return null;
- for (int i = 0; i < ncomponents; ++i)
- {
- // Ignore invisible children...
- if (!component[i].isVisible())
- continue;
-
- int x2 = x - component[i].x;
- int y2 = y - component[i].y;
- if (component[i].contains(x2, y2))
- return component[i];
- }
- return this;
- }
+ return locate (x, y);
}
/**
@@ -873,7 +854,23 @@ public class Container extends Component
*/
public Component locate(int x, int y)
{
- return getComponentAt(x, y);
+ synchronized (getTreeLock ())
+ {
+ if (!contains (x, y))
+ return null;
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ // Ignore invisible children...
+ if (!component[i].isVisible ())
+ continue;
+
+ int x2 = x - component[i].x;
+ int y2 = y - component[i].y;
+ if (component[i].contains (x2, y2))
+ return component[i];
+ }
+ return this;
+ }
}
/**
@@ -890,7 +887,7 @@ public class Container extends Component
*/
public Component getComponentAt(Point p)
{
- return getComponentAt(p.x, p.y);
+ return getComponentAt (p.x, p.y);
}
public Component findComponentAt(int x, int y)
@@ -1204,8 +1201,12 @@ public class Container extends Component
for (int i = ncomponents - 1; i >= 0; --i)
{
Component comp = component[i];
+ // If we're visiting heavyweights as well,
+ // don't recurse into Containers here. This avoids
+ // painting the same nested child multiple times.
boolean applicable = comp.isVisible()
- && (comp.isLightweight() || !lightweightOnly);
+ && (comp.isLightweight()
+ || !lightweightOnly && ! (comp instanceof Container));
if (applicable)
visitChild(gfx, visitor, comp);
@@ -1541,54 +1542,59 @@ class LightweightDispatcher implements Serializable
nativeContainer = c;
}
- void dispose()
- {
- }
-
void enableEvents(long l)
{
eventMask |= l;
}
- void mouseExit (MouseEvent me, int x, int y)
- {
- }
-
- void acquireComponentForMouseEvent (MouseEvent me)
+ void acquireComponentForMouseEvent(MouseEvent me)
{
int x = me.getX ();
int y = me.getY ();
-
Component candidate = mouseEventTarget;
-
- boolean candidate_is_container_with_children =
- ((candidate != null)
- && (candidate instanceof Container)
- && (((Container)candidate).getComponentCount () > 0));
-
- boolean candidate_does_not_contain_point =
- ((candidate != null)
- && (! candidate.contains (x - candidate.getX (),
- y - candidate.getY ())));
-
- if (candidate == null
- || candidate_is_container_with_children
- || candidate_does_not_contain_point)
+
+ while(candidate != null)
+ {
+ if (candidate.isShowing())
+ {
+ // Convert our point to the candidate's parent's space.
+ Point cp = SwingUtilities.convertPoint(nativeContainer, x, y, candidate);
+
+ // If the event lands inside candidate, we have a hit.
+ if (candidate.contains(cp.x, cp.y))
+ {
+ // If candidate has children, we refine the hit.
+ if (candidate instanceof Container &&
+ ((Container)candidate).getComponentCount() > 0)
+ candidate = SwingUtilities.getDeepestComponentAt(candidate, cp.x, cp.y);
+ break;
+ }
+ }
+ // If candidate isn't showing or doesn't contain point, we back out a level.
+ candidate = candidate.getParent();
+ }
+
+ if (candidate == null)
{
- // Try to reacquire.
- candidate = nativeContainer.findComponentAt (x, y);
+ // We either lost, or never had, a candidate; acquire from our native.
+ candidate =
+ SwingUtilities.getDeepestComponentAt(nativeContainer, x, y);
}
+
+ // If our candidate is new, inform the old target we're leaving.
if (mouseEventTarget != null
+ && mouseEventTarget.isShowing()
&& mouseEventTarget != candidate)
{
- int nx = x - mouseEventTarget.getX ();
- int ny = y - mouseEventTarget.getY ();
+ Point tp =
+ SwingUtilities.convertPoint(nativeContainer,
+ x, y, mouseEventTarget);
MouseEvent exited = new MouseEvent (mouseEventTarget,
MouseEvent.MOUSE_EXITED,
me.getWhen (),
me.getModifiers (),
- nx, ny,
+ tp.x, tp.y,
me.getClickCount (),
me.isPopupTrigger (),
me.getButton ());
@@ -1596,25 +1602,22 @@ class LightweightDispatcher implements Serializable
mouseEventTarget = null;
}
+ // If we have a candidate, maybe enter it.
if (candidate != null)
{
- // Possibly set new state.
if (candidate.isLightweight()
+ && candidate.isShowing()
&& candidate != nativeContainer
&& candidate != mouseEventTarget)
- {
-
+ {
mouseEventTarget = candidate;
-
- int nx = x - mouseEventTarget.getX ();
- int ny = y - mouseEventTarget.getY ();
-
- // If acquired, enter it.
+ Point cp = SwingUtilities.convertPoint(nativeContainer,
+ x, y, candidate);
MouseEvent entered = new MouseEvent (mouseEventTarget,
MouseEvent.MOUSE_ENTERED,
me.getWhen (),
me.getModifiers (),
- nx, ny,
+ cp.x, cp.y,
me.getClickCount (),
me.isPopupTrigger (),
me.getButton ());
@@ -1623,39 +1626,32 @@ class LightweightDispatcher implements Serializable
}
}
- boolean handleEvent (AWTEvent e)
+ boolean handleEvent(AWTEvent e)
{
- if ((eventMask & e.getID ()) == 0)
+ if ((eventMask & e.getID()) == 0)
return false;
if (e instanceof MouseEvent)
{
MouseEvent me = (MouseEvent) e;
- acquireComponentForMouseEvent (me);
+ acquireComponentForMouseEvent(me);
- // Avoid dispatching an ENTERED event twice
+ // Avoid dispatching an ENTERED event twice.
if (mouseEventTarget != null
+ && mouseEventTarget.isShowing()
&& e.getID() != MouseEvent.MOUSE_ENTERED)
{
- // Calculate point translation for the event target.
- // We use absolute location on screen rather than relative
- // location because the event target might be a nested child.
- Point parentLocation = nativeContainer.getLocationOnScreen();
- Point childLocation = mouseEventTarget.getLocationOnScreen();
- me.translatePoint(parentLocation.x - childLocation.x,
- parentLocation.y - childLocation.y);
-
- Component oldSource = (Component) me.getSource ();
- me.setSource (mouseEventTarget);
- mouseEventTarget.dispatchEvent (me);
- me.setSource (oldSource);
+ MouseEvent newEvt =
+ SwingUtilities.convertMouseEvent(nativeContainer, me,
+ mouseEventTarget);
+ mouseEventTarget.dispatchEvent(newEvt);
}
}
else if (e instanceof KeyEvent && focus != null)
{
- focus.processKeyEvent ((KeyEvent) e);
+ focus.processKeyEvent((KeyEvent) e);
}
-
+
return e.isConsumed();
}
diff --git a/libjava/java/awt/FontMetrics.java b/libjava/java/awt/FontMetrics.java
index ce340dadbe6..a7f76e03ae7 100644
--- a/libjava/java/awt/FontMetrics.java
+++ b/libjava/java/awt/FontMetrics.java
@@ -195,7 +195,7 @@ getMaxAscent()
public int
getMaxDescent()
{
- return(getDescent());
+ return getMaxDecent ();
}
/*************************************************************************/
@@ -212,7 +212,7 @@ getMaxDescent()
public int
getMaxDecent()
{
- return(getMaxDescent());
+ return getDescent ();
}
/*************************************************************************/
diff --git a/libjava/java/awt/Frame.java b/libjava/java/awt/Frame.java
index 7a5c9d98f8e..c92585a6f6b 100644
--- a/libjava/java/awt/Frame.java
+++ b/libjava/java/awt/Frame.java
@@ -341,11 +341,15 @@ getMenuBar()
public synchronized void
setMenuBar(MenuBar menuBar)
{
- this.menuBar = menuBar;
- if (menuBar != null)
- menuBar.addNotify();
if (peer != null)
+ {
+ if (this.menuBar != null)
+ this.menuBar.removeNotify();
+ if (menuBar != null)
+ menuBar.addNotify();
((FramePeer) peer).setMenuBar(menuBar);
+ }
+ this.menuBar = menuBar;
}
/*************************************************************************/
@@ -432,11 +436,20 @@ remove(MenuComponent menu)
public void
addNotify()
{
+ if (menuBar != null)
+ menuBar.addNotify();
if (peer == null)
peer = getToolkit ().createFrame (this);
super.addNotify();
}
+public void removeNotify()
+{
+ if (menuBar != null)
+ menuBar.removeNotify();
+ super.removeNotify();
+}
+
/*************************************************************************/
/**
diff --git a/libjava/java/awt/GridBagLayout.java b/libjava/java/awt/GridBagLayout.java
index 7572c1d1d56..5b009de6fb5 100644
--- a/libjava/java/awt/GridBagLayout.java
+++ b/libjava/java/awt/GridBagLayout.java
@@ -40,6 +40,7 @@ package java.awt;
import java.io.Serializable;
import java.util.Hashtable;
+import java.util.HashMap;
/**
* @author Michael Koch <konqueror@gmx.de>
@@ -54,7 +55,14 @@ public class GridBagLayout
protected static final int PREFERREDSIZE = 2;
protected static final int MAXGRIDSIZE = 512;
+ // comptable remembers the original contraints given to us.
+ // internalcomptable is used to keep track of modified constraint values
+ // that we calculate, particularly when we are given RELATIVE and
+ // REMAINDER constraints.
+ // Constraints kept in comptable are never modified, and constraints
+ // kept in internalcomptable can be modified internally only.
protected Hashtable comptable;
+ private Hashtable internalcomptable;
protected GridBagLayoutInfo layoutInfo;
protected GridBagConstraints defaultConstraints;
@@ -66,6 +74,7 @@ public class GridBagLayout
public GridBagLayout ()
{
this.comptable = new Hashtable();
+ this.internalcomptable = new Hashtable();
this.defaultConstraints= new GridBagConstraints();
}
@@ -149,7 +158,7 @@ public class GridBagLayout
public void layoutContainer (Container parent)
{
- arrangeGrid (parent);
+ arrangeGrid (parent);
}
public float getLayoutAlignmentX (Container target)
@@ -213,6 +222,20 @@ public class GridBagLayout
return result;
}
+ private GridBagConstraints lookupInternalConstraints (Component component)
+ {
+ GridBagConstraints result =
+ (GridBagConstraints) internalcomptable.get (component);
+
+ if (result == null)
+ {
+ result = (GridBagConstraints) lookupConstraints(component).clone();
+ internalcomptable.put (component, result);
+ }
+
+ return result;
+ }
+
/**
* @since 1.1
*/
@@ -302,7 +325,8 @@ public class GridBagLayout
*/
protected void AdjustForGravity (GridBagConstraints gbc, Rectangle rect)
{
- adjustForGravity (gbc, rect);
+ // FIXME
+ throw new Error ("Not implemented");
}
/**
@@ -310,7 +334,116 @@ public class GridBagLayout
*/
protected void ArrangeGrid (Container parent)
{
- arrangeGrid (parent);
+ Component[] components = parent.getComponents();
+
+ if (components.length == 0)
+ return;
+
+ GridBagLayoutInfo info = getLayoutInfo (parent, MINSIZE);
+ if (info.cols == 0 && info.rows == 0)
+ return;
+ layoutInfo = info;
+
+ // DEBUG
+ //dumpLayoutInfo (layoutInfo);
+
+ for(int i = 0; i < components.length; i++)
+ {
+ Component component = components [i];
+
+ // If component is not visible we dont have to care about it.
+ if (!component.isVisible())
+ continue;
+
+ GridBagConstraints constraints =
+ lookupInternalConstraints(component);
+
+ int cellx = sumIntArray(layoutInfo.colWidths, constraints.gridx);
+ int celly = sumIntArray(layoutInfo.rowHeights, constraints.gridy);
+ int cellw = sumIntArray(layoutInfo.colWidths,
+ constraints.gridx + constraints.gridwidth) - cellx;
+ int cellh = sumIntArray(layoutInfo.rowHeights,
+ constraints.gridy + constraints.gridheight) - celly;
+
+ Insets insets = constraints.insets;
+ if (insets != null)
+ {
+ cellx += insets.left;
+ celly += insets.top;
+ cellw -= insets.left + insets.right;
+ cellh -= insets.top + insets.bottom;
+ }
+
+ Dimension dim = component.getPreferredSize();
+
+ // Note: Documentation says that padding is added on both sides, but
+ // visual inspection shows that the Sun implementation only adds it
+ // once, so we do the same.
+ dim.width += constraints.ipadx;
+ dim.height += constraints.ipady;
+
+ switch(constraints.fill)
+ {
+ case GridBagConstraints.HORIZONTAL:
+ dim.width = cellw;
+ break;
+ case GridBagConstraints.VERTICAL:
+ dim.height = cellh;
+ break;
+ case GridBagConstraints.BOTH:
+ dim.width = cellw;
+ dim.height = cellh;
+ break;
+ }
+
+ int x;
+ int y;
+
+ switch(constraints.anchor)
+ {
+ case GridBagConstraints.NORTH:
+ x = cellx + (cellw - dim.width) / 2;
+ y = celly;
+ break;
+ case GridBagConstraints.SOUTH:
+ x = cellx + (cellw - dim.width) / 2;
+ y = celly + cellh - dim.height;
+ break;
+ case GridBagConstraints.WEST:
+ x = cellx;
+ y = celly + (cellh - dim.height) / 2;
+ break;
+ case GridBagConstraints.EAST:
+ x = cellx + cellw - dim.width;
+ y = celly + (cellh - dim.height) / 2;
+ break;
+ case GridBagConstraints.NORTHEAST:
+ x = cellx + cellw - dim.width;
+ y = celly;
+ break;
+ case GridBagConstraints.NORTHWEST:
+ x = cellx;
+ y = celly;
+ break;
+ case GridBagConstraints.SOUTHEAST:
+ x = cellx + cellw - dim.width;
+ y = celly + cellh - dim.height;
+ break;
+ case GridBagConstraints.SOUTHWEST:
+ x = cellx;
+ y = celly + cellh - dim.height;
+ break;
+ default:
+ x = cellx + (cellw - dim.width) / 2;
+ y = celly + (cellh - dim.height) / 2;
+ break;
+ }
+
+ component.setBounds(layoutInfo.pos_x + x, layoutInfo.pos_y + y, dim.width, dim.height);
+ }
+
+ // DEBUG
+ //dumpLayoutInfo (layoutInfo);
}
/**
@@ -318,7 +451,378 @@ public class GridBagLayout
*/
protected GridBagLayoutInfo GetLayoutInfo (Container parent, int sizeflag)
{
- return getLayoutInfo (parent, sizeflag);
+ if (sizeflag != MINSIZE && sizeflag != PREFERREDSIZE)
+ throw new IllegalArgumentException();
+
+ Dimension parentDim = parent.getSize ();
+ Insets parentInsets = parent.getInsets ();
+ parentDim.width -= parentInsets.left + parentInsets.right;
+ parentDim.height -= parentInsets.top + parentInsets.bottom;
+
+ int current_y = 0;
+ int max_x = 0;
+ int max_y = 0;
+
+ // Guaranteed to contain the last component added to the given row
+ // or column, whose gridwidth/height is not REMAINDER.
+ HashMap lastInRow = new HashMap();
+ HashMap lastInCol = new HashMap();
+
+ // STEP 1: first we figure out how many rows/columns
+ Component[] components = parent.getComponents();
+ for (int i = 0; i < components.length; i++)
+ {
+ Component component = components [i];
+
+ // If component is not visible we dont have to care about it.
+ if (!component.isVisible())
+ continue;
+
+ // When looking up the constraint for the first time, check the
+ // original unmodified constraint. After the first time, always
+ // refer to the internal modified constraint.
+ GridBagConstraints originalConstraints = lookupConstraints (component);
+ GridBagConstraints constraints = (GridBagConstraints) originalConstraints.clone();
+ internalcomptable.put(component, constraints);
+
+ // Cases:
+ //
+ // 1. gridy == RELATIVE, gridx == RELATIVE
+ //
+ // use y as the row number; check for the next
+ // available slot at row y
+ //
+ // 2. only gridx == RELATIVE
+ //
+ // check for the next available slot at row gridy
+ //
+ // 3. only gridy == RELATIVE
+ //
+ // check for the next available slot at column gridx
+ //
+ // 4. neither gridx or gridy == RELATIVE
+ //
+ // nothing to check; just add it
+
+
+ // cases 1 and 2
+ if(constraints.gridx == GridBagConstraints.RELATIVE)
+ {
+ if (constraints.gridy == GridBagConstraints.RELATIVE)
+ constraints.gridy = current_y;
+
+ int x;
+
+ // Check the component that occupies the right-most spot in this
+ // row. We want to add this component after it.
+ // If this row is empty, add to the 0 position.
+ if (!lastInRow.containsKey(new Integer(constraints.gridy)))
+ x = 0;
+ else
+ {
+ Component lastComponent = (Component) lastInRow.get(new Integer(constraints.gridy));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+ x = lastConstraints.gridx + Math.max(1, lastConstraints.gridwidth);
+ }
+
+ // Determine if this component will fit in the slot vertically.
+ // If not, bump it over to where it does fit.
+ for (int y = constraints.gridy + 1; y < constraints.gridy + Math.max(1, constraints.gridheight); y++)
+ {
+ if (lastInRow.containsKey(new Integer(y)))
+ {
+ Component lastComponent = (Component) lastInRow.get(new Integer(y));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+ x = Math.max (x,
+ lastConstraints.gridx + Math.max(1, lastConstraints.gridwidth));
+ }
+ }
+
+ constraints.gridx = x;
+ }
+ // case 3
+ else if(constraints.gridy == GridBagConstraints.RELATIVE)
+ {
+ int y;
+ // Check the component that occupies the bottom-most spot in
+ // this column. We want to add this component below it.
+ // If this column is empty, add to the 0 position.
+ if (!lastInCol.containsKey(new Integer(constraints.gridx)))
+ y = 0;
+ else
+ {
+ Component lastComponent = (Component)lastInCol.get(new Integer(constraints.gridx));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+ y = lastConstraints.gridy + Math.max(1, lastConstraints.gridheight);
+ }
+
+ // Determine if this component will fit in the slot horizontally.
+ // If not, bump it down to where it does fit.
+ for (int x = constraints.gridx + 1; x < constraints.gridx + Math.max(1, constraints.gridwidth); x++)
+ {
+ if (lastInCol.containsKey(new Integer(x)))
+ {
+ Component lastComponent = (Component) lastInCol.get(new Integer(x));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+ y = Math.max (y,
+ lastConstraints.gridy + Math.max(1, lastConstraints.gridheight));
+ }
+ }
+
+ constraints.gridy = y;
+ }
+ // case 4: do nothing
+
+ max_x = Math.max(max_x,
+ constraints.gridx + Math.max(1, constraints.gridwidth));
+ max_y = Math.max(max_y,
+ constraints.gridy + Math.max(1, constraints.gridheight));
+
+ // Update our reference points for RELATIVE gridx and gridy.
+ if(constraints.gridwidth == GridBagConstraints.REMAINDER)
+ {
+ current_y = constraints.gridy + Math.max(1, constraints.gridheight);
+ }
+ else if (constraints.gridwidth != GridBagConstraints.REMAINDER)
+ {
+ for (int y = constraints.gridy; y < constraints.gridy + Math.max(1, constraints.gridheight); y++)
+ {
+ if(lastInRow.containsKey(new Integer(y)))
+ {
+ Component lastComponent = (Component) lastInRow.get(new Integer(y));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+ if (constraints.gridx > lastConstraints.gridx)
+ {
+ lastInRow.put(new Integer(y), component);
+ }
+ }
+ else
+ {
+ lastInRow.put(new Integer(y), component);
+ }
+ }
+
+ for (int x = constraints.gridx; x < constraints.gridx + Math.max(1, constraints.gridwidth); x++)
+ {
+ if(lastInCol.containsKey(new Integer(x)))
+ {
+ Component lastComponent = (Component) lastInCol.get(new Integer(x));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+ if (constraints.gridy > lastConstraints.gridy)
+ {
+ lastInCol.put(new Integer(x), component);
+ }
+ }
+ else
+ {
+ lastInCol.put(new Integer(x), component);
+ }
+ }
+ }
+ } // end of STEP 1
+
+ boolean[] colIsOccupied = new boolean[max_x];
+ boolean[] rowIsOccupied = new boolean[max_y];
+
+ // STEP 2: Determine which cells the components occupy.
+ for (int i = 0; i < components.length; i++)
+ {
+ Component component = components [i];
+
+ // If component is not visible we dont have to care about it.
+ if (!component.isVisible())
+ continue;
+
+ GridBagConstraints constraints = lookupInternalConstraints (component);
+
+ // Fix up any REMAINDER and RELATIVE cells.
+ if(constraints.gridwidth == GridBagConstraints.REMAINDER)
+ {
+ for (int y = constraints.gridy; y < constraints.gridy + Math.max(1, constraints.gridheight); y++)
+ {
+ if (lastInRow.containsKey(new Integer(y)))
+ {
+ Component lastComponent = (Component) lastInRow.get(new Integer(y));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+
+ if (lastConstraints.gridwidth == GridBagConstraints.RELATIVE)
+ {
+ constraints.gridx = max_x - 1;
+ break;
+ }
+ else
+ {
+ constraints.gridx = Math.max (constraints.gridx,
+ lastConstraints.gridx + Math.max (1, lastConstraints.gridwidth));
+ }
+ }
+ }
+ constraints.gridwidth = max_x - constraints.gridx;
+ }
+ else if (constraints.gridwidth == GridBagConstraints.RELATIVE)
+ {
+ constraints.gridwidth = max_x - constraints.gridx - 1;
+ }
+
+ if(constraints.gridheight == GridBagConstraints.REMAINDER)
+ {
+ for (int x = constraints.gridx; x < constraints.gridx + Math.max(1, constraints.gridwidth); x++)
+ {
+ if (lastInCol.containsKey(new Integer(x)))
+ {
+ Component lastComponent = (Component) lastInRow.get(new Integer(x));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+
+ if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
+ {
+ constraints.gridy = max_y - 1;
+ break;
+ }
+ else
+ {
+ constraints.gridy = Math.max (constraints.gridy,
+ lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
+ }
+ }
+ }
+ constraints.gridheight = max_y - constraints.gridy;
+ }
+ else if (constraints.gridheight == GridBagConstraints.RELATIVE)
+ {
+ constraints.gridheight = max_y - constraints.gridy - 1;
+ }
+
+ // For now, a row or a column is "occupied" iff a component
+ // both begins and ends in that row or column.
+ if (constraints.gridwidth == 1)
+ colIsOccupied[constraints.gridx] = true;
+ if (constraints.gridheight == 1)
+ rowIsOccupied[constraints.gridy] = true;
+ } // end of STEP 2
+
+ GridBagLayoutInfo info = new GridBagLayoutInfo(max_x, max_y);
+
+ // Check if column widths and row heights are overridden.
+
+ for (int x = 0; x < max_x; x++)
+ {
+ if(columnWidths != null && columnWidths.length > x)
+ info.colWidths[x] = columnWidths[x];
+ if(columnWeights != null && columnWeights.length > x)
+ info.colWeights[x] = columnWeights[x];
+ }
+
+ for (int y = 0; y < max_y; y++)
+ {
+ if(rowHeights != null && rowHeights.length > y)
+ info.rowHeights[y] = rowHeights[y];
+ if(rowWeights != null && rowWeights.length > y)
+ info.rowWeights[y] = rowWeights[y];
+ }
+
+ // STEP 3: Distribute the weights and min sizes among rows/columns.
+ for (int i = 0; i < components.length; i++)
+ {
+ Component component = components [i];
+
+ // If component is not visible we dont have to care about it.
+ if (!component.isVisible())
+ continue;
+
+ GridBagConstraints constraints = lookupInternalConstraints (component);
+ GridBagConstraints originalConstraints = lookupConstraints (component);
+
+ // Distribute the width.
+
+ int width = (sizeflag == PREFERREDSIZE) ?
+ component.getPreferredSize().width :
+ component.getMinimumSize().width;
+
+ if(constraints.insets != null)
+ width += constraints.insets.left + constraints.insets.right;
+
+ width += constraints.ipadx;
+
+ int occupiedCols = constraints.gridwidth;
+ int lastOccupiedCol = -1;
+
+ for(int w = constraints.gridx; w < constraints.gridx + constraints.gridwidth; w++)
+ {
+ if(colIsOccupied[w])
+ lastOccupiedCol = w;
+ else
+ occupiedCols--;
+ }
+
+ // A component needs to occupy at least one column.
+ if(occupiedCols == 0)
+ {
+ colIsOccupied[constraints.gridx + constraints.gridwidth - 1] = true;
+ lastOccupiedCol = constraints.gridx + constraints.gridwidth - 1;
+ }
+
+ for(int w = constraints.gridx; w < constraints.gridx + constraints.gridwidth - 1; w++)
+ {
+ if(colIsOccupied[w])
+ width -= info.colWidths[w];
+ }
+
+ info.colWidths[lastOccupiedCol] = Math.max(info.colWidths[lastOccupiedCol], width);
+ info.colWeights[lastOccupiedCol] = Math.max(info.colWeights[lastOccupiedCol], constraints.weightx);
+
+
+ // Distribute the height.
+
+ int height = (sizeflag == PREFERREDSIZE) ?
+ component.getPreferredSize().height :
+ component.getMinimumSize().height;
+
+ if(constraints.insets != null)
+ height += constraints.insets.top + constraints.insets.bottom;
+
+ height += constraints.ipady;
+
+ int occupiedRows = constraints.gridheight;
+ int lastOccupiedRow = -1;
+
+ for(int h = constraints.gridy; h < constraints.gridy + constraints.gridheight; h++)
+ {
+ if(rowIsOccupied[h])
+ lastOccupiedRow = h;
+ else
+ occupiedRows--;
+ }
+
+ // A component needs to occupy at least one row.
+ if(occupiedRows == 0)
+ {
+ rowIsOccupied[constraints.gridy + constraints.gridheight - 1] = true;
+ lastOccupiedRow = constraints.gridy + constraints.gridheight - 1;
+ }
+
+ for(int h = constraints.gridy; h < constraints.gridy + constraints.gridheight; h++)
+ {
+ if(rowIsOccupied[h])
+ height -= info.rowHeights[h];
+ }
+
+ info.rowHeights[lastOccupiedRow] = Math.max(info.rowHeights[lastOccupiedRow], height);
+ info.rowWeights[lastOccupiedRow] = Math.max(info.rowWeights[lastOccupiedRow], constraints.weighty);
+
+ } // end of STEP 3
+
+ calcCellSizes (info.colWidths, info.colWeights, parentDim.width);
+ calcCellSizes (info.rowHeights, info.rowWeights, parentDim.height);
+
+ int totalWidth = sumIntArray(info.colWidths);
+ int totalHeight = sumIntArray(info.rowHeights);
+ info.pos_x = parentInsets.left + (parentDim.width - totalWidth) / 2;
+ info.pos_y = parentInsets.top + (parentDim.height - totalHeight) / 2;
+
+ // DEBUG
+ //dumpLayoutInfo (info);
+
+ return info;
}
/**
@@ -326,7 +830,13 @@ public class GridBagLayout
*/
protected Dimension GetMinSize (Container parent, GridBagLayoutInfo info)
{
- return getMinSize (parent, info);
+ if (parent == null || info == null)
+ return new Dimension (0, 0);
+
+ Insets insets = parent.getInsets();
+ int width = sumIntArray (info.colWidths) + insets.left + insets.right;
+ int height = sumIntArray (info.rowHeights) + insets.top + insets.bottom;
+ return new Dimension (width, height);
}
/**
@@ -334,31 +844,37 @@ public class GridBagLayout
*/
protected Dimension getMinSize (Container parent, GridBagLayoutInfo info)
{
- if (parent == null || info == null)
- return new Dimension (0, 0);
-
- Insets insets = parent.getInsets();
- int width = sumIntArray (info.colWidths) + insets.left + insets.right;
- int height = sumIntArray (info.rowHeights) + insets.top + insets.bottom;
- return new Dimension (width, height);
+ return GetMinSize (parent, info);
}
private void calcCellSizes (int[] sizes, double[] weights, int range)
{
- int diff = range - sumIntArray (sizes);
+ int totalSize = sumIntArray (sizes);
+ double totalWeight = sumDoubleArray (weights);
- if (diff == 0)
- return;
-
- double weight = sumDoubleArray (weights);
+ // Rows or columns with size 0 should not be weighted in the calculation.
+ for (int i = 0; i < weights.length; i++)
+ {
+ if (sizes[i] == 0)
+ totalWeight -= weights[i];
+ }
- for (int i = 0; i < sizes.length; i++)
- {
- sizes [i] += (int) (((double) diff) * weights [i] / weight );
+ int diff = range - totalSize;
- if (sizes [i] < 0)
- sizes [i] = 0;
- }
+ if (diff == 0)
+ return;
+
+ for (int i = 0; i < sizes.length; i++)
+ {
+ // A row or column with zero size cannot all of a sudden gain size.
+ if (sizes[i] != 0.0)
+ {
+ int newsize = (int) (sizes[i] + (((double) diff) * weights [i] / totalWeight ));
+
+ if (newsize > 0)
+ sizes[i] = newsize;
+ }
+ }
}
private void dumpLayoutInfo (GridBagLayoutInfo info)
@@ -404,116 +920,7 @@ public class GridBagLayout
*/
protected void arrangeGrid (Container parent)
{
- Component[] components = parent.getComponents();
-
- if (components.length == 0)
- return;
-
- GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE);
- if (info.cols == 0 && info.rows == 0)
- return;
- layoutInfo = info;
-
- // DEBUG
- //dumpLayoutInfo (layoutInfo);
-
- for(int i = 0; i < components.length; i++)
- {
- Component component = components [i];
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints = lookupConstraints (component);
-
- int cellx = sumIntArray(layoutInfo.colWidths, constraints.gridx);
- int celly = sumIntArray(layoutInfo.rowHeights, constraints.gridy);
- int cellw = sumIntArray(layoutInfo.colWidths,
- constraints.gridx + constraints.gridwidth) - cellx;
- int cellh = sumIntArray(layoutInfo.rowHeights,
- constraints.gridy + constraints.gridheight) - celly;
-
- Insets insets = constraints.insets;
- if (insets != null)
- {
- cellx += insets.left;
- celly += insets.top;
- cellw -= insets.left + insets.right;
- cellh -= insets.top + insets.bottom;
- }
-
- Dimension dim = component.preferredSize();
-
- // Note: Documentation says that padding is added on both sides, but
- // visual inspection shows that the Sun implementation only adds it
- // once, so we do the same.
- dim.width += constraints.ipadx;
- dim.height += constraints.ipady;
-
- switch(constraints.fill)
- {
- case GridBagConstraints.HORIZONTAL:
- dim.width = cellw;
- break;
- case GridBagConstraints.VERTICAL:
- dim.height = cellh;
- break;
- case GridBagConstraints.BOTH:
- dim.width = cellw;
- dim.height = cellh;
- break;
- }
-
- int x;
- int y;
-
- switch(constraints.anchor)
- {
- case GridBagConstraints.NORTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly;
- break;
- case GridBagConstraints.SOUTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + cellh - dim.height;
- break;
- case GridBagConstraints.WEST:
- x = cellx;
- y = celly + (cellh - dim.height) / 2;
- break;
- case GridBagConstraints.EAST:
- x = cellx + cellw - dim.width;
- y = celly + (cellh - dim.height) / 2;
- break;
- case GridBagConstraints.NORTHEAST:
- x = cellx + cellw - dim.width;
- y = celly;
- break;
- case GridBagConstraints.NORTHWEST:
- x = cellx;
- y = celly;
- break;
- case GridBagConstraints.SOUTHEAST:
- x = cellx + cellw - dim.width;
- y = celly + cellh - dim.height;
- break;
- case GridBagConstraints.SOUTHWEST:
- x = cellx;
- y = celly + cellh - dim.height;
- break;
- default:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + (cellh - dim.height) / 2;
- break;
- }
-
- component.setBounds(layoutInfo.pos_x + x, layoutInfo.pos_y + y, dim.width, dim.height);
- }
-
- // DEBUG
- //dumpLayoutInfo (layoutInfo);
-
+ ArrangeGrid (parent);
}
/**
@@ -521,160 +928,7 @@ public class GridBagLayout
*/
protected GridBagLayoutInfo getLayoutInfo (Container parent, int sizeflag)
{
- if (sizeflag != MINSIZE && sizeflag != PREFERREDSIZE)
- throw new IllegalArgumentException();
-
- Dimension parentDim = parent.size();
- Insets parentInsets = parent.insets();
- parentDim.width -= parentInsets.left + parentInsets.right;
- parentDim.height -= parentInsets.top + parentInsets.bottom;
-
- int x = 0;
- int y = 0;
- int max_x = 0;
- int max_y = 0;
-
- // first we figure out how many rows/columns
- Component[] components = parent.getComponents();
- for (int i = 0; i < components.length; i++)
- {
- Component component = components [i];
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints = lookupConstraints (component);
-
- if(constraints.gridx == GridBagConstraints.RELATIVE)
- constraints.gridx = x;
-
- if(constraints.gridy == GridBagConstraints.RELATIVE)
- constraints.gridy = y;
-
- max_x = Math.max(max_x,
- constraints.gridx + Math.max(1, constraints.gridwidth));
- max_y = Math.max(max_y,
- constraints.gridy + Math.max(1, constraints.gridheight));
-
- if(constraints.gridwidth == GridBagConstraints.REMAINDER)
- {
- x = 0;
- y++;
- }
- else
- {
- x = constraints.gridx + Math.max(1, constraints.gridwidth);
- y = constraints.gridy;
- }
- }
-
- GridBagLayoutInfo info = new GridBagLayoutInfo(max_x, max_y);
-
- for (x = 0; x <= max_x; x++)
- {
- if(columnWidths != null && columnWidths.length > x)
- {
- info.colWidths[x] = columnWidths[x];
- }
- if(columnWeights != null && columnWeights.length > x)
- {
- info.colWeights[x] = columnWeights[x];
- }
- for (int i = 0; i < components.length; i++)
- {
- Component component = components [i];
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints = lookupConstraints (component);
-
- // first we fix up any REMAINDER cells
- if(constraints.gridwidth == GridBagConstraints.REMAINDER)
- {
- constraints.gridwidth = max_x - constraints.gridx;
- }
- if(constraints.gridheight == GridBagConstraints.REMAINDER)
- {
- constraints.gridheight = max_y - constraints.gridy;
- }
-
- if(constraints.gridx + constraints.gridwidth - 1 == x)
- {
- int width = (sizeflag == PREFERREDSIZE) ?
- component.preferredSize().width :
- component.minimumSize().width;
- if(constraints.insets != null)
- {
- width += constraints.insets.left + constraints.insets.right;
- }
- width += constraints.ipadx;
- for(int w = 1; w < constraints.gridwidth; w++)
- {
- width -= info.colWidths[x - w];
- }
- info.colWidths[x] = Math.max(info.colWidths[x], width);
- info.colWeights[x] =
- Math.max(info.colWeights[x], constraints.weightx);
- }
- }
- }
-
- for (y = 0; y <= max_y; y++)
- {
- if(rowHeights != null && rowHeights.length > y)
- {
- info.rowHeights[y] = rowHeights[y];
- }
- if(rowWeights != null && rowWeights.length > y)
- {
- info.rowWeights[y] = rowWeights[y];
- }
- for (int i = 0; i < components.length; i++)
- {
- Component component = components [i];
-
- // If component is not visible we dont have to care about it.
- if (!component.isVisible())
- continue;
-
- GridBagConstraints constraints = lookupConstraints (component);
-
- if(constraints.gridy + constraints.gridheight - 1 == y)
- {
- int height = (sizeflag == PREFERREDSIZE) ?
- component.preferredSize().height :
- component.minimumSize().height;
- if(constraints.insets != null)
- {
- height += constraints.insets.top + constraints.insets.bottom;
- }
- height += constraints.ipady;
- for(int h = 1; h < constraints.gridheight; h++)
- {
- height -= info.rowHeights[y - h];
- }
- info.rowHeights[y] = Math.max(info.rowHeights[y], height);
- info.rowWeights[y] =
- Math.max(info.rowWeights[y], constraints.weighty);
- }
- }
- }
-
- calcCellSizes (info.colWidths, info.colWeights, parentDim.width);
- calcCellSizes (info.rowHeights, info.rowWeights, parentDim.height);
-
- int totalWidth = sumIntArray(info.colWidths);
- int totalHeight = sumIntArray(info.rowHeights);
- info.pos_x = parentInsets.left + (parentDim.width - totalWidth) / 2;
- info.pos_y = parentInsets.top + (parentDim.height - totalHeight) / 2;
-
- // DEBUG
- //dumpLayoutInfo (info);
-
- return info;
+ return GetLayoutInfo (parent, sizeflag);
}
/**
@@ -682,7 +936,6 @@ public class GridBagLayout
*/
protected void adjustForGravity (GridBagConstraints gbc, Rectangle rect)
{
- // FIXME
- throw new Error ("Not implemented");
+ AdjustForGravity (gbc, rect);
}
}
diff --git a/libjava/java/awt/LayoutManager2.java b/libjava/java/awt/LayoutManager2.java
index 418e4d886fb..802e25e664b 100644
--- a/libjava/java/awt/LayoutManager2.java
+++ b/libjava/java/awt/LayoutManager2.java
@@ -52,12 +52,12 @@ public interface LayoutManager2 extends LayoutManager
{
/**
* Adds the specified component to the layout, with the specified
- * constraint object.
+ * constraints object.
*
* @param component the component to add
- * @param constraint the constraint to satisfy
+ * @param constraints the constraints to satisfy
*/
- void addLayoutComponent(Component component, Object contraint);
+ void addLayoutComponent(Component component, Object contraints);
/**
* Determines the maximum size of the specified target container.
diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java
index 79b2faa6299..47177edc7a0 100644
--- a/libjava/java/awt/List.java
+++ b/libjava/java/awt/List.java
@@ -175,7 +175,7 @@ List(int rows, boolean multipleMode)
public int
getItemCount()
{
- return(items.size());
+ return countItems ();
}
/*************************************************************************/
@@ -191,7 +191,7 @@ getItemCount()
public int
countItems()
{
- return(getItemCount());
+ return items.size ();
}
/*************************************************************************/
@@ -249,7 +249,7 @@ getRows()
public boolean
isMultipleMode()
{
- return(multipleMode);
+ return allowsMultipleSelections ();
}
/*************************************************************************/
@@ -266,7 +266,7 @@ isMultipleMode()
public boolean
allowsMultipleSelections()
{
- return(multipleMode);
+ return multipleMode;
}
/*************************************************************************/
@@ -281,12 +281,7 @@ allowsMultipleSelections()
public void
setMultipleMode(boolean multipleMode)
{
- this.multipleMode = multipleMode;
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.setMultipleMode (multipleMode);
- }
+ setMultipleSelections (multipleMode);
}
/*************************************************************************/
@@ -303,7 +298,11 @@ setMultipleMode(boolean multipleMode)
public void
setMultipleSelections(boolean multipleMode)
{
- setMultipleMode(multipleMode);
+ this.multipleMode = multipleMode;
+
+ ListPeer peer = (ListPeer) getPeer ();
+ if (peer != null)
+ peer.setMultipleMode (multipleMode);
}
/*************************************************************************/
@@ -316,7 +315,7 @@ setMultipleSelections(boolean multipleMode)
public Dimension
getMinimumSize()
{
- return(getMinimumSize(rows));
+ return getMinimumSize (getRows ());
}
/*************************************************************************/
@@ -332,7 +331,7 @@ getMinimumSize()
public Dimension
minimumSize()
{
- return(getMinimumSize(rows));
+ return minimumSize (getRows ());
}
/*************************************************************************/
@@ -348,11 +347,7 @@ minimumSize()
public Dimension
getMinimumSize(int rows)
{
- ListPeer lp = (ListPeer)getPeer();
- if (lp != null)
- return(lp.minimumSize(rows));
- else
- return(new Dimension(0,0));
+ return minimumSize (rows);
}
/*************************************************************************/
@@ -371,7 +366,11 @@ getMinimumSize(int rows)
public Dimension
minimumSize(int rows)
{
- return(getMinimumSize(rows));
+ ListPeer peer = (ListPeer) getPeer ();
+ if (peer != null)
+ return peer.minimumSize (rows);
+ else
+ return new Dimension (0, 0);
}
/*************************************************************************/
@@ -384,7 +383,7 @@ minimumSize(int rows)
public Dimension
getPreferredSize()
{
- return(getPreferredSize(rows));
+ return getPreferredSize (getRows ());
}
/*************************************************************************/
@@ -400,7 +399,7 @@ getPreferredSize()
public Dimension
preferredSize()
{
- return(getPreferredSize(rows));
+ return preferredSize (getRows ());
}
/*************************************************************************/
@@ -416,11 +415,7 @@ preferredSize()
public Dimension
getPreferredSize(int rows)
{
- ListPeer lp = (ListPeer)getPeer();
- if (lp != null)
- return(lp.preferredSize(rows));
- else
- return(new Dimension(0,0));
+ return preferredSize (rows);
}
/*************************************************************************/
@@ -439,7 +434,11 @@ getPreferredSize(int rows)
public Dimension
preferredSize(int rows)
{
- return(getPreferredSize(rows));
+ ListPeer peer = (ListPeer) getPeer ();
+ if (peer != null)
+ return peer.preferredSize (rows);
+ else
+ return new Dimension (0, 0);
}
/*************************************************************************/
@@ -452,7 +451,7 @@ preferredSize(int rows)
public void
add(String item)
{
- add(item, -1);
+ add (item, -1);
}
/*************************************************************************/
@@ -467,7 +466,7 @@ add(String item)
public void
addItem(String item)
{
- addItem(item, -1);
+ addItem (item, -1);
}
/*************************************************************************/
@@ -484,16 +483,7 @@ addItem(String item)
public void
add(String item, int index)
{
- if ((index == -1) || (index >= items.size()))
- items.addElement(item);
- else
- items.insertElementAt(item, index);
-
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.add (item, index);
- }
+ addItem (item, index);
}
/*************************************************************************/
@@ -512,7 +502,14 @@ add(String item, int index)
public void
addItem(String item, int index)
{
- add(item, index);
+ if ((index == -1) || (index >= items.size ()))
+ items.addElement (item);
+ else
+ items.insertElementAt (item, index);
+
+ ListPeer peer = (ListPeer) getPeer ();
+ if (peer != null)
+ peer.add (item, index);
}
/*************************************************************************/
@@ -529,7 +526,11 @@ addItem(String item, int index)
public void
delItem(int index) throws IllegalArgumentException
{
- remove(index);
+ items.removeElementAt (index);
+
+ ListPeer peer = (ListPeer) getPeer ();
+ if (peer != null)
+ peer.delItems (index, index);
}
/*************************************************************************/
@@ -544,12 +545,7 @@ delItem(int index) throws IllegalArgumentException
public void
remove(int index) throws IllegalArgumentException
{
- items.removeElementAt (index);
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.delItems (index, index);
- }
+ delItem (index);
}
/*************************************************************************/
@@ -613,12 +609,7 @@ remove(String item) throws IllegalArgumentException
public synchronized void
removeAll()
{
- items.clear();
- if (peer != null)
- {
- ListPeer l = (ListPeer) peer;
- l.removeAll ();
- }
+ clear ();
}
/*************************************************************************/
@@ -631,7 +622,11 @@ removeAll()
public void
clear()
{
- removeAll();
+ items.clear();
+
+ ListPeer peer = (ListPeer) getPeer ();
+ if (peer != null)
+ peer.removeAll ();
}
/*************************************************************************/
@@ -782,13 +777,7 @@ getSelectedObjects()
public boolean
isIndexSelected(int index)
{
- int[] indexes = getSelectedIndexes();
-
- for (int i = 0; i < indexes.length; i++)
- if (indexes[i] == index)
- return(true);
-
- return(false);
+ return isSelected (index);
}
/*************************************************************************/
@@ -807,7 +796,13 @@ isIndexSelected(int index)
public boolean
isSelected(int index)
{
- return(isIndexSelected(index));
+ int[] indexes = getSelectedIndexes ();
+
+ for (int i = 0; i < indexes.length; i++)
+ if (indexes[i] == index)
+ return true;
+
+ return false;
}
/*************************************************************************/
diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java
index 6fdc22c8ccd..74478fbca75 100644
--- a/libjava/java/awt/Menu.java
+++ b/libjava/java/awt/Menu.java
@@ -41,6 +41,7 @@ package java.awt;
import java.awt.peer.MenuPeer;
import java.io.Serializable;
import java.util.Vector;
+import java.util.Enumeration;
/**
* This class represents a pull down or tear off menu in Java's AWT.
@@ -170,7 +171,7 @@ isTearOff()
public int
getItemCount()
{
- return(items.size());
+ return countItems ();
}
/**
@@ -182,7 +183,7 @@ getItemCount()
*/
public int countItems ()
{
- return getItemCount ();
+ return items.size ();
}
/*************************************************************************/
@@ -379,7 +380,7 @@ addNotify()
{
if (peer == null)
peer = getToolkit().createMenu(this);
- java.util.Enumeration e = items.elements();
+ Enumeration e = items.elements();
while (e.hasMoreElements())
{
MenuItem mi = (MenuItem)e.nextElement();
@@ -396,6 +397,12 @@ addNotify()
public void
removeNotify()
{
+ Enumeration e = items.elements();
+ while (e.hasMoreElements())
+ {
+ MenuItem mi = (MenuItem) e.nextElement();
+ mi.removeNotify();
+ }
super.removeNotify();
}
diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java
index af5c9121b21..fb267290008 100644
--- a/libjava/java/awt/MenuBar.java
+++ b/libjava/java/awt/MenuBar.java
@@ -219,8 +219,7 @@ remove(MenuComponent menu)
public int
getMenuCount()
{
- // FIXME: How does the help menu fit in here?
- return(menus.size());
+ return countMenus ();
}
/*************************************************************************/
@@ -235,7 +234,8 @@ getMenuCount()
public int
countMenus()
{
- return(getMenuCount());
+ // FIXME: How does the help menu fit in here?
+ return menus.size ();
}
/*************************************************************************/
@@ -279,6 +279,12 @@ addNotify()
public void
removeNotify()
{
+ Enumeration e = menus.elements();
+ while (e.hasMoreElements())
+ {
+ Menu mi = (Menu) e.nextElement();
+ mi.removeNotify();
+ }
super.removeNotify();
}
diff --git a/libjava/java/awt/MenuItem.java b/libjava/java/awt/MenuItem.java
index bea3b4fd477..cfdfafcc881 100644
--- a/libjava/java/awt/MenuItem.java
+++ b/libjava/java/awt/MenuItem.java
@@ -202,15 +202,7 @@ isEnabled()
public synchronized void
setEnabled(boolean enabled)
{
- if (enabled == this.enabled)
- return;
-
- this.enabled = enabled;
- if (peer != null)
- {
- MenuItemPeer mp = (MenuItemPeer) peer;
- mp.setEnabled (enabled);
- }
+ enable (enabled);
}
/*************************************************************************/
@@ -226,7 +218,10 @@ setEnabled(boolean enabled)
public void
enable(boolean enabled)
{
- setEnabled(enabled);
+ if (enabled)
+ enable ();
+ else
+ disable ();
}
/*************************************************************************/
@@ -239,7 +234,12 @@ enable(boolean enabled)
public void
enable()
{
- setEnabled(true);
+ if (enabled)
+ return;
+
+ this.enabled = true;
+ if (peer != null)
+ ((MenuItemPeer) peer).setEnabled (true);
}
/*************************************************************************/
@@ -252,7 +252,12 @@ enable()
public void
disable()
{
- setEnabled(false);
+ if (!enabled)
+ return;
+
+ this.enabled = false;
+ if (peer != null)
+ ((MenuItemPeer) peer).setEnabled (false);
}
/*************************************************************************/
diff --git a/libjava/java/awt/Polygon.java b/libjava/java/awt/Polygon.java
index 113dad992d2..e91144c8812 100644
--- a/libjava/java/awt/Polygon.java
+++ b/libjava/java/awt/Polygon.java
@@ -258,10 +258,24 @@ public class Polygon implements Shape, Serializable
*/
public Rectangle getBounds()
{
+ return getBoundingBox ();
+ }
+
+ /**
+ * Returns the bounding box of this polygon. This is the smallest
+ * rectangle with sides parallel to the X axis that will contain this
+ * polygon.
+ *
+ * @return the bounding box for this polygon
+ * @see #getBounds2D()
+ * @deprecated use {@link #getBounds()} instead
+ */
+ public Rectangle getBoundingBox()
+ {
if (bounds == null)
{
if (npoints == 0)
- return bounds = new Rectangle();
+ return bounds = new Rectangle ();
int i = npoints - 1;
int minx = xpoints[i];
int maxx = minx;
@@ -280,26 +294,12 @@ public class Polygon implements Shape, Serializable
else if (y > maxy)
maxy = y;
}
- bounds = new Rectangle(minx, maxy, maxx - minx, maxy - miny);
+ bounds = new Rectangle (minx, maxy, maxx - minx, maxy - miny);
}
return bounds;
}
/**
- * Returns the bounding box of this polygon. This is the smallest
- * rectangle with sides parallel to the X axis that will contain this
- * polygon.
- *
- * @return the bounding box for this polygon
- * @see #getBounds2D()
- * @deprecated use {@link #getBounds()} instead
- */
- public Rectangle getBoundingBox()
- {
- return getBounds();
- }
-
- /**
* Tests whether or not the specified point is inside this polygon.
*
* @param p the point to test
diff --git a/libjava/java/awt/Rectangle.java b/libjava/java/awt/Rectangle.java
index 48a2fbec0d4..c3340bb8eb4 100644
--- a/libjava/java/awt/Rectangle.java
+++ b/libjava/java/awt/Rectangle.java
@@ -281,10 +281,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void setBounds(Rectangle r)
{
- x = r.x;
- y = r.y;
- width = r.width;
- height = r.height;
+ setBounds (r.x, r.y, r.width, r.height);
}
/**
@@ -298,10 +295,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void setBounds(int x, int y, int width, int height)
{
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
+ reshape (x, y, width, height);
}
/**
@@ -333,7 +327,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void reshape(int x, int y, int width, int height)
{
- setBounds(x, y, width, height);
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
}
/**
@@ -360,8 +357,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void setLocation(Point p)
{
- this.x = p.x;
- this.y = p.y;
+ setLocation (p.x, p.y);
}
/**
@@ -374,8 +370,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void setLocation(int x, int y)
{
- this.x = x;
- this.y = y;
+ move (x, y);
}
/**
@@ -388,7 +383,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void move(int x, int y)
{
- setLocation(x, y);
+ this.x = x;
+ this.y = y;
}
/**
@@ -426,8 +422,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void setSize(Dimension d)
{
- width = d.width;
- height = d.height;
+ setSize (d.width, d.height);
}
/**
@@ -439,8 +434,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void setSize(int width, int height)
{
- this.width = width;
- this.height = height;
+ resize (width, height);
}
/**
@@ -452,7 +446,8 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public void resize(int width, int height)
{
- setSize(width, height);
+ this.width = width;
+ this.height = height;
}
/**
@@ -469,9 +464,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public boolean contains(Point p)
{
- return width > 0 && height > 0
- && p.x >= x && p.x < x + width
- && p.y >= y && p.y < y + height;
+ return contains (p.x, p.y);
}
/**
@@ -487,9 +480,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public boolean contains(int x, int y)
{
- return width > 0 && height > 0
- && x >= this.x && x < this.x + width
- && y >= this.y && y < this.y + height;
+ return inside (x, y);
}
/**
@@ -504,9 +495,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public boolean contains(Rectangle r)
{
- return width > 0 && height > 0 && r.width > 0 && r.height > 0
- && r.x >= x && r.x + r.width <= x + width
- && r.y >= y && r.y + r.height <= y + height;
+ return contains (r.x, r.y, r.width, r.height);
}
/**
@@ -537,7 +526,9 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public boolean inside(int x, int y)
{
- return contains(x, y);
+ return width > 0 && height > 0
+ && x >= this.x && x < this.x + width
+ && y >= this.y && y < this.y + height;
}
/**
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
index 937568a6204..b772bee3878 100644
--- a/libjava/java/awt/ScrollPane.java
+++ b/libjava/java/awt/ScrollPane.java
@@ -446,10 +446,25 @@ removeNotify()
public void
doLayout()
{
- Component[] list = getComponents();
+ layout ();
+}
+
+/*************************************************************************/
+
+/**
+ * Lays out this component. This consists of resizing the sole child
+ * component to its perferred size.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>doLayout()</code>.
+ */
+public void
+layout()
+{
+ Component[] list = getComponents ();
if ((list != null) && (list.length > 0))
{
- Dimension dim = list[0].getPreferredSize();
+ Dimension dim = list[0].getPreferredSize ();
Dimension vp = getViewportSize ();
if (dim.width < vp.width)
@@ -462,36 +477,21 @@ doLayout()
if (peer != null)
peer.childResized (dim.width, dim.height);
- list[0].resize (dim);
+ list[0].setSize (dim);
- Point p = getScrollPosition();
+ Point p = getScrollPosition ();
if (p.x > dim.width)
p.x = dim.width;
if (p.y > dim.height)
p.y = dim.height;
- setScrollPosition(p);
+ setScrollPosition (p);
}
}
/*************************************************************************/
/**
- * Lays out this component. This consists of resizing the sole child
- * component to its perferred size.
- *
- * @deprecated This method is deprecated in favor of
- * <code>doLayout()</code>.
- */
-public void
-layout()
-{
- doLayout();
-}
-
-/*************************************************************************/
-
-/**
* This method overrides its superclass method to ensure no layout
* manager is set for this container. <code>ScrollPane</code>'s do
* not have layout managers.
diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java
index 85ac117e683..a01dc3ccdc8 100644
--- a/libjava/java/awt/Scrollbar.java
+++ b/libjava/java/awt/Scrollbar.java
@@ -120,6 +120,11 @@ private AdjustmentListener adjustment_listeners;
private transient boolean valueIsAdjusting = false;
+ /*
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_scrollbar_number = 0;
+
/*************************************************************************/
/*
@@ -194,9 +199,8 @@ Scrollbar(int orientation, int value, int visibleAmount, int minimum,
// Default is 1 according to online docs.
lineIncrement = 1;
- pageIncrement = (maximum - minimum) / 5;
- if (pageIncrement == 0)
- pageIncrement = 1;
+ // Default is 10 according to javadocs.
+ pageIncrement = 10;
}
/*************************************************************************/
@@ -333,7 +337,7 @@ setMinimum(int minimum)
public int
getVisibleAmount()
{
- return(visibleAmount);
+ return getVisible ();
}
/*************************************************************************/
@@ -350,7 +354,7 @@ getVisibleAmount()
public int
getVisible()
{
- return(getVisibleAmount());
+ return visibleAmount;
}
/*************************************************************************/
@@ -394,15 +398,17 @@ setValues(int value, int visibleAmount, int minimum, int maximum)
if (visibleAmount > maximum - minimum)
visibleAmount = maximum - minimum;
+ ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
+ if (peer != null
+ && (this.value != value || this.visibleAmount != visibleAmount
+ || this.minimum != minimum || this.maximum != maximum))
+ peer.setValues(value, visibleAmount, minimum, maximum);
+
this.value = value;
this.visibleAmount = visibleAmount;
this.minimum = minimum;
this.maximum = maximum;
- ScrollbarPeer sp = (ScrollbarPeer)getPeer();
- if (sp != null)
- sp.setValues(value, visibleAmount, minimum, maximum);
-
int range = maximum - minimum;
if (lineIncrement > range)
{
@@ -411,8 +417,8 @@ setValues(int value, int visibleAmount, int minimum, int maximum)
else
lineIncrement = range;
- if (sp != null)
- sp.setLineIncrement(lineIncrement);
+ if (peer != null)
+ peer.setLineIncrement(lineIncrement);
}
if (pageIncrement > range)
@@ -422,8 +428,8 @@ setValues(int value, int visibleAmount, int minimum, int maximum)
else
pageIncrement = range;
- if (sp != null)
- sp.setPageIncrement(pageIncrement);
+ if (peer != null)
+ peer.setPageIncrement(pageIncrement);
}
}
@@ -438,7 +444,7 @@ setValues(int value, int visibleAmount, int minimum, int maximum)
public int
getUnitIncrement()
{
- return(lineIncrement);
+ return getLineIncrement ();
}
/*************************************************************************/
@@ -455,7 +461,7 @@ getUnitIncrement()
public int
getLineIncrement()
{
- return(lineIncrement);
+ return lineIncrement;
}
/*************************************************************************/
@@ -469,26 +475,7 @@ getLineIncrement()
public synchronized void
setUnitIncrement(int unitIncrement)
{
- if (unitIncrement < 0)
- throw new IllegalArgumentException("Unit increment less than zero.");
-
- int range = maximum - minimum;
- if (unitIncrement > range)
- {
- if (range == 0)
- unitIncrement = 1;
- else
- unitIncrement = range;
- }
-
- if (unitIncrement == lineIncrement)
- return;
-
- lineIncrement = unitIncrement;
-
- ScrollbarPeer sp = (ScrollbarPeer)getPeer();
- if (sp != null)
- sp.setLineIncrement(lineIncrement);
+ setLineIncrement (unitIncrement);
}
/*************************************************************************/
@@ -505,7 +492,26 @@ setUnitIncrement(int unitIncrement)
public void
setLineIncrement(int lineIncrement)
{
- setUnitIncrement(lineIncrement);
+ if (lineIncrement < 0)
+ throw new IllegalArgumentException ("Unit increment less than zero.");
+
+ int range = maximum - minimum;
+ if (lineIncrement > range)
+ {
+ if (range == 0)
+ lineIncrement = 1;
+ else
+ lineIncrement = range;
+ }
+
+ if (lineIncrement == this.lineIncrement)
+ return;
+
+ this.lineIncrement = lineIncrement;
+
+ ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
+ if (peer != null)
+ peer.setLineIncrement (this.lineIncrement);
}
/*************************************************************************/
@@ -519,7 +525,7 @@ setLineIncrement(int lineIncrement)
public int
getBlockIncrement()
{
- return(pageIncrement);
+ return getPageIncrement ();
}
/*************************************************************************/
@@ -536,7 +542,7 @@ getBlockIncrement()
public int
getPageIncrement()
{
- return(pageIncrement);
+ return pageIncrement;
}
/*************************************************************************/
@@ -550,26 +556,7 @@ getPageIncrement()
public synchronized void
setBlockIncrement(int blockIncrement)
{
- if (blockIncrement < 0)
- throw new IllegalArgumentException("Block increment less than zero.");
-
- int range = maximum - minimum;
- if (blockIncrement > range)
- {
- if (range == 0)
- blockIncrement = 1;
- else
- blockIncrement = range;
- }
-
- if (blockIncrement == pageIncrement)
- return;
-
- pageIncrement = blockIncrement;
-
- ScrollbarPeer sp = (ScrollbarPeer)getPeer();
- if (sp != null)
- sp.setPageIncrement(pageIncrement);
+ setPageIncrement (blockIncrement);
}
/*************************************************************************/
@@ -586,7 +573,26 @@ setBlockIncrement(int blockIncrement)
public void
setPageIncrement(int pageIncrement)
{
- setBlockIncrement(pageIncrement);
+ if (pageIncrement < 0)
+ throw new IllegalArgumentException ("Block increment less than zero.");
+
+ int range = maximum - minimum;
+ if (pageIncrement > range)
+ {
+ if (range == 0)
+ pageIncrement = 1;
+ else
+ pageIncrement = range;
+ }
+
+ if (pageIncrement == this.pageIncrement)
+ return;
+
+ this.pageIncrement = pageIncrement;
+
+ ScrollbarPeer peer = (ScrollbarPeer) getPeer ();
+ if (peer != null)
+ peer.setPageIncrement (this.pageIncrement);
}
/*************************************************************************/
@@ -746,5 +752,20 @@ paramString()
{
this.valueIsAdjusting = valueIsAdjusting;
}
+
+ /**
+ * Generate a unique name for this scroll bar.
+ *
+ * @return A unique name for this scroll bar.
+ */
+ String generateName ()
+ {
+ return "scrollbar" + getUniqueLong ();
+ }
+
+ private static synchronized long getUniqueLong ()
+ {
+ return next_scrollbar_number++;
+ }
} // class Scrollbar
diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java
index 356efeb921d..6f60ee69c2f 100644
--- a/libjava/java/awt/TextArea.java
+++ b/libjava/java/awt/TextArea.java
@@ -288,13 +288,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public Dimension getMinimumSize (int rows, int columns)
{
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
- // Sun returns Dimension (0,0) in this case.
- if (peer == null)
- return new Dimension (0, 0);
-
- return peer.getMinimumSize (rows, columns);
+ return minimumSize (rows, columns);
}
/**
@@ -311,7 +305,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public Dimension minimumSize ()
{
- return getMinimumSize (getRows (), getColumns ());
+ return minimumSize (getRows (), getColumns ());
}
/**
@@ -333,7 +327,13 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public Dimension minimumSize (int rows, int columns)
{
- return getMinimumSize (rows, columns);
+ TextAreaPeer peer = (TextAreaPeer) getPeer ();
+
+ // Sun returns Dimension (0,0) in this case.
+ if (peer == null)
+ return new Dimension (0, 0);
+
+ return peer.getMinimumSize (rows, columns);
}
/**
@@ -366,13 +366,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public Dimension getPreferredSize (int rows, int columns)
{
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
-
- // Sun returns Dimension (0,0) in this case.
- if (peer == null)
- return new Dimension (0, 0);
-
- return peer.getPreferredSize (rows, columns);
+ return preferredSize (rows, columns);
}
/**
@@ -389,7 +383,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public Dimension preferredSize ()
{
- return getPreferredSize (getRows (), getColumns ());
+ return preferredSize (getRows (), getColumns ());
}
/**
@@ -411,7 +405,13 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public Dimension preferredSize (int rows, int columns)
{
- return getPreferredSize (rows, columns);
+ TextAreaPeer peer = (TextAreaPeer) getPeer ();
+
+ // Sun returns Dimension (0,0) in this case.
+ if (peer == null)
+ return new Dimension (0, 0);
+
+ return peer.getPreferredSize (rows, columns);
}
/**
@@ -440,59 +440,59 @@ public class TextArea extends TextComponent implements java.io.Serializable
/**
* Append the specified text to the end of the current text.
*
- * @param text The text to append.
+ * @param str The text to append.
*/
public void append (String str)
{
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
- if (peer == null)
- return;
-
- peer.insert (str, peer.getText().length ());
+ appendText (str);
}
/**
* Append the specified text to the end of the current text.
*
- * @param text The text to append.
+ * @param str The text to append.
*
* @deprecated This method is deprecated in favor of
* <code>append ()</code>.
*/
- public void appendText (String text)
+ public void appendText (String str)
{
- append (text);
+ TextAreaPeer peer = (TextAreaPeer) getPeer ();
+ if (peer == null)
+ return;
+
+ peer.insert (str, peer.getText().length ());
}
/**
* Insert the specified text at the specified position. The first
* character in the text area is at position zero.
*
- * @param text The text to insert.
+ * @param str The text to insert.
* @param pos The position at which to insert text.
*/
- public void insert (String text, int pos)
+ public void insert (String str, int pos)
{
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
- if (peer == null)
- return;
-
- peer.insert (text, pos);
+ insertText (str, pos);
}
/**
* Insert the specified text at the specified position. The first
* character in the text area is at position zero.
*
- * @param text The text to insert.
+ * @param str The text to insert.
* @param pos The position at which to insert text.
*
- * @deprecated This method is depcreated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>insert ()</code>.
*/
- public void insertText (String text, int pos)
+ public void insertText (String str, int pos)
{
- insert (text, pos);
+ TextAreaPeer peer = (TextAreaPeer) getPeer ();
+ if (peer == null)
+ return;
+
+ peer.insert (str, pos);
}
/**
@@ -503,17 +503,13 @@ public class TextArea extends TextComponent implements java.io.Serializable
* length of the replacement text may differ from the length of the
* text that is replaced.
*
- * @param text The new text for the range.
+ * @param str The new text for the range.
* @param start The start position of the replacement range.
* @param end The end position of the replacement range.
*/
- public void replaceRange (String text, int start, int end)
+ public void replaceRange (String str, int start, int end)
{
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
- if (peer == null)
- return;
-
- peer.replaceRange (text, start, end);
+ replaceText (str, start, end);
}
/**
@@ -524,16 +520,20 @@ public class TextArea extends TextComponent implements java.io.Serializable
* length of the replacement text may differ from the length of the
* text that is replaced.
*
- * @param text The new text for the range.
+ * @param str The new text for the range.
* @param start The start position of the replacement range.
* @param end The end position of the replacement range.
*
* @deprecated This method is deprecated in favor of
* <code>replaceRange ()</code>.
*/
- public void replaceText (String text, int start, int end)
+ public void replaceText (String str, int start, int end)
{
- replaceRange (text, start, end);
+ TextAreaPeer peer = (TextAreaPeer) getPeer ();
+ if (peer == null)
+ return;
+
+ peer.replaceRange (str, start, end);
}
/**
diff --git a/libjava/java/awt/TextField.java b/libjava/java/awt/TextField.java
index 7575e24d4c1..1a783e27a79 100644
--- a/libjava/java/awt/TextField.java
+++ b/libjava/java/awt/TextField.java
@@ -212,11 +212,7 @@ getEchoChar()
public void
setEchoChar(char echoChar)
{
- this.echoChar = echoChar;
-
- TextFieldPeer tfp = (TextFieldPeer)getPeer();
- if (tfp != null)
- tfp.setEchoChar(echoChar);
+ setEchoCharacter (echoChar);
}
/*************************************************************************/
@@ -233,7 +229,11 @@ setEchoChar(char echoChar)
public void
setEchoCharacter(char echoChar)
{
- setEchoChar(echoChar);
+ this.echoChar = echoChar;
+
+ TextFieldPeer peer = (TextFieldPeer) getPeer ();
+ if (peer != null)
+ peer.setEchoChar (echoChar);
}
/*************************************************************************/
@@ -264,7 +264,7 @@ echoCharIsSet()
public Dimension
getMinimumSize()
{
- return(getMinimumSize(getColumns()));
+ return getMinimumSize (getColumns ());
}
/*************************************************************************/
@@ -278,11 +278,7 @@ getMinimumSize()
public Dimension
getMinimumSize(int columns)
{
- TextFieldPeer tfp = (TextFieldPeer)getPeer();
- if (tfp == null)
- return(null); // FIXME: What do we do if there is no peer?
-
- return(tfp.getMinimumSize(columns));
+ return minimumSize (columns);
}
/*************************************************************************/
@@ -292,13 +288,13 @@ getMinimumSize(int columns)
*
* @return The minimum size for this text field.
*
- * @deprecated This method is depcreated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>getMinimumSize()</code>.
*/
public Dimension
minimumSize()
{
- return(getMinimumSize(getColumns()));
+ return minimumSize (getColumns ());
}
/*************************************************************************/
@@ -315,7 +311,11 @@ minimumSize()
public Dimension
minimumSize(int columns)
{
- return(getMinimumSize(columns));
+ TextFieldPeer peer = (TextFieldPeer) getPeer ();
+ if (peer == null)
+ return null; // FIXME: What do we do if there is no peer?
+
+ return peer.getMinimumSize (columns);
}
/*************************************************************************/
@@ -328,7 +328,7 @@ minimumSize(int columns)
public Dimension
getPreferredSize()
{
- return(getPreferredSize(getColumns()));
+ return getPreferredSize (getColumns ());
}
/*************************************************************************/
@@ -342,12 +342,7 @@ getPreferredSize()
public Dimension
getPreferredSize(int columns)
{
- TextFieldPeer tfp = (TextFieldPeer)getPeer();
- if (tfp == null)
- {
- return new Dimension(0, 0);
- }
- return(tfp.getPreferredSize(columns));
+ return preferredSize (columns);
}
/*************************************************************************/
@@ -363,7 +358,7 @@ getPreferredSize(int columns)
public Dimension
preferredSize()
{
- return(getPreferredSize(getColumns()));
+ return preferredSize (getColumns ());
}
/*************************************************************************/
@@ -380,7 +375,11 @@ preferredSize()
public Dimension
preferredSize(int columns)
{
- return(getPreferredSize(columns));
+ TextFieldPeer peer = (TextFieldPeer) getPeer ();
+ if (peer == null)
+ return new Dimension (0, 0);
+
+ return peer.getPreferredSize (columns);
}
/*************************************************************************/
diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java
index 004604ac5cf..d911bab7146 100644
--- a/libjava/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/java/awt/datatransfer/DataFlavor.java
@@ -1,5 +1,5 @@
/* DataFlavor.java -- A type of data to transfer via the clipboard.
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,11 +60,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
{
static final long serialVersionUID = 8367026044764648243L;
-// FIXME: Serialization: Need to write methods for.
-
-/*
- * Static Variables
- */
+ // FIXME: Serialization: Need to write methods for.
/**
* This is the data flavor used for tranferring plain text. The MIME
@@ -90,6 +86,10 @@ public static final DataFlavor stringFlavor;
*/
public static final DataFlavor javaFileListFlavor;
+/**
+ * This is an image flavor used for transferring images. The
+ * representation type is a <code>java.awt.Image</code>.
+ */
public static final DataFlavor imageFlavor;
/**
@@ -105,7 +105,7 @@ public static final String javaSerializedObjectMimeType =
* being transferred.
*/
public static final String javaJVMLocalObjectMimeType =
- "application/x-java-jvm-local-object";
+ "application/x-java-jvm-local-objectref";
/**
* This is the MIME type used to transfer a link to a remote object.
diff --git a/libjava/java/awt/geom/AffineTransform.java b/libjava/java/awt/geom/AffineTransform.java
index d479763be8c..1410d90cb37 100644
--- a/libjava/java/awt/geom/AffineTransform.java
+++ b/libjava/java/awt/geom/AffineTransform.java
@@ -226,7 +226,7 @@ public class AffineTransform implements Cloneable, Serializable
private double m00;
/**
- * The Y coordinate scaling element of the transform matrix.
+ * The Y coordinate shearing element of the transform matrix.
*
* @serial matrix[1,0]
*/
@@ -240,7 +240,7 @@ public class AffineTransform implements Cloneable, Serializable
private double m01;
/**
- * The Y coordinate shearing element of the transform matrix.
+ * The Y coordinate scaling element of the transform matrix.
*
* @serial matrix[1,1]
*/
@@ -738,10 +738,10 @@ public class AffineTransform implements Cloneable, Serializable
*/
public void shear(double shx, double shy)
{
- double n00 = m00 + shx * m01;
- double n01 = shx * m00 + m01;
- double n10 = m10 * shy + m11;
- double n11 = shx * m10 + m11;
+ double n00 = m00 + (shy * m01);
+ double n01 = m01 + (shx * m00);
+ double n10 = m10 + (shy * m11);
+ double n11 = m11 + (shx * m10);
m00 = n00;
m01 = n01;
m10 = n10;
@@ -996,6 +996,38 @@ public class AffineTransform implements Cloneable, Serializable
* map multiple points to the same line or point). A transform exists only
* if getDeterminant() has a non-zero value.
*
+ * The inverse is calculated as:
+ *
+ * <pre>
+ *
+ * Let A be the matrix for which we want to find the inverse:
+ *
+ * A = [ m00 m01 m02 ]
+ * [ m10 m11 m12 ]
+ * [ 0 0 1 ]
+ *
+ *
+ * 1
+ * inverse (A) = --- x adjoint(A)
+ * det
+ *
+ *
+ *
+ * = 1 [ m11 -m01 m01*m12-m02*m11 ]
+ * --- x [ -m10 m00 -m00*m12+m10*m02 ]
+ * det [ 0 0 m00*m11-m10*m01 ]
+ *
+ *
+ *
+ * = [ m11/det -m01/det m01*m12-m02*m11/det ]
+ * [ -m10/det m00/det -m00*m12+m10*m02/det ]
+ * [ 0 0 1 ]
+ *
+ *
+ * </pre>
+ *
+ *
+ *
* @return a new inverse transform
* @throws NoninvertibleTransformException if inversion is not possible
* @see #getDeterminant()
@@ -1006,8 +1038,15 @@ public class AffineTransform implements Cloneable, Serializable
double det = getDeterminant();
if (det == 0)
throw new NoninvertibleTransformException("can't invert transform");
- return new AffineTransform(m11 / det, -m10 / det, m01 / det, -m00 / det,
- -m02, -m12);
+
+ double im00 = m11 / det;
+ double im10 = -m10 / det;
+ double im01 = -m01 / det;
+ double im11 = m00 / det;
+ double im02 = (m01 * m12 - m02 * m11) / det;
+ double im12 = (-m00 * m12 + m10 * m02) / det;
+
+ return new AffineTransform (im00, im10, im01, im11, im02, im12);
}
/**
diff --git a/libjava/java/awt/image/renderable/RenderContext.java b/libjava/java/awt/image/renderable/RenderContext.java
index eca35ed66ac..81d84a45e56 100644
--- a/libjava/java/awt/image/renderable/RenderContext.java
+++ b/libjava/java/awt/image/renderable/RenderContext.java
@@ -87,24 +87,24 @@ public class RenderContext implements Cloneable
public void preConcatenateTransform(AffineTransform pre)
{
- xform.preConcatenate(pre);
+ preConcetenateTransform (pre);
}
- /** @deprecated Sun can't spell concatenate */
+ /** @deprecated */
public void preConcetenateTransform(AffineTransform pre)
{
- preConcetenateTransform(pre);
+ xform.preConcatenate (pre);
}
public void concatenateTransform(AffineTransform post)
{
- xform.concatenate(post);
+ concetenateTransform (post);
}
- /** @deprecated Sun can't spell concatenate */
+ /** @deprecated */
public void concetenateTransform(AffineTransform post)
{
- concatenateTransform(post);
+ xform.concatenate (post);
}
public AffineTransform getTransform()
diff --git a/libjava/java/io/BufferedReader.java b/libjava/java/io/BufferedReader.java
index e29c8dd8844..1bc0dcf7994 100644
--- a/libjava/java/io/BufferedReader.java
+++ b/libjava/java/io/BufferedReader.java
@@ -1,5 +1,5 @@
/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -89,6 +89,11 @@ public class BufferedReader extends Reader
static final int DEFAULT_BUFFER_SIZE = 8192;
/**
+ * The line buffer for <code>readLine</code>.
+ */
+ private StringBuffer sbuf = null;
+
+ /**
* Create a new <code>BufferedReader</code> that will read from the
* specified subordinate stream with a default buffer size of 8192 chars.
*
@@ -439,7 +444,7 @@ public class BufferedReader extends Reader
int i = lineEnd(limit);
if (i < limit)
{
- String str = new String(buffer, pos, i - pos);
+ String str = String.valueOf(buffer, pos, i - pos);
pos = i + 1;
// If the last char in the buffer is a '\r', we must remember
// to check if the next char to be read after the buffer is refilled
@@ -450,7 +455,10 @@ public class BufferedReader extends Reader
pos++;
return str;
}
- StringBuffer sbuf = new StringBuffer(200);
+ if (sbuf == null)
+ sbuf = new StringBuffer(200);
+ else
+ sbuf.setLength(0);
sbuf.append(buffer, pos, i - pos);
pos = i;
// We only want to return null when no characters were read before
diff --git a/libjava/java/io/InputStreamReader.java b/libjava/java/io/InputStreamReader.java
index 05ed5fe2287..07be132510b 100644
--- a/libjava/java/io/InputStreamReader.java
+++ b/libjava/java/io/InputStreamReader.java
@@ -1,5 +1,5 @@
/* InputStreamReader.java -- Reader than transforms bytes to chars
- Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -231,10 +231,8 @@ public class InputStreamReader extends Reader
int wavail = wcount - wpos;
if (wavail <= 0)
{
- // Nothing waiting, so refill our buffer.
- if (! refill ())
- return -1;
- wavail = wcount - wpos;
+ // Nothing waiting, so refill their buffer.
+ return refill(buf, offset, length);
}
if (length > wavail)
@@ -262,24 +260,24 @@ public class InputStreamReader extends Reader
int wavail = wcount - wpos;
if (wavail <= 0)
{
- // Nothing waiting, so refill our buffer.
- if (! refill ())
+ // Nothing waiting, so refill our internal buffer.
+ wpos = wcount = 0;
+ if (work == null)
+ work = new char[100];
+ int count = refill(work, 0, work.length);
+ if (count == -1)
return -1;
+ wcount += count;
}
return work[wpos++];
}
}
- // Read more bytes and convert them into the WORK buffer.
- // Return false on EOF.
- private boolean refill () throws IOException
+ // Read more bytes and convert them into the specified buffer.
+ // Returns the number of converted characters or -1 on EOF.
+ private int refill(char[] buf, int offset, int length) throws IOException
{
- wcount = wpos = 0;
-
- if (work == null)
- work = new char[100];
-
for (;;)
{
// We have knowledge of the internals of BufferedInputStream
@@ -290,17 +288,13 @@ public class InputStreamReader extends Reader
boolean r = in.pos < in.count || in.refill ();
in.reset ();
if (! r)
- return false;
+ return -1;
converter.setInput(in.buf, in.pos, in.count);
- int count = converter.read (work, wpos, work.length - wpos);
+ int count = converter.read(buf, offset, length);
in.skip(converter.inpos - in.pos);
if (count > 0)
- {
- wcount += count;
- return true;
- }
+ return count;
}
}
-
} // class InputStreamReader
diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java
index a277691e976..e471b6d7d59 100644
--- a/libjava/java/io/ObjectInputStream.java
+++ b/libjava/java/io/ObjectInputStream.java
@@ -138,7 +138,7 @@ public class ObjectInputStream extends InputStream
this.isDeserializing = true;
byte marker = this.realInputStream.readByte();
- dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " ");
+ if(dump) dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " ");
try
{
@@ -155,25 +155,25 @@ public class ObjectInputStream extends InputStream
case TC_BLOCKDATALONG:
{
if (marker == TC_BLOCKDATALONG)
- dumpElementln("BLOCKDATALONG");
+ if(dump) dumpElementln("BLOCKDATALONG");
else
- dumpElementln("BLOCKDATA");
+ if(dump) dumpElementln("BLOCKDATA");
readNextBlock(marker);
throw new StreamCorruptedException("Unexpected blockData");
}
case TC_NULL:
{
- dumpElementln("NULL");
+ if(dump) dumpElementln("NULL");
ret_val = null;
break;
}
case TC_REFERENCE:
{
- dumpElement("REFERENCE ");
+ if(dump) dumpElement("REFERENCE ");
Integer oid = new Integer(this.realInputStream.readInt());
- dumpElementln(Integer.toHexString(oid.intValue()));
+ if(dump) dumpElementln(Integer.toHexString(oid.intValue()));
ret_val = ((ObjectIdentityWrapper)
this.objectLookupTable.get(oid)).object;
break;
@@ -181,7 +181,7 @@ public class ObjectInputStream extends InputStream
case TC_CLASS:
{
- dumpElementln("CLASS");
+ if(dump) dumpElementln("CLASS");
ObjectStreamClass osc = (ObjectStreamClass)readObject();
Class clazz = osc.forClass();
assignNewHandle(clazz);
@@ -191,7 +191,7 @@ public class ObjectInputStream extends InputStream
case TC_PROXYCLASSDESC:
{
- dumpElementln("PROXYCLASS");
+ if(dump) dumpElementln("PROXYCLASS");
int n_intf = this.realInputStream.readInt();
String[] intfs = new String[n_intf];
for (int i = 0; i < n_intf; i++)
@@ -242,41 +242,42 @@ public class ObjectInputStream extends InputStream
case TC_STRING:
case TC_LONGSTRING:
{
- dumpElement("STRING=");
+ if(dump) dumpElement("STRING=");
String s = this.realInputStream.readUTF();
- dumpElementln(s);
- ret_val = processResolution(s, assignNewHandle(s));
+ if(dump) dumpElementln(s);
+ ret_val = processResolution(null, s, assignNewHandle(s));
break;
}
case TC_ARRAY:
{
- dumpElementln("ARRAY");
+ if(dump) dumpElementln("ARRAY");
ObjectStreamClass osc = (ObjectStreamClass)readObject();
Class componentType = osc.forClass().getComponentType();
- dumpElement("ARRAY LENGTH=");
+ if(dump) dumpElement("ARRAY LENGTH=");
int length = this.realInputStream.readInt();
- dumpElementln (length + "; COMPONENT TYPE=" + componentType);
+ if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
Object array = Array.newInstance(componentType, length);
int handle = assignNewHandle(array);
readArrayElements(array, componentType);
- for (int i = 0, len = Array.getLength(array); i < len; i++)
- dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
- ret_val = processResolution(array, handle);
+ if(dump)
+ for (int i = 0, len = Array.getLength(array); i < len; i++)
+ dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
+ ret_val = processResolution(null, array, handle);
break;
}
case TC_OBJECT:
{
- dumpElementln("OBJECT");
+ if(dump) dumpElementln("OBJECT");
ObjectStreamClass osc = (ObjectStreamClass)readObject();
Class clazz = osc.forClass();
- if (!Serializable.class.isAssignableFrom(clazz))
+ if (!osc.realClassIsSerializable)
throw new NotSerializableException
(clazz + " is not Serializable, and thus cannot be deserialized.");
- if (Externalizable.class.isAssignableFrom(clazz))
+ if (osc.realClassIsExternalizable)
{
Externalizable obj = null;
@@ -315,23 +316,11 @@ public class ObjectInputStream extends InputStream
if (read_from_blocks)
setBlockDataMode(oldmode);
- ret_val = processResolution(obj, handle);
+ ret_val = processResolution(osc, obj, handle);
break;
- } // end if (Externalizable.class.isAssignableFrom (clazz))
-
- // find the first non-serializable, non-abstract
- // class in clazz's inheritance hierarchy
- Class first_nonserial = clazz.getSuperclass();
- while (Serializable.class.isAssignableFrom(first_nonserial)
- || Modifier.isAbstract(first_nonserial.getModifiers()))
- first_nonserial = first_nonserial.getSuperclass();
-
- Object obj = null;
- obj = newObject(clazz, first_nonserial);
-
- if (obj == null)
- throw new ClassNotFoundException
- ("Instance of " + clazz + " could not be created");
+ } // end if (osc.realClassIsExternalizable)
+
+ Object obj = newObject(clazz, osc.firstNonSerializableParent);
int handle = assignNewHandle(obj);
this.currentObject = obj;
@@ -342,20 +331,21 @@ public class ObjectInputStream extends InputStream
{
this.currentObjectStreamClass = hierarchy[i];
- dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
+ if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
// XXX: should initialize fields in classes in the hierarchy
// that aren't in the stream
// should skip over classes in the stream that aren't in the
// real classes hierarchy
- if (this.currentObjectStreamClass.hasReadMethod())
+ Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
+ if (readObjectMethod != null)
{
fieldsAlreadyRead = false;
boolean oldmode = setBlockDataMode(true);
- callReadMethod(obj, this.currentObjectStreamClass);
+ callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
setBlockDataMode(oldmode);
- dumpElement("ENDBLOCKDATA? ");
+ if(dump) dumpElement("ENDBLOCKDATA? ");
try
{
// FIXME: XXX: This try block is to catch EOF which is
@@ -363,15 +353,15 @@ public class ObjectInputStream extends InputStream
if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
throw new IOException
("No end of block data seen for class with readObject (ObjectInputStream) method.");
- dumpElementln("yes");
+ if(dump) dumpElementln("yes");
}
catch (EOFException e)
{
- dumpElementln("no, got EOFException");
+ if(dump) dumpElementln("no, got EOFException");
}
catch (IOException e)
{
- dumpElementln("no, got IOException");
+ if(dump) dumpElementln("no, got IOException");
}
}
else
@@ -382,21 +372,21 @@ public class ObjectInputStream extends InputStream
this.currentObject = null;
this.currentObjectStreamClass = null;
- ret_val = processResolution(obj, handle);
+ ret_val = processResolution(osc, obj, handle);
break;
}
case TC_RESET:
- dumpElementln("RESET");
+ if(dump) dumpElementln("RESET");
clearHandles();
ret_val = readObject();
break;
case TC_EXCEPTION:
{
- dumpElement("EXCEPTION=");
+ if(dump) dumpElement("EXCEPTION=");
Exception e = (Exception)readObject();
- dumpElementln(e.toString());
+ if(dump) dumpElementln(e.toString());
clearHandles();
throw new WriteAbortedException("Exception thrown during writing of stream", e);
}
@@ -440,27 +430,29 @@ public class ObjectInputStream extends InputStream
protected ObjectStreamClass readClassDescriptor()
throws ClassNotFoundException, IOException
{
- dumpElement("CLASSDESC NAME=");
+ if(dump) dumpElement("CLASSDESC NAME=");
String name = this.realInputStream.readUTF();
- dumpElement(name + "; UID=");
+ if(dump) dumpElement(name + "; UID=");
long uid = this.realInputStream.readLong ();
- dumpElement(Long.toHexString(uid) + "; FLAGS=");
+ if(dump) dumpElement(Long.toHexString(uid) + "; FLAGS=");
byte flags = this.realInputStream.readByte ();
- dumpElement(Integer.toHexString(flags) + "; FIELD COUNT=");
+ if(dump) dumpElement(Integer.toHexString(flags) + "; FIELD COUNT=");
short field_count = this.realInputStream.readShort();
- dumpElementln(Short.toString(field_count));
+ if(dump) dumpElementln(Short.toString(field_count));
ObjectStreamField[] fields = new ObjectStreamField[field_count];
ObjectStreamClass osc = new ObjectStreamClass(name, uid,
flags, fields);
assignNewHandle(osc);
+
+ ClassLoader currentLoader = currentLoader();
for (int i = 0; i < field_count; i++)
{
- dumpElement(" TYPE CODE=");
+ if(dump) dumpElement(" TYPE CODE=");
char type_code = (char)this.realInputStream.readByte();
- dumpElement(type_code + "; FIELD NAME=");
+ if(dump) dumpElement(type_code + "; FIELD NAME=");
String field_name = this.realInputStream.readUTF();
- dumpElementln(field_name);
+ if(dump) dumpElementln(field_name);
String class_name;
// If the type code is an array or an object we must
@@ -473,35 +465,87 @@ public class ObjectInputStream extends InputStream
class_name = String.valueOf(type_code);
fields[i] =
- new ObjectStreamField(field_name, class_name, currentLoader());
+ new ObjectStreamField(field_name, class_name, currentLoader);
}
/* Now that fields have been read we may resolve the class
* (and read annotation if needed). */
Class clazz = resolveClass(osc);
-
- for (int i = 0; i < field_count; i++)
+
+ boolean oldmode = setBlockDataMode(true);
+ osc.setClass(clazz, lookupClass(clazz.getSuperclass()));
+ classLookupTable.put(clazz, osc);
+ setBlockDataMode(oldmode);
+
+ // find the first non-serializable, non-abstract
+ // class in clazz's inheritance hierarchy
+ Class first_nonserial = clazz.getSuperclass();
+ while (Serializable.class.isAssignableFrom(first_nonserial)
+ || Modifier.isAbstract(first_nonserial.getModifiers()))
+ first_nonserial = first_nonserial.getSuperclass();
+
+ osc.firstNonSerializableParent = first_nonserial;
+ osc.realClassIsSerializable = Serializable.class.isAssignableFrom(clazz);
+ osc.realClassIsExternalizable = Externalizable.class.isAssignableFrom(clazz);
+
+ ObjectStreamField[] stream_fields = osc.fields;
+ ObjectStreamField[] real_fields = ObjectStreamClass.lookup(clazz).fields;
+ ObjectStreamField[] fieldmapping = new ObjectStreamField[2 * Math.max(stream_fields.length, real_fields.length)];
+ osc.fieldMapping = fieldmapping;
+
+ int stream_idx = 0;
+ int real_idx = 0;
+ int map_idx = 0;
+
+ while (stream_idx < stream_fields.length
+ || real_idx < real_fields.length)
{
- Field f;
-
- try
+ ObjectStreamField stream_field = null;
+ ObjectStreamField real_field = null;
+
+ if (stream_idx == stream_fields.length)
{
- f = clazz.getDeclaredField(fields[i].getName());
- if (f != null && !f.getType().equals(fields[i].getType()))
- throw new InvalidClassException
- ("invalid field type for " + fields[i].getName() + " in class "
- + name + " (requested was \"" + fields[i].getType()
- + " and found \"" + f.getType() + "\")");
+ real_field = real_fields[real_idx++];
}
- catch (NoSuchFieldException _)
+ else if (real_idx == real_fields.length)
{
+ stream_field = stream_fields[stream_idx++];
}
- }
+ else
+ {
+ int comp_val =
+ real_fields[real_idx].compareTo (stream_fields[stream_idx]);
- boolean oldmode = setBlockDataMode(true);
- osc.setClass(clazz, lookupClass(clazz.getSuperclass()));
- classLookupTable.put(clazz, osc);
- setBlockDataMode(oldmode);
+ if (comp_val < 0)
+ {
+ real_field = real_fields[real_idx++];
+ }
+ else if (comp_val > 0)
+ {
+ stream_field = stream_fields[stream_idx++];
+ }
+ else
+ {
+ stream_field = stream_fields[stream_idx++];
+ real_field = real_fields[real_idx++];
+ if(stream_field.getType() != real_field.getType())
+ throw new InvalidClassException
+ ("invalid field type for " + real_field.getName() +
+ " in class " + name);
+ }
+ }
+ if (stream_field != null)
+ {
+ if (stream_field.getOffset() < 0)
+ stream_field = null;
+ else if (!stream_field.isToSet())
+ real_field = null;
+ }
+ if (real_field != null && !real_field.isToSet())
+ real_field = null;
+ fieldmapping[map_idx++] = stream_field;
+ fieldmapping[map_idx++] = real_field;
+ }
return osc;
}
@@ -763,11 +807,11 @@ public class ObjectInputStream extends InputStream
protected void readStreamHeader()
throws IOException, StreamCorruptedException
{
- dumpElement("STREAM MAGIC ");
+ if(dump) dumpElement("STREAM MAGIC ");
if (this.realInputStream.readShort() != STREAM_MAGIC)
throw new StreamCorruptedException("Invalid stream magic number");
- dumpElementln("STREAM VERSION ");
+ if(dump) dumpElementln("STREAM VERSION ");
if (this.realInputStream.readShort() != STREAM_VERSION)
throw new StreamCorruptedException("Invalid stream version number");
}
@@ -1045,7 +1089,7 @@ public class ObjectInputStream extends InputStream
* deserializing class (if present). It cannot (and should not)be called
* outside of it. Its goal is to read all fields in the real input stream
* and keep them accessible through the {@link #GetField} class. Calling
- * this method will not alterate the deserializing object.
+ * this method will not alter the deserializing object.
*
* @return A valid freshly created 'GetField' instance to get access to
* the deserialized stream.
@@ -1375,20 +1419,18 @@ public class ObjectInputStream extends InputStream
return this.nextOID++;
}
- private Object processResolution(Object obj, int handle)
+ private Object processResolution(ObjectStreamClass osc, Object obj, int handle)
throws IOException
{
- if (obj instanceof Serializable)
+ if (osc != null && obj instanceof Serializable)
{
- Method m = null;
try
{
- Class classArgs[] = {};
- m = getMethod(obj.getClass(), "readResolve", classArgs);
- obj = m.invoke(obj, new Object[] {});
- }
- catch (NoSuchMethodException ignore)
- {
+ Method m = osc.readResolveMethod;
+ if(m != null)
+ {
+ obj = m.invoke(obj, new Object[] {});
+ }
}
catch (IllegalAccessException ignore)
{
@@ -1422,15 +1464,15 @@ public class ObjectInputStream extends InputStream
{
if (marker == TC_BLOCKDATA)
{
- dumpElement("BLOCK DATA SIZE=");
+ if(dump) dumpElement("BLOCK DATA SIZE=");
this.blockDataBytes = this.realInputStream.readUnsignedByte();
- dumpElementln (Integer.toString(this.blockDataBytes));
+ if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
}
else if (marker == TC_BLOCKDATALONG)
{
- dumpElement("BLOCK DATA LONG SIZE=");
+ if(dump) dumpElement("BLOCK DATA LONG SIZE=");
this.blockDataBytes = this.realInputStream.readInt();
- dumpElementln (Integer.toString(this.blockDataBytes));
+ if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
}
else
{
@@ -1517,158 +1559,123 @@ public class ObjectInputStream extends InputStream
private void readFields (Object obj, ObjectStreamClass stream_osc)
throws ClassNotFoundException, IOException
{
- ObjectStreamField[] stream_fields = stream_osc.fields;
- ObjectStreamField[] real_fields =
- lookupClass(stream_osc.forClass()).fields;
-
- boolean default_initialize, set_value;
- String field_name = null;
- Class type = null;
- ObjectStreamField stream_field = null;
- ObjectStreamField real_field = null;
- int stream_idx = 0;
- int real_idx = 0;
+ ObjectStreamField[] fields = stream_osc.fieldMapping;
- while (stream_idx < stream_fields.length
- && real_idx < real_fields.length)
+ for (int i = 0; i < fields.length; i += 2)
{
- default_initialize = false;
- set_value = true;
-
- if (stream_idx == stream_fields.length)
- default_initialize = true;
- else
+ ObjectStreamField stream_field = fields[i];
+ ObjectStreamField real_field = fields[i + 1];
+ if(stream_field != null || real_field != null)
{
- stream_field = stream_fields[stream_idx];
- type = stream_field.getType();
- }
-
- if (real_idx == real_fields.length)
- set_value = false;
- else
- {
- real_field = real_fields[real_idx];
- type = real_field.getType();
- field_name = real_field.getName();
- }
-
- if (set_value && !default_initialize)
- {
- int comp_val =
- real_field.compareTo (stream_field);
-
- if (comp_val < 0)
+ boolean read_value = stream_field != null;
+ boolean set_value = real_field != null;
+ String field_name;
+ char type;
+ if (stream_field != null)
{
- default_initialize = true;
- real_idx++;
- }
- else if (comp_val > 0)
- {
- set_value = false;
- stream_idx++;
+ field_name = stream_field.getName();
+ type = stream_field.getTypeCode();
}
else
{
- real_idx++;
- stream_idx++;
+ field_name = real_field.getName();
+ type = real_field.getTypeCode();
}
- }
-
- if (stream_field.getOffset() < 0)
- {
- default_initialize = true;
- set_value = false;
- }
-
- if (!stream_field.isToSet())
- set_value = false;
- try
- {
- if (type == Boolean.TYPE)
- {
- boolean value =
- default_initialize ? false : this.realInputStream.readBoolean();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setBooleanField(obj, stream_osc.forClass(), field_name, value);
- }
- else if (type == Byte.TYPE)
+ switch(type)
{
- byte value =
- default_initialize ? 0 : this.realInputStream.readByte();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setByteField(obj, stream_osc.forClass(), field_name, value);
+ case 'Z':
+ {
+ boolean value =
+ read_value ? this.realInputStream.readBoolean() : false;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setBooleanField(obj, value);
+ break;
+ }
+ case 'B':
+ {
+ byte value =
+ read_value ? this.realInputStream.readByte() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setByteField(obj, value);
+ break;
+ }
+ case 'C':
+ {
+ char value =
+ read_value ? this.realInputStream.readChar(): 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setCharField(obj, value);
+ break;
+ }
+ case 'D':
+ {
+ double value =
+ read_value ? this.realInputStream.readDouble() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setDoubleField(obj, value);
+ break;
+ }
+ case 'F':
+ {
+ float value =
+ read_value ? this.realInputStream.readFloat() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setFloatField(obj, value);
+ break;
+ }
+ case 'I':
+ {
+ int value =
+ read_value ? this.realInputStream.readInt() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setIntField(obj, value);
+ break;
+ }
+ case 'J':
+ {
+ long value =
+ read_value ? this.realInputStream.readLong() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setLongField(obj, value);
+ break;
+ }
+ case 'S':
+ {
+ short value =
+ read_value ? this.realInputStream.readShort() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setShortField(obj, value);
+ break;
+ }
+ case 'L':
+ case '[':
+ {
+ Object value =
+ read_value ? readObject() : null;
+ if (set_value)
+ real_field.setObjectField(obj, value);
+ break;
+ }
+ default:
+ throw new InternalError("Invalid type code: " + type);
}
- else if (type == Character.TYPE)
- {
- char value =
- default_initialize ? (char)0 : this.realInputStream.readChar();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setCharField(obj, stream_osc.forClass(), field_name, value);
- }
- else if (type == Double.TYPE)
- {
- double value =
- default_initialize ? 0 : this.realInputStream.readDouble();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setDoubleField(obj, stream_osc.forClass(), field_name, value);
- }
- else if (type == Float.TYPE)
- {
- float value =
- default_initialize ? 0 : this.realInputStream.readFloat();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setFloatField(obj, stream_osc.forClass(), field_name, value);
- }
- else if (type == Integer.TYPE)
- {
- int value =
- default_initialize ? 0 : this.realInputStream.readInt();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setIntField(obj, stream_osc.forClass(), field_name, value);
- }
- else if (type == Long.TYPE)
- {
- long value =
- default_initialize ? 0 : this.realInputStream.readLong();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setLongField(obj, stream_osc.forClass(), field_name, value);
- }
- else if (type == Short.TYPE)
- {
- short value =
- default_initialize ? (short)0 : this.realInputStream.readShort();
- if (!default_initialize && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- setShortField(obj, stream_osc.forClass(), field_name, value);
- }
- else
- {
- Object value =
- default_initialize ? null : readObject();
- if (set_value)
- setObjectField(obj, stream_osc.forClass(), field_name,
- real_field.getTypeString(), value);
- }
- }
- catch (NoSuchFieldError e)
- {
- dumpElementln("XXXX " + field_name + " does not exist.");
}
}
}
@@ -1689,6 +1696,7 @@ public class ObjectInputStream extends InputStream
// returns a new instance of REAL_CLASS that has been constructed
// only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS)
private Object newObject (Class real_class, Class constructor_class)
+ throws ClassNotFoundException
{
try
{
@@ -1698,7 +1706,8 @@ public class ObjectInputStream extends InputStream
}
catch (InstantiationException e)
{
- return null;
+ throw new ClassNotFoundException
+ ("Instance of " + real_class + " could not be created");
}
}
@@ -1734,71 +1743,11 @@ public class ObjectInputStream extends InputStream
return ClassLoader.getSystemClassLoader ();
}
- /**
- * This method tries to access a precise field called in the
- * specified class. Before accessing the field, it tries to
- * gain control on this field. If the field is either declared as
- * not persistent or transient then it returns null
- * immediately.
- *
- * @param klass Class to get the field from.
- * @param name Name of the field to access.
- * @return Field instance representing the requested field.
- * @throws NoSuchFieldException if the field does not exist.
- */
- private Field getField(Class klass, String name)
- throws java.lang.NoSuchFieldException
+ private void callReadMethod (Method readObject, Class klass, Object obj) throws IOException
{
- final Field f = klass.getDeclaredField(name);
- ObjectStreamField sf = lookupClass(klass).getField(name);
-
- AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
- {
- f.setAccessible(true);
- return null;
- }
- });
-
- /* We do not want to modify transient fields. They should
- * be left to 0.
- * N.B.: Not valid if the field is in serialPersistentFields.
- */
- if (Modifier.isTransient(f.getModifiers()) && !sf.isPersistent())
- return null;
-
- return f;
- }
-
- private static Method getMethod (Class klass, String name, Class args[])
- throws java.lang.NoSuchMethodException
- {
- final Method m = klass.getDeclaredMethod(name, args);
- AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
- {
- m.setAccessible(true);
- return null;
- }
- });
- return m;
- }
-
- private void callReadMethod (Object obj, ObjectStreamClass osc) throws IOException
- {
- Class klass = osc.forClass();
try
{
- Class classArgs[] = {ObjectInputStream.class};
- Method m = getMethod (klass, "readObject", classArgs);
- Object args[] = {this};
- m.invoke(obj, args);
- }
- catch (NoSuchMethodException nsme)
- {
- // Nothing.
+ readObject.invoke(obj, new Object[] { this });
}
catch (InvocationTargetException x)
{
@@ -1827,265 +1776,7 @@ public class ObjectInputStream extends InputStream
private native void callConstructor (Class clazz, Object obj);
- /**
- * This method writes a "boolean" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The boolean value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setBooleanField(Object obj, Class klass, String field_name,
- boolean val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setBoolean(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes a "byte" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The byte value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setByteField(Object obj, Class klass, String field_name,
- byte val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setByte(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes a "character" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The character value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setCharField(Object obj, Class klass, String field_name,
- char val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setChar(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes a "double" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The double value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setDoubleField(Object obj, Class klass, String field_name,
- double val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setDouble(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes a "float" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The float value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setFloatField(Object obj, Class klass, String field_name,
- float val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setFloat(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes an "integer" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The integer value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setIntField(Object obj, Class klass, String field_name,
- int val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setInt(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes the long value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The long value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setLongField(Object obj, Class klass, String field_name,
- long val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setLong(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes a "short" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The short value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setShortField(Object obj, Class klass, String field_name,
- short val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- f.setShort(obj, val);
- }
- catch (IllegalArgumentException _)
- {
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- }
- catch (Exception _)
- {
- }
- }
-
- /**
- * This method writes an "object" value <code>val</code> in the specified field
- * of the instance <code>obj</code> of the type <code>klass</code>.
- *
- * @param obj Instance to setup.
- * @param klass Class type of the specified instance.
- * @param field_name Name of the field in the specified class type.
- * @param val The "object" value to write into the field.
- * @throws InvalidClassException if the specified field has not the required type.
- * @throws IOException if there is no field of that name in the specified class.
- */
- private void setObjectField(Object obj, Class klass, String field_name,
- String type_code, Object val) throws IOException, InvalidClassException
- {
- try
- {
- Field f = getField(klass, field_name);
- ObjectStreamField of = new ObjectStreamField(field_name, f.getType());
-
- if (of.getTypeString() == null ||
- !of.getTypeString().equals(type_code))
- throw new InvalidClassException("incompatible field type for " + klass.getName() + "." + field_name);
- f.set(obj, val);
- }
- catch (InvalidClassException e)
- {
- throw e;
- }
- catch (Exception _)
- {
- }
- }
-
private static final int BUFFER_SIZE = 1024;
- private static final Class[] readObjectParams = { ObjectInputStream.class };
private DataInputStream realInputStream;
private DataInputStream dataInputStream;
@@ -2106,18 +1797,16 @@ public class ObjectInputStream extends InputStream
private Hashtable classLookupTable;
private GetField prereadFields;
- private static boolean dump;
+ private static boolean dump = false && Configuration.DEBUG;
private void dumpElement (String msg)
{
- if (Configuration.DEBUG && dump)
- System.out.print(msg);
+ System.out.print(msg);
}
private void dumpElementln (String msg)
{
- if (Configuration.DEBUG && dump)
- System.out.println(msg);
+ System.out.println(msg);
}
static
diff --git a/libjava/java/io/ObjectStreamClass.java b/libjava/java/io/ObjectStreamClass.java
index 5bd0e686625..429db187b47 100644
--- a/libjava/java/io/ObjectStreamClass.java
+++ b/libjava/java/io/ObjectStreamClass.java
@@ -45,9 +45,11 @@ import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
+import java.security.AccessController;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.security.PrivilegedAction;
import java.security.Security;
import java.util.Arrays;
import java.util.Comparator;
@@ -192,29 +194,6 @@ public class ObjectStreamClass implements Serializable
return (flags & ObjectStreamConstants.SC_WRITE_METHOD) != 0;
}
-
- // Returns true iff the class that this ObjectStreamClass represents
- // has the following method:
- //
- // private void readObject (ObjectOutputStream)
- //
- // This method is used by the class to override default
- // serialization behavior.
- boolean hasReadMethod()
- {
- try
- {
- Class[] readObjectParams = { ObjectInputStream.class };
- forClass().getDeclaredMethod("readObject", readObjectParams);
- return true;
- }
- catch (NoSuchMethodException e)
- {
- return false;
- }
- }
-
-
// Returns true iff the class that this ObjectStreamClass represents
// implements Serializable but does *not* implement Externalizable.
boolean isSerializable()
@@ -306,6 +285,8 @@ public class ObjectStreamClass implements Serializable
{
this.clazz = cl;
+ cacheMethods();
+
long class_uid = getClassUID(cl);
if (uid == 0)
uid = class_uid;
@@ -452,6 +433,50 @@ public class ObjectStreamClass implements Serializable
fields[i].setOffset(objectFieldCount++);
}
+ private Method findMethod(Method[] methods, String name, Class[] params,
+ Class returnType)
+ {
+outer:
+ for(int i = 0; i < methods.length; i++)
+ {
+ if(methods[i].getName().equals(name) &&
+ methods[i].getReturnType() == returnType)
+ {
+ Class[] mp = methods[i].getParameterTypes();
+ if(mp.length == params.length)
+ {
+ for(int j = 0; j < mp.length; j++)
+ {
+ if(mp[j] != params[j])
+ {
+ continue outer;
+ }
+ }
+ final Method m = methods[i];
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ m.setAccessible(true);
+ return null;
+ }
+ });
+ return m;
+ }
+ }
+ }
+ return null;
+ }
+
+ private void cacheMethods()
+ {
+ Method[] methods = forClass().getDeclaredMethods();
+ readObjectMethod = findMethod(methods, "readObject",
+ new Class[] { ObjectInputStream.class },
+ Void.TYPE);
+ readResolveMethod = findMethod(methods, "readResolve",
+ new Class[0], Object.class);
+ }
private ObjectStreamClass(Class cl)
{
@@ -460,6 +485,7 @@ public class ObjectStreamClass implements Serializable
isProxyClass = Proxy.isProxyClass(cl);
clazz = cl;
+ cacheMethods();
name = cl.getName();
setFlags(cl);
setFields(cl);
@@ -508,9 +534,16 @@ public class ObjectStreamClass implements Serializable
try
{
- Field serialPersistentFields =
+ final Field serialPersistentFields =
cl.getDeclaredField("serialPersistentFields");
- serialPersistentFields.setAccessible(true);
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ serialPersistentFields.setAccessible(true);
+ return null;
+ }
+ });
int modifiers = serialPersistentFields.getModifiers();
if (Modifier.isStatic(modifiers)
@@ -553,12 +586,28 @@ public class ObjectStreamClass implements Serializable
for (int from = 0, to = 0; from < all_fields.length; from++)
if (all_fields[from] != null)
{
- Field f = all_fields[from];
- fields[to] = new ObjectStreamField(f.getName(), f.getType());
+ final Field f = all_fields[from];
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ f.setAccessible(true);
+ return null;
+ }
+ });
+ fields[to] = new ObjectStreamField(all_fields[from]);
to++;
}
Arrays.sort(fields);
+ // Make sure we don't have any duplicate field names
+ // (Sun JDK 1.4.1. throws an Internal Error as well)
+ for (int i = 1; i < fields.length; i++)
+ {
+ if(fields[i - 1].getName().equals(fields[i].getName()))
+ throw new InternalError("Duplicate field " +
+ fields[i].getName() + " in class " + cl.getName());
+ }
calculateOffsets();
}
@@ -571,8 +620,15 @@ public class ObjectStreamClass implements Serializable
// Use getDeclaredField rather than getField, since serialVersionUID
// may not be public AND we only want the serialVersionUID of this
// class, not a superclass or interface.
- Field suid = cl.getDeclaredField("serialVersionUID");
- suid.setAccessible(true);
+ final Field suid = cl.getDeclaredField("serialVersionUID");
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ suid.setAccessible(true);
+ return null;
+ }
+ });
int modifiers = suid.getModifiers();
if (Modifier.isStatic(modifiers)
@@ -769,6 +825,13 @@ public class ObjectStreamClass implements Serializable
int primFieldSize = -1; // -1 if not yet calculated
int objectFieldCount;
+ Method readObjectMethod;
+ Method readResolveMethod;
+ boolean realClassIsSerializable;
+ boolean realClassIsExternalizable;
+ ObjectStreamField[] fieldMapping;
+ Class firstNonSerializableParent;
+
boolean isProxyClass = false;
// This is probably not necessary because this class is special cased already
diff --git a/libjava/java/io/ObjectStreamField.java b/libjava/java/io/ObjectStreamField.java
index cb2fdbc0d25..603fe30917d 100644
--- a/libjava/java/io/ObjectStreamField.java
+++ b/libjava/java/io/ObjectStreamField.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.io;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import gnu.java.lang.reflect.TypeSignature;
/**
@@ -54,6 +56,14 @@ public class ObjectStreamField implements Comparable
private boolean unshared;
private boolean persistent = false;
private boolean toset = true;
+ private Field field;
+
+ ObjectStreamField (Field field)
+ {
+ this (field.getName(), field.getType());
+ this.field = field;
+ toset = !Modifier.isFinal(field.getModifiers());
+ }
/**
* This constructor creates an ObjectStreamField instance
@@ -105,7 +115,6 @@ public class ObjectStreamField implements Comparable
}
catch(ClassNotFoundException e)
{
- type = Object.class; //FIXME: ???
}
}
@@ -128,7 +137,6 @@ public class ObjectStreamField implements Comparable
}
catch(ClassNotFoundException e)
{
- type = Object.class; // ALSO FIXME
}
}
@@ -176,7 +184,7 @@ public class ObjectStreamField implements Comparable
public String getTypeString ()
{
// use intern()
- if (this.type.isPrimitive())
+ if (isPrimitive())
return null;
return typename.intern();
}
@@ -225,7 +233,7 @@ public class ObjectStreamField implements Comparable
*/
public boolean isPrimitive ()
{
- return type.isPrimitive ();
+ return typename.length() == 1;
}
public int compareTo (Object o)
@@ -299,5 +307,112 @@ public class ObjectStreamField implements Comparable
{
return "ObjectStreamField< " + type + " " + name + " >";
}
-}
+ final void setBooleanField(Object obj, boolean val)
+ {
+ try
+ {
+ field.setBoolean(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setByteField(Object obj, byte val)
+ {
+ try
+ {
+ field.setByte(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setCharField(Object obj, char val)
+ {
+ try
+ {
+ field.setChar(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setShortField(Object obj, short val)
+ {
+ try
+ {
+ field.setShort(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setIntField(Object obj, int val)
+ {
+ try
+ {
+ field.setInt(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setLongField(Object obj, long val)
+ {
+ try
+ {
+ field.setLong(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setFloatField(Object obj, float val)
+ {
+ try
+ {
+ field.setFloat(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setDoubleField(Object obj, double val)
+ {
+ try
+ {
+ field.setDouble(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+
+ final void setObjectField(Object obj, Object val)
+ {
+ try
+ {
+ field.set(obj, val);
+ }
+ catch(IllegalAccessException x)
+ {
+ throw new InternalError(x.getMessage());
+ }
+ }
+}
diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java
index 0d61b5e4dbf..6a65482f637 100644
--- a/libjava/java/lang/Class.java
+++ b/libjava/java/lang/Class.java
@@ -191,12 +191,11 @@ public final class Class implements Serializable
* @since 1.1
*/
public native Constructor getConstructor(Class[] args)
- throws NoSuchMethodException, SecurityException;
+ throws NoSuchMethodException;
// This is used to implement getConstructors and
// getDeclaredConstructors.
- private native Constructor[] _getConstructors (boolean declared)
- throws SecurityException;
+ private native Constructor[] _getConstructors (boolean declared);
/**
* Get all the public constructors of this class. This returns an array of
@@ -211,7 +210,6 @@ public final class Class implements Serializable
* @since 1.1
*/
public Constructor[] getConstructors()
- throws SecurityException
{
return _getConstructors(false);
}
@@ -231,7 +229,7 @@ public final class Class implements Serializable
* @since 1.1
*/
public native Constructor getDeclaredConstructor(Class[] args)
- throws NoSuchMethodException, SecurityException;
+ throws NoSuchMethodException;
/**
* Get all the declared member classes and interfaces in this class, but
@@ -245,7 +243,7 @@ public final class Class implements Serializable
* @throws SecurityException if the security check fails
* @since 1.1
*/
- public native Class[] getDeclaredClasses() throws SecurityException;
+ public native Class[] getDeclaredClasses();
/**
* Get all the declared constructors of this class. This returns an array of
@@ -260,7 +258,6 @@ public final class Class implements Serializable
* @since 1.1
*/
public Constructor[] getDeclaredConstructors()
- throws SecurityException
{
return _getConstructors(true);
}
@@ -279,7 +276,7 @@ public final class Class implements Serializable
* @since 1.1
*/
public native Field getDeclaredField(String fieldName)
- throws NoSuchFieldException, SecurityException;
+ throws NoSuchFieldException;
/**
* Get all the declared fields in this class, but not those inherited from
@@ -325,7 +322,7 @@ public final class Class implements Serializable
* @since 1.1
*/
public Method getDeclaredMethod(String methodName, Class[] args)
- throws NoSuchMethodException, SecurityException
+ throws NoSuchMethodException
{
memberAccessCheck(Member.DECLARED);
@@ -354,7 +351,7 @@ public final class Class implements Serializable
* @throws SecurityException if the security check fails
* @since 1.1
*/
- public native Method[] getDeclaredMethods () throws SecurityException;
+ public native Method[] getDeclaredMethods();
/**
* If this is a nested or inner class, return the class that declared it.
@@ -367,7 +364,7 @@ public final class Class implements Serializable
public native Class getDeclaringClass ();
private native Field getField (String fieldName, int hash)
- throws NoSuchFieldException, SecurityException;
+ throws NoSuchFieldException;
/**
* Get a public field declared or inherited in this class, where name is
@@ -385,7 +382,7 @@ public final class Class implements Serializable
* @since 1.1
*/
public Field getField(String fieldName)
- throws NoSuchFieldException, SecurityException
+ throws NoSuchFieldException
{
memberAccessCheck(Member.PUBLIC);
Field field = getField(fieldName, fieldName.hashCode());
@@ -491,7 +488,7 @@ public final class Class implements Serializable
* @since 1.1
*/
public Method getMethod(String methodName, Class[] args)
- throws NoSuchMethodException, SecurityException
+ throws NoSuchMethodException
{
memberAccessCheck(Member.PUBLIC);
@@ -522,7 +519,7 @@ public final class Class implements Serializable
* @throws SecurityException if the security check fails
* @since 1.1
*/
- public native Method[] getMethods () throws SecurityException;
+ public native Method[] getMethods();
/**
* Get the modifiers of this class. These can be decoded using Modifier,
diff --git a/libjava/java/lang/Thread.java b/libjava/java/lang/Thread.java
index b5645d497a8..30c35aa8f3c 100644
--- a/libjava/java/lang/Thread.java
+++ b/libjava/java/lang/Thread.java
@@ -89,14 +89,279 @@ import gnu.gcj.RawData;
*/
public class Thread implements Runnable
{
- /** The maximum priority for a Thread. */
- public final static int MAX_PRIORITY = 10;
-
/** The minimum priority for a Thread. */
- public final static int MIN_PRIORITY = 1;
+ public static final int MIN_PRIORITY = 1;
/** The priority a Thread gets by default. */
- public final static int NORM_PRIORITY = 5;
+ public static final int NORM_PRIORITY = 5;
+
+ /** The maximum priority for a Thread. */
+ public static final int MAX_PRIORITY = 10;
+
+ /**
+ * The group this thread belongs to. This is set to null by
+ * ThreadGroup.removeThread when the thread dies.
+ */
+ ThreadGroup group;
+
+ /** The thread name, non-null. */
+ String name;
+
+ /** The object to run(), null if this is the target. */
+ private Runnable runnable;
+
+ /** The thread priority, 1 to 10. */
+ private int priority;
+
+ private boolean daemon_flag;
+ boolean interrupt_flag;
+ private boolean alive_flag;
+ private boolean startable_flag;
+ private ClassLoader context_class_loader;
+
+ // This describes the top-most interpreter frame for this thread.
+ RawData interp_frame;
+
+ // Our native data - points to an instance of struct natThread.
+ private Object data;
+
+ /**
+ * Allocates a new <code>Thread</code> object. This constructor has
+ * the same effect as <code>Thread(null, null,</code>
+ * <i>gname</i><code>)</code>, where <b><i>gname</i></b> is
+ * a newly generated name. Automatically generated names are of the
+ * form <code>"Thread-"+</code><i>n</i>, where <i>n</i> is an integer.
+ * <p>
+ * Threads created this way must have overridden their
+ * <code>run()</code> method to actually do anything. An example
+ * illustrating this method being used follows:
+ * <p><blockquote><pre>
+ * import java.lang.*;
+ *
+ * class plain01 implements Runnable {
+ * String name;
+ * plain01() {
+ * name = null;
+ * }
+ * plain01(String s) {
+ * name = s;
+ * }
+ * public void run() {
+ * if (name == null)
+ * System.out.println("A new thread created");
+ * else
+ * System.out.println("A new thread with name " + name +
+ * " created");
+ * }
+ * }
+ * class threadtest01 {
+ * public static void main(String args[] ) {
+ * int failed = 0 ;
+ *
+ * <b>Thread t1 = new Thread();</b>
+ * if (t1 != null)
+ * System.out.println("new Thread() succeed");
+ * else {
+ * System.out.println("new Thread() failed");
+ * failed++;
+ * }
+ * }
+ * }
+ * </pre></blockquote>
+ *
+ * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
+ * java.lang.Runnable, java.lang.String)
+ */
+ public Thread()
+ {
+ this(null, null, gen_name());
+ }
+
+ /**
+ * Allocates a new <code>Thread</code> object. This constructor has
+ * the same effect as <code>Thread(null, target,</code>
+ * <i>gname</i><code>)</code>, where <i>gname</i> is
+ * a newly generated name. Automatically generated names are of the
+ * form <code>"Thread-"+</code><i>n</i>, where <i>n</i> is an integer.
+ *
+ * @param target the object whose <code>run</code> method is called.
+ * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
+ * java.lang.Runnable, java.lang.String)
+ */
+ public Thread(Runnable target)
+ {
+ this(null, target, gen_name());
+ }
+
+ /**
+ * Allocates a new <code>Thread</code> object. This constructor has
+ * the same effect as <code>Thread(null, null, name)</code>.
+ *
+ * @param name the name of the new thread.
+ * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
+ * java.lang.Runnable, java.lang.String)
+ */
+ public Thread(String name)
+ {
+ this(null, null, name);
+ }
+
+ /**
+ * Allocate a new Thread object, with the specified ThreadGroup and name, and
+ * using the specified Runnable object's <code>run()</code> method to
+ * execute. If the Runnable object is null, <code>this</code> (which is
+ * a Runnable) is used instead.
+ *
+ * <p>If the ThreadGroup is null, the security manager is checked. If a
+ * manager exists and returns a non-null object for
+ * <code>getThreadGroup</code>, that group is used; otherwise the group
+ * of the creating thread is used. Note that the security manager calls
+ * <code>checkAccess</code> if the ThreadGroup is not null.
+ *
+ * <p>The new Thread will inherit its creator's priority and daemon status.
+ * These can be changed with <code>setPriority</code> and
+ * <code>setDaemon</code>.
+ *
+ * @param group the group to put the Thread into
+ * @param target the Runnable object to execute
+ * @param name the name for the Thread
+ * @throws NullPointerException if name is null
+ * @throws SecurityException if this thread cannot access <code>group</code>
+ * @throws IllegalThreadStateException if group is destroyed
+ * @see Runnable#run()
+ * @see #run()
+ * @see #setDaemon(boolean)
+ * @see #setPriority(int)
+ * @see SecurityManager#checkAccess(ThreadGroup)
+ * @see ThreadGroup#checkAccess()
+ */
+ public Thread(ThreadGroup group, Runnable target, String name)
+ {
+ this(currentThread(), group, target, name);
+ }
+
+ /**
+ * Allocate a new Thread object, as if by
+ * <code>Thread(group, null, name)</code>, and give it the specified stack
+ * size, in bytes. The stack size is <b>highly platform independent</b>,
+ * and the virtual machine is free to round up or down, or ignore it
+ * completely. A higher value might let you go longer before a
+ * <code>StackOverflowError</code>, while a lower value might let you go
+ * longer before an <code>OutOfMemoryError</code>. Or, it may do absolutely
+ * nothing! So be careful, and expect to need to tune this value if your
+ * virtual machine even supports it.
+ *
+ * @param group the group to put the Thread into
+ * @param target the Runnable object to execute
+ * @param name the name for the Thread
+ * @param size the stack size, in bytes; 0 to be ignored
+ * @throws NullPointerException if name is null
+ * @throws SecurityException if this thread cannot access <code>group</code>
+ * @throws IllegalThreadStateException if group is destroyed
+ * @since 1.4
+ */
+ public Thread(ThreadGroup group, Runnable target, String name, long size)
+ {
+ // Just ignore stackSize for now.
+ this(currentThread(), group, target, name);
+ }
+
+ /**
+ * Allocates a new <code>Thread</code> object. This constructor has
+ * the same effect as <code>Thread(group, target,</code>
+ * <i>gname</i><code>)</code>, where <i>gname</i> is
+ * a newly generated name. Automatically generated names are of the
+ * form <code>"Thread-"+</code><i>n</i>, where <i>n</i> is an integer.
+ *
+ * @param group the thread group.
+ * @param target the object whose <code>run</code> method is called.
+ * @exception SecurityException if the current thread cannot create a
+ * thread in the specified thread group.
+ * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
+ * java.lang.Runnable, java.lang.String)
+ */
+ public Thread(ThreadGroup group, Runnable target)
+ {
+ this(group, target, gen_name());
+ }
+
+ /**
+ * Allocates a new <code>Thread</code> object. This constructor has
+ * the same effect as <code>Thread(group, null, name)</code>
+ *
+ * @param group the thread group.
+ * @param name the name of the new thread.
+ * @exception SecurityException if the current thread cannot create a
+ * thread in the specified thread group.
+ * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
+ * java.lang.Runnable, java.lang.String)
+ */
+ public Thread(ThreadGroup group, String name)
+ {
+ this(group, null, name);
+ }
+
+ /**
+ * Allocates a new <code>Thread</code> object. This constructor has
+ * the same effect as <code>Thread(null, target, name)</code>.
+ *
+ * @param target the object whose <code>run</code> method is called.
+ * @param name the name of the new thread.
+ * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
+ * java.lang.Runnable, java.lang.String)
+ */
+ public Thread(Runnable target, String name)
+ {
+ this(null, target, name);
+ }
+
+ private Thread (Thread current, ThreadGroup g, Runnable r, String n)
+ {
+ // The Class Libraries book says ``threadName cannot be null''. I
+ // take this to mean NullPointerException.
+ if (n == null)
+ throw new NullPointerException ();
+
+ if (g == null)
+ {
+ // If CURRENT is null, then we are bootstrapping the first thread.
+ // Use ThreadGroup.root, the main threadgroup.
+ if (current == null)
+ group = ThreadGroup.root;
+ else
+ group = current.getThreadGroup();
+ }
+ else
+ group = g;
+
+ data = null;
+ interrupt_flag = false;
+ alive_flag = false;
+ startable_flag = true;
+
+ if (current != null)
+ {
+ group.checkAccess();
+
+ daemon_flag = current.isDaemon();
+ int gmax = group.getMaxPriority();
+ int pri = current.getPriority();
+ priority = (gmax < pri ? gmax : pri);
+ context_class_loader = current.context_class_loader;
+ InheritableThreadLocal.newChildThread(this);
+ }
+ else
+ {
+ daemon_flag = false;
+ priority = NORM_PRIORITY;
+ }
+
+ name = n;
+ group.addThread(this);
+ runnable = r;
+
+ initialize_native ();
+ }
/**
* Get the number of active threads in the current Thread's ThreadGroup.
@@ -106,7 +371,7 @@ public class Thread implements Runnable
* @return the number of active threads in the current ThreadGroup
* @see ThreadGroup#activeCount()
*/
- public static int activeCount ()
+ public static int activeCount()
{
return currentThread().getThreadGroup().activeCount();
}
@@ -118,11 +383,11 @@ public class Thread implements Runnable
* @throws SecurityException if the current Thread cannot modify this Thread
* @see SecurityManager#checkAccess(Thread)
*/
- public final void checkAccess ()
+ public final void checkAccess()
{
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkAccess(this);
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkAccess(this);
}
/**
@@ -133,20 +398,20 @@ public class Thread implements Runnable
* @throws IllegalThreadStateException if this Thread is not suspended
* @deprecated pointless, since suspend is deprecated
*/
- public native int countStackFrames ();
+ public native int countStackFrames();
/**
* Get the currently executing Thread.
*
* @return the currently executing Thread
*/
- public static native Thread currentThread ();
+ public static native Thread currentThread();
/**
* Originally intended to destroy this thread, this method was never
* implemented by Sun, and is hence a no-op.
*/
- public native void destroy ();
+ public native void destroy();
/**
* Print a stack trace of the current thread to stderr using the same
@@ -154,9 +419,9 @@ public class Thread implements Runnable
*
* @see Throwable#printStackTrace()
*/
- public static void dumpStack ()
+ public static void dumpStack()
{
- (new Exception ("Stack trace")).printStackTrace ();
+ (new Exception("Stack trace")).printStackTrace();
}
/**
@@ -173,9 +438,9 @@ public class Thread implements Runnable
* @see #activeCount()
* @see SecurityManager#checkAccess(ThreadGroup)
*/
- public static int enumerate (Thread[] threads)
+ public static int enumerate(Thread[] array)
{
- return currentThread().group.enumerate(threads);
+ return currentThread().group.enumerate(array);
}
/**
@@ -183,7 +448,7 @@ public class Thread implements Runnable
*
* @return this Thread's name
*/
- public final String getName ()
+ public final String getName()
{
return name;
}
@@ -193,7 +458,7 @@ public class Thread implements Runnable
*
* @return the Thread's priority
*/
- public final int getPriority ()
+ public final int getPriority()
{
return priority;
}
@@ -204,7 +469,7 @@ public class Thread implements Runnable
*
* @return this Thread's ThreadGroup
*/
- public final ThreadGroup getThreadGroup ()
+ public final ThreadGroup getThreadGroup()
{
return group;
}
@@ -213,10 +478,11 @@ public class Thread implements Runnable
* Return true if this Thread holds the object's lock, false otherwise.
*
* @param obj the object to test lock ownership on.
+ * @return true if the current thread is currently synchronized on obj
* @throws NullPointerException if obj is null.
* @since 1.4
*/
- public static native boolean holdsLock (Object obj);
+ public static native boolean holdsLock(Object obj);
/**
* Interrupt this Thread. First, there is a security check,
@@ -240,7 +506,7 @@ public class Thread implements Runnable
*
* @throws SecurityException if you cannot modify this Thread
*/
- public native void interrupt ();
+ public native void interrupt();
/**
* Determine whether the current Thread has been interrupted, and clear
@@ -249,19 +515,19 @@ public class Thread implements Runnable
* @return whether the current Thread has been interrupted
* @see #isInterrupted()
*/
- public static boolean interrupted ()
+ public static boolean interrupted()
{
- return currentThread().isInterrupted (true);
+ return currentThread().isInterrupted(true);
}
/**
* Determine whether the given Thread has been interrupted, but leave
* the <i>interrupted status</i> alone in the process.
*
- * @return whether the current Thread has been interrupted
+ * @return whether the Thread has been interrupted
* @see #interrupted()
*/
- public boolean isInterrupted ()
+ public boolean isInterrupted()
{
return interrupt_flag;
}
@@ -272,7 +538,7 @@ public class Thread implements Runnable
*
* @return whether this Thread is alive
*/
- public final boolean isAlive ()
+ public final boolean isAlive()
{
return alive_flag;
}
@@ -283,7 +549,7 @@ public class Thread implements Runnable
* @return whether this is a daemon Thread or not
* @see #setDaemon(boolean)
*/
- public final boolean isDaemon ()
+ public final boolean isDaemon()
{
return daemon_flag;
}
@@ -294,9 +560,9 @@ public class Thread implements Runnable
* @throws InterruptedException if the Thread is interrupted; it's
* <i>interrupted status</i> will be cleared
*/
- public final void join () throws InterruptedException
+ public final void join() throws InterruptedException
{
- join (0, 0);
+ join(0, 0);
}
/**
@@ -306,9 +572,9 @@ public class Thread implements Runnable
* @throws InterruptedException if the Thread is interrupted; it's
* <i>interrupted status</i> will be cleared
*/
- public final void join (long timeout) throws InterruptedException
+ public final void join(long ms) throws InterruptedException
{
- join (timeout, 0);
+ join(ms, 0);
}
/**
@@ -327,18 +593,20 @@ public class Thread implements Runnable
* @throws IllegalArgumentException if ns is invalid
* @XXX A ThreadListener would be nice, to make this efficient.
*/
- public final native void join (long timeout, int nanos)
+ public final native void join(long ms, int ns)
throws InterruptedException;
/**
* Resume a suspended thread.
*
- * @see #resume()
+ * @throws SecurityException if you cannot resume the Thread
+ * @see #checkAccess()
+ * @see #suspend()
* @deprecated pointless, since suspend is deprecated
*/
- public final native void resume ();
+ public final native void resume();
- private final native void finish_ ();
+ private final native void finish_();
/**
* Determine whether the given Thread has been interrupted, but leave
@@ -347,7 +615,7 @@ public class Thread implements Runnable
* @return whether the current Thread has been interrupted
* @see #interrupted()
*/
- private boolean isInterrupted (boolean clear_flag)
+ private boolean isInterrupted(boolean clear_flag)
{
boolean r = interrupt_flag;
if (clear_flag && r)
@@ -367,7 +635,7 @@ public class Thread implements Runnable
* @see #start()
* @see #Thread(ThreadGroup, Runnable, String)
*/
- public void run ()
+ public void run()
{
if (runnable != null)
runnable.run();
@@ -385,11 +653,11 @@ public class Thread implements Runnable
* @see #isDaemon()
* @see #checkAccess()
*/
- public final void setDaemon (boolean status)
+ public final void setDaemon(boolean status)
{
- checkAccess ();
+ checkAccess();
if (!startable_flag)
- throw new IllegalThreadStateException ();
+ throw new IllegalThreadStateException();
daemon_flag = status;
}
@@ -410,12 +678,12 @@ public class Thread implements Runnable
public synchronized ClassLoader getContextClassLoader()
{
if (context_class_loader == null)
- context_class_loader = ClassLoader.getSystemClassLoader ();
+ context_class_loader = ClassLoader.getSystemClassLoader();
- SecurityManager s = System.getSecurityManager();
+ SecurityManager sm = System.getSecurityManager();
// FIXME: we can't currently find the caller's class loader.
ClassLoader callers = null;
- if (s != null && callers != null)
+ if (sm != null && callers != null)
{
// See if the caller's class loader is the same as or an
// ancestor of this thread's class loader.
@@ -423,36 +691,34 @@ public class Thread implements Runnable
{
// FIXME: should use some internal version of getParent
// that avoids security checks.
- callers = callers.getParent ();
+ callers = callers.getParent();
}
if (callers != context_class_loader)
- s.checkPermission (new RuntimePermission ("getClassLoader"));
+ sm.checkPermission(new RuntimePermission("getClassLoader"));
}
return context_class_loader;
}
/**
- * Returns the context classloader of this Thread. The context
- * classloader can be used by code that want to load classes depending
- * on the current thread. Normally classes are loaded depending on
- * the classloader of the current class. There may be a security check
- * for <code>RuntimePermission("getClassLoader")</code> if the caller's
- * class loader is not null or an ancestor of this thread's context class
- * loader.
+ * Sets the context classloader for this Thread. When not explicitly set,
+ * the context classloader for a thread is the same as the context
+ * classloader of the thread that created this thread. The first thread has
+ * as context classloader the system classloader. There may be a security
+ * check for <code>RuntimePermission("setContextClassLoader")</code>.
*
- * @return the context class loader
+ * @param classloader the new context class loader
* @throws SecurityException when permission is denied
- * @see setContextClassLoader(ClassLoader)
+ * @see getContextClassLoader()
* @since 1.2
*/
- public synchronized void setContextClassLoader(ClassLoader cl)
+ public synchronized void setContextClassLoader(ClassLoader classloader)
{
- SecurityManager s = System.getSecurityManager ();
- if (s != null)
- s.checkPermission (new RuntimePermission ("setContextClassLoader"));
- context_class_loader = cl;
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new RuntimePermission("setContextClassLoader"));
+ context_class_loader = classloader;
}
/**
@@ -463,32 +729,21 @@ public class Thread implements Runnable
* @throws NullPointerException if name is null
* @throws SecurityException if you cannot modify this Thread
*/
- public final void setName (String n)
+ public final void setName(String name)
{
- checkAccess ();
+ checkAccess();
// The Class Libraries book says ``threadName cannot be null''. I
// take this to mean NullPointerException.
- if (n == null)
- throw new NullPointerException ();
- name = n;
+ if (name == null)
+ throw new NullPointerException();
+ this.name = name;
}
/**
- * Set this Thread's priority. There may be a security check,
- * <code>checkAccess</code>, then the priority is set to the smaller of
- * priority and the ThreadGroup maximum priority.
- *
- * @param priority the new priority for this Thread
- * @throws IllegalArgumentException if priority exceeds MIN_PRIORITY or
- * MAX_PRIORITY
- * @throws SecurityException if you cannot modify this Thread
- * @see #getPriority()
- * @see #checkAccess()
- * @see ThreadGroup#getMaxPriority()
- * @see #MIN_PRIORITY
- * @see #MAX_PRIORITY
+ * Causes the currently executing thread object to temporarily pause
+ * and allow other threads to execute.
*/
- public final native void setPriority (int newPriority);
+ public static native void yield();
/**
* Suspend the current Thread's execution for the specified amount of
@@ -502,9 +757,9 @@ public class Thread implements Runnable
* @see #notify()
* @see #wait(long)
*/
- public static void sleep (long timeout) throws InterruptedException
+ public static void sleep(long ms) throws InterruptedException
{
- sleep (timeout, 0);
+ sleep(ms, 0);
}
/**
@@ -527,7 +782,7 @@ public class Thread implements Runnable
* @see #notify()
* @see #wait(long, int)
*/
- public static native void sleep (long timeout, int nanos)
+ public static native void sleep(long timeout, int nanos)
throws InterruptedException;
/**
@@ -540,7 +795,7 @@ public class Thread implements Runnable
* @throws IllegalThreadStateException if the thread has already started
* @see #run()
*/
- public native void start ();
+ public native void start();
/**
* Cause this Thread to stop abnormally because of the throw of a ThreadDeath
@@ -565,11 +820,11 @@ public class Thread implements Runnable
* @see SecurityManager#checkPermission(Permission)
* @deprecated unsafe operation, try not to use
*/
- public final void stop ()
+ public final void stop()
{
// Argument doesn't matter, because this is no longer
// supported.
- stop (null);
+ stop(null);
}
/**
@@ -599,7 +854,7 @@ public class Thread implements Runnable
* @see SecurityManager#checkPermission(Permission)
* @deprecated unsafe operation, try not to use
*/
- public final native void stop (Throwable e);
+ public final native void stop(Throwable e);
/**
* Suspend this Thread. It will not come back, ever, unless it is resumed.
@@ -613,282 +868,38 @@ public class Thread implements Runnable
* @see #resume()
* @deprecated unsafe operation, try not to use
*/
- public final native void suspend ();
-
- private final native void initialize_native ();
-
- private final native static String gen_name ();
-
- /**
- * Allocate a new Thread object, with the specified ThreadGroup and name, and
- * using the specified Runnable object's <code>run()</code> method to
- * execute. If the Runnable object is null, <code>this</code> (which is
- * a Runnable) is used instead.
- *
- * <p>If the ThreadGroup is null, the security manager is checked. If a
- * manager exists and returns a non-null object for
- * <code>getThreadGroup</code>, that group is used; otherwise the group
- * of the creating thread is used. Note that the security manager calls
- * <code>checkAccess</code> if the ThreadGroup is not null.
- *
- * <p>The new Thread will inherit its creator's priority and daemon status.
- * These can be changed with <code>setPriority</code> and
- * <code>setDaemon</code>.
- *
- * @param group the group to put the Thread into
- * @param target the Runnable object to execute
- * @param name the name for the Thread
- * @throws NullPointerException if name is null
- * @throws SecurityException if this thread cannot access <code>group</code>
- * @throws IllegalThreadStateException if group is destroyed
- * @see Runnable#run()
- * @see #run()
- * @see #setDaemon(boolean)
- * @see #setPriority(int)
- * @see SecurityManager#checkAccess(ThreadGroup)
- * @see ThreadGroup#checkAccess()
- */
- public Thread (ThreadGroup g, Runnable r, String n)
- {
- this (currentThread (), g, r, n);
- }
-
- /**
- * Allocate a new Thread object, as if by
- * <code>Thread(group, null, name)</code>, and give it the specified stack
- * size, in bytes. The stack size is <b>highly platform independent</b>,
- * and the virtual machine is free to round up or down, or ignore it
- * completely. A higher value might let you go longer before a
- * <code>StackOverflowError</code>, while a lower value might let you go
- * longer before an <code>OutOfMemoryError</code>. Or, it may do absolutely
- * nothing! So be careful, and expect to need to tune this value if your
- * virtual machine even supports it.
- *
- * @param group the group to put the Thread into
- * @param target the Runnable object to execute
- * @param name the name for the Thread
- * @param size the stack size, in bytes; 0 to be ignored
- * @throws NullPointerException if name is null
- * @throws SecurityException if this thread cannot access <code>group</code>
- * @throws IllegalThreadStateException if group is destroyed
- * @since 1.4
- */
- public Thread (ThreadGroup g, Runnable r, String n, long size)
- {
- // Just ignore stackSize for now.
- this (currentThread (), g, r, n);
- }
-
- private Thread (Thread current, ThreadGroup g, Runnable r, String n)
- {
- // The Class Libraries book says ``threadName cannot be null''. I
- // take this to mean NullPointerException.
- if (n == null)
- throw new NullPointerException ();
-
- if (g == null)
- {
- // If CURRENT is null, then we are bootstrapping the first thread.
- // Use ThreadGroup.root, the main threadgroup.
- if (current == null)
- group = ThreadGroup.root;
- else
- group = current.getThreadGroup();
- }
- else
- group = g;
-
- data = null;
- interrupt_flag = false;
- alive_flag = false;
- startable_flag = true;
-
- if (current != null)
- {
- group.checkAccess();
-
- daemon_flag = current.isDaemon();
- int gmax = group.getMaxPriority();
- int pri = current.getPriority();
- priority = (gmax < pri ? gmax : pri);
- context_class_loader = current.context_class_loader;
- InheritableThreadLocal.newChildThread(this);
- }
- else
- {
- daemon_flag = false;
- priority = NORM_PRIORITY;
- }
-
- name = n;
- group.addThread(this);
- runnable = r;
-
- initialize_native ();
- }
+ public final native void suspend();
/**
- * Allocates a new <code>Thread</code> object. This constructor has
- * the same effect as <code>Thread(null, null,</code>
- * <i>gname</i><code>)</code>, where <b><i>gname</i></b> is
- * a newly generated name. Automatically generated names are of the
- * form <code>"Thread-"+</code><i>n</i>, where <i>n</i> is an integer.
- * <p>
- * Threads created this way must have overridden their
- * <code>run()</code> method to actually do anything. An example
- * illustrating this method being used follows:
- * <p><blockquote><pre>
- * import java.lang.*;
- *
- * class plain01 implements Runnable {
- * String name;
- * plain01() {
- * name = null;
- * }
- * plain01(String s) {
- * name = s;
- * }
- * public void run() {
- * if (name == null)
- * System.out.println("A new thread created");
- * else
- * System.out.println("A new thread with name " + name +
- * " created");
- * }
- * }
- * class threadtest01 {
- * public static void main(String args[] ) {
- * int failed = 0 ;
- *
- * <b>Thread t1 = new Thread();</b>
- * if (t1 != null)
- * System.out.println("new Thread() succeed");
- * else {
- * System.out.println("new Thread() failed");
- * failed++;
- * }
- * }
- * }
- * </pre></blockquote>
- *
- * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
- * java.lang.Runnable, java.lang.String)
- */
- public Thread ()
- {
- this (null, null, gen_name ());
- }
-
- /**
- * Allocates a new <code>Thread</code> object. This constructor has
- * the same effect as <code>Thread(null, target,</code>
- * <i>gname</i><code>)</code>, where <i>gname</i> is
- * a newly generated name. Automatically generated names are of the
- * form <code>"Thread-"+</code><i>n</i>, where <i>n</i> is an integer.
- *
- * @param target the object whose <code>run</code> method is called.
- * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
- * java.lang.Runnable, java.lang.String)
- */
- public Thread (Runnable r)
- {
- this (null, r, gen_name ());
- }
-
- /**
- * Allocates a new <code>Thread</code> object. This constructor has
- * the same effect as <code>Thread(null, null, name)</code>.
- *
- * @param name the name of the new thread.
- * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
- * java.lang.Runnable, java.lang.String)
- */
- public Thread (String n)
- {
- this (null, null, n);
- }
-
- /**
- * Allocates a new <code>Thread</code> object. This constructor has
- * the same effect as <code>Thread(group, target,</code>
- * <i>gname</i><code>)</code>, where <i>gname</i> is
- * a newly generated name. Automatically generated names are of the
- * form <code>"Thread-"+</code><i>n</i>, where <i>n</i> is an integer.
- *
- * @param group the thread group.
- * @param target the object whose <code>run</code> method is called.
- * @exception SecurityException if the current thread cannot create a
- * thread in the specified thread group.
- * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
- * java.lang.Runnable, java.lang.String)
- */
- public Thread (ThreadGroup g, Runnable r)
- {
- this (g, r, gen_name ());
- }
-
- /**
- * Allocates a new <code>Thread</code> object. This constructor has
- * the same effect as <code>Thread(group, null, name)</code>
- *
- * @param group the thread group.
- * @param name the name of the new thread.
- * @exception SecurityException if the current thread cannot create a
- * thread in the specified thread group.
- * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
- * java.lang.Runnable, java.lang.String)
- */
- public Thread (ThreadGroup g, String n)
- {
- this (g, null, n);
- }
-
- /**
- * Allocates a new <code>Thread</code> object. This constructor has
- * the same effect as <code>Thread(null, target, name)</code>.
+ * Set this Thread's priority. There may be a security check,
+ * <code>checkAccess</code>, then the priority is set to the smaller of
+ * priority and the ThreadGroup maximum priority.
*
- * @param target the object whose <code>run</code> method is called.
- * @param name the name of the new thread.
- * @see java.lang.Thread#Thread(java.lang.ThreadGroup,
- * java.lang.Runnable, java.lang.String)
+ * @param priority the new priority for this Thread
+ * @throws IllegalArgumentException if priority exceeds MIN_PRIORITY or
+ * MAX_PRIORITY
+ * @throws SecurityException if you cannot modify this Thread
+ * @see #getPriority()
+ * @see #checkAccess()
+ * @see ThreadGroup#getMaxPriority()
+ * @see #MIN_PRIORITY
+ * @see #MAX_PRIORITY
*/
- public Thread (Runnable r, String n)
- {
- this (null, r, n);
- }
+ public final native void setPriority(int newPriority);
/**
* Returns a string representation of this thread, including the
* thread's name, priority, and thread group.
*
- * @return a string representation of this thread.
+ * @return a human-readable String representing this Thread
*/
- public String toString ()
+ public String toString()
{
- return "Thread[" + name + "," + priority + "," +
- (group == null ? "" : group.getName()) + "]";
+ return ("Thread[" + name + "," + priority + ","
+ + (group == null ? "" : group.getName()) + "]");
}
- /**
- * Causes the currently executing thread object to temporarily pause
- * and allow other threads to execute.
- */
- public static native void yield ();
-
- // Private data.
- ThreadGroup group;
- String name;
- private Runnable runnable;
- private int priority;
- private boolean daemon_flag;
- boolean interrupt_flag;
- private boolean alive_flag;
- private boolean startable_flag;
- private ClassLoader context_class_loader;
-
- // This describes the top-most interpreter frame for this thread.
- RawData interp_frame;
+ private final native void initialize_native();
- // Our native data - points to an instance of struct natThread.
- private Object data;
+ private final native static String gen_name();
}
diff --git a/libjava/java/lang/natPosixProcess.cc b/libjava/java/lang/natPosixProcess.cc
index ef469242fd6..a6dfc1ada28 100644
--- a/libjava/java/lang/natPosixProcess.cc
+++ b/libjava/java/lang/natPosixProcess.cc
@@ -1,6 +1,6 @@
// natPosixProcess.cc - Native side of POSIX process code.
-/* Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -207,7 +207,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
char *path_val = getenv ("PATH");
char *ld_path_val = getenv ("LD_LIBRARY_PATH");
environ = env;
- if (getenv ("PATH") == NULL)
+ if (path_val && getenv ("PATH") == NULL)
{
char *path_env = (char *) _Jv_Malloc (strlen (path_val)
+ 5 + 1);
@@ -215,7 +215,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
strcat (path_env, path_val);
putenv (path_env);
}
- if (getenv ("LD_LIBRARY_PATH") == NULL)
+ if (ld_path_val && getenv ("LD_LIBRARY_PATH") == NULL)
{
char *ld_path_env
= (char *) _Jv_Malloc (strlen (ld_path_val) + 16 + 1);
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java
index c9c0f5d0f03..c5920a09424 100644
--- a/libjava/java/net/DatagramSocket.java
+++ b/libjava/java/net/DatagramSocket.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.net;
import gnu.java.net.PlainDatagramSocketImpl;
+import gnu.java.nio.DatagramChannelImpl;
import java.io.IOException;
import java.nio.channels.DatagramChannel;
import java.nio.channels.IllegalBlockingModeException;
@@ -565,7 +566,8 @@ public class DatagramSocket
("Socket connected to a multicast address my not receive");
if (getChannel() != null
- && !getChannel().isBlocking ())
+ && !getChannel().isBlocking ()
+ && !((DatagramChannelImpl) getChannel()).isInChannelOperation())
throw new IllegalBlockingModeException ();
getImpl().receive(p);
@@ -618,7 +620,8 @@ public class DatagramSocket
// use getTimeToLive for TTL val.
if (getChannel() != null
- && !getChannel().isBlocking ())
+ && !getChannel().isBlocking ()
+ && !((DatagramChannelImpl) getChannel()).isInChannelOperation())
throw new IllegalBlockingModeException ();
getImpl().send(p);
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index 9a2d82d9c76..a53ebf674d1 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -1,5 +1,6 @@
/* ServerSocket.java -- Class for implementing server side sockets
- Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -345,9 +346,14 @@ public class ServerSocket
if (isClosed())
throw new SocketException("ServerSocket is closed");
+ // The Sun spec says that if we have an associated channel and
+ // it is in non-blocking mode, we throw an IllegalBlockingModeException.
+ // However, in our implementation if the channel itself initiated this
+ // operation, then we must honor it regardless of its blocking mode.
if (getChannel() != null
- && !getChannel().isBlocking())
- throw new IllegalBlockingModeException();
+ && !getChannel().isBlocking ()
+ && !((PlainSocketImpl) getImpl()).isInChannelOperation())
+ throw new IllegalBlockingModeException ();
impl.accept(socket.getImpl());
}
diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java
index 9322e929ec3..f9cbb7e6cb3 100644
--- a/libjava/java/net/Socket.java
+++ b/libjava/java/net/Socket.java
@@ -1,5 +1,6 @@
/* Socket.java -- Client socket implementation
- Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -420,8 +421,13 @@ public class Socket
if (! (endpoint instanceof InetSocketAddress))
throw new IllegalArgumentException("unsupported address type");
+ // The Sun spec says that if we have an associated channel and
+ // it is in non-blocking mode, we throw an IllegalBlockingModeException.
+ // However, in our implementation if the channel itself initiated this
+ // operation, then we must honor it regardless of its blocking mode.
if (getChannel() != null
- && !getChannel().isBlocking ())
+ && !getChannel().isBlocking ()
+ && !((PlainSocketImpl) getImpl()).isInChannelOperation())
throw new IllegalBlockingModeException ();
if (!isBound ())
diff --git a/libjava/java/nio/ByteBuffer.java b/libjava/java/nio/ByteBuffer.java
index 3be797750d0..9ca20618c45 100644
--- a/libjava/java/nio/ByteBuffer.java
+++ b/libjava/java/nio/ByteBuffer.java
@@ -1,5 +1,5 @@
/* ByteBuffer.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -382,8 +382,14 @@ public abstract class ByteBuffer extends Buffer
*/
public abstract ByteBuffer compact ();
+ void shiftDown (int dst_offset, int src_offset, int count)
+ {
+ for (int i = 0; i < count; i++)
+ put(dst_offset + i, get(src_offset + i));
+ }
+
/**
- * Tells wether or not this buffer is direct.
+ * Tells whether or not this buffer is direct.
*/
public abstract boolean isDirect ();
diff --git a/libjava/java/nio/ByteBufferHelper.java b/libjava/java/nio/ByteBufferHelper.java
index 23e133c86b3..c3dcfbe4f2f 100644
--- a/libjava/java/nio/ByteBufferHelper.java
+++ b/libjava/java/nio/ByteBufferHelper.java
@@ -1,5 +1,5 @@
/* ByteBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,58 +42,58 @@ package java.nio;
*/
final class ByteBufferHelper
{
- private static final void checkRemainingForRead (ByteBuffer buffer, int bytes)
+ private static void checkRemainingForRead (ByteBuffer buffer, int bytes)
{
if (buffer.remaining() < bytes)
throw new BufferUnderflowException();
}
- private static final void checkRemainingForWrite (ByteBuffer buffer, int bytes)
+ private static void checkRemainingForWrite (ByteBuffer buffer, int bytes)
{
if (buffer.remaining() < bytes)
throw new BufferOverflowException();
}
- private static final void checkAvailableForRead (ByteBuffer buffer,
- int index, int bytes)
+ private static void checkAvailableForRead (ByteBuffer buffer,
+ int index, int bytes)
{
if (buffer.limit() < (index + bytes))
throw new BufferUnderflowException();
}
- private static final void checkAvailableForWrite (ByteBuffer buffer,
- int index, int bytes)
+ private static void checkAvailableForWrite (ByteBuffer buffer,
+ int index, int bytes)
{
if (buffer.limit() < (index + bytes))
throw new BufferOverflowException();
}
- public static final char getChar (ByteBuffer buffer)
+ public static char getChar (ByteBuffer buffer, ByteOrder order)
{
- return (char) getShort (buffer);
+ return (char) getShort (buffer, order);
}
- public static final ByteBuffer putChar (ByteBuffer buffer, char value)
+ public static void putChar (ByteBuffer buffer, char value, ByteOrder order)
{
- return putShort (buffer, (short) value);
+ putShort (buffer, (short) value, order);
}
- public static final char getChar (ByteBuffer buffer, int index)
+ public static char getChar (ByteBuffer buffer, int index, ByteOrder order)
{
- return (char) getShort (buffer, index);
+ return (char) getShort (buffer, index, order);
}
- public static final ByteBuffer putChar (ByteBuffer buffer, int index,
- char value)
+ public static void putChar (ByteBuffer buffer, int index,
+ char value, ByteOrder order)
{
- return putShort (buffer, index, (short) value);
+ putShort (buffer, index, (short) value, order);
}
- public static final short getShort (ByteBuffer buffer)
+ public static short getShort (ByteBuffer buffer, ByteOrder order)
{
checkRemainingForRead (buffer, 2);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
return (short) ((buffer.get() & 0xff)
+ (buffer.get() << 8));
@@ -103,11 +103,11 @@ final class ByteBufferHelper
+ (buffer.get() & 0xff));
}
- public static final ByteBuffer putShort (ByteBuffer buffer, short value)
+ public static void putShort (ByteBuffer buffer, short value, ByteOrder order)
{
checkRemainingForWrite (buffer, 2);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
buffer.put ((byte) value);
buffer.put ((byte) (value >> 8));
@@ -117,15 +117,14 @@ final class ByteBufferHelper
buffer.put ((byte) (value >> 8));
buffer.put ((byte) value);
}
-
- return buffer;
}
- public static final short getShort (ByteBuffer buffer, int index)
+ public static short getShort (ByteBuffer buffer,
+ int index, ByteOrder order)
{
checkAvailableForRead (buffer, index, 2);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
return (short) ((buffer.get (index) & 0xff)
+ (buffer.get (++index) << 8));
@@ -135,12 +134,12 @@ final class ByteBufferHelper
+ (buffer.get (++index) & 0xff));
}
- public static final ByteBuffer putShort (ByteBuffer buffer, int index,
- short value)
+ public static void putShort (ByteBuffer buffer, int index,
+ short value, ByteOrder order)
{
checkAvailableForWrite (buffer, index, 2);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
buffer.put (index, (byte) value);
buffer.put (++index, (byte) (value >> 8));
@@ -150,15 +149,13 @@ final class ByteBufferHelper
buffer.put (index, (byte) (value >> 8));
buffer.put (++index, (byte) value);
}
-
- return buffer;
}
- public static final int getInt (ByteBuffer buffer)
+ public static int getInt (ByteBuffer buffer, ByteOrder order)
{
checkRemainingForRead (buffer, 4);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
return ((buffer.get() & 0xff)
+ ((buffer.get() & 0xff) << 8)
@@ -172,11 +169,11 @@ final class ByteBufferHelper
+ (buffer.get() & 0xff));
}
- public static final ByteBuffer putInt (ByteBuffer buffer, int value)
+ public static void putInt (ByteBuffer buffer, int value, ByteOrder order)
{
checkRemainingForWrite (buffer, 4);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
buffer.put ((byte) value);
buffer.put ((byte) (value >> 8));
@@ -190,15 +187,13 @@ final class ByteBufferHelper
buffer.put ((byte) (value >> 8));
buffer.put ((byte) value);
}
-
- return buffer;
}
- public static final int getInt (ByteBuffer buffer, int index)
+ public static int getInt (ByteBuffer buffer, int index, ByteOrder order)
{
checkAvailableForRead (buffer, index, 4);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
return ((buffer.get (index) & 0xff)
+ ((buffer.get (++index) & 0xff) << 8)
@@ -212,12 +207,12 @@ final class ByteBufferHelper
+ (buffer.get (++index) & 0xff));
}
- public static final ByteBuffer putInt (ByteBuffer buffer, int index,
- int value)
+ public static void putInt (ByteBuffer buffer, int index,
+ int value, ByteOrder order)
{
checkAvailableForWrite (buffer, index, 4);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
buffer.put (index, (byte) value);
buffer.put (++index, (byte) (value >> 8));
@@ -231,15 +226,13 @@ final class ByteBufferHelper
buffer.put (++index, (byte) (value >> 8));
buffer.put (++index, (byte) value);
}
-
- return buffer;
}
- public static final long getLong (ByteBuffer buffer)
+ public static long getLong (ByteBuffer buffer, ByteOrder order)
{
checkRemainingForRead (buffer, 8);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
return ((buffer.get() & 0xff)
+ (((buffer.get() & 0xff)) << 8)
@@ -261,11 +254,11 @@ final class ByteBufferHelper
+ (buffer.get() & 0xff));
}
- public static final ByteBuffer putLong (ByteBuffer buffer, long value)
+ public static void putLong (ByteBuffer buffer, long value, ByteOrder order)
{
checkRemainingForWrite (buffer, 8);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
buffer.put ((byte) value);
buffer.put ((byte) (value >> 8));
@@ -287,15 +280,13 @@ final class ByteBufferHelper
buffer.put ((byte) (value >> 8));
buffer.put ((byte) value);
}
-
- return buffer;
}
- public static final long getLong (ByteBuffer buffer, int index)
+ public static long getLong (ByteBuffer buffer, int index, ByteOrder order)
{
checkAvailableForRead (buffer, index, 8);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
return ((buffer.get (index) & 0xff)
+ ((buffer.get (++index) & 0xff) << 8)
@@ -317,12 +308,12 @@ final class ByteBufferHelper
+ (buffer.get (++index) & 0xff));
}
- public static final ByteBuffer putLong (ByteBuffer buffer, int index,
- long value)
+ public static void putLong (ByteBuffer buffer, int index,
+ long value, ByteOrder order)
{
checkAvailableForWrite (buffer, index, 8);
- if (buffer.order() == ByteOrder.LITTLE_ENDIAN)
+ if (order == ByteOrder.LITTLE_ENDIAN)
{
buffer.put (index, (byte) value);
buffer.put (++index, (byte) (value >> 8));
@@ -344,50 +335,47 @@ final class ByteBufferHelper
buffer.put (++index, (byte) (value >> 8));
buffer.put (++index, (byte) value);
}
-
- return buffer;
}
- public static final float getFloat (ByteBuffer buffer)
+ public static float getFloat (ByteBuffer buffer, ByteOrder order)
{
- return Float.intBitsToFloat (getInt (buffer));
+ return Float.intBitsToFloat (getInt (buffer, order));
}
- public static final ByteBuffer putFloat (ByteBuffer buffer, float value)
+ public static void putFloat (ByteBuffer buffer, float value, ByteOrder order)
{
- return putInt (buffer, Float.floatToRawIntBits (value));
+ putInt (buffer, Float.floatToRawIntBits (value), order);
}
- public static final float getFloat (ByteBuffer buffer, int index)
+ public static float getFloat (ByteBuffer buffer, int index, ByteOrder order)
{
- return Float.intBitsToFloat (getInt (buffer, index));
+ return Float.intBitsToFloat (getInt (buffer, index, order));
}
- public static final ByteBuffer putFloat (ByteBuffer buffer, int index,
- float value)
+ public static void putFloat (ByteBuffer buffer, int index,
+ float value, ByteOrder order)
{
- return putInt (buffer, index, Float.floatToRawIntBits (value));
+ putInt (buffer, index, Float.floatToRawIntBits (value), order);
}
- public static final double getDouble (ByteBuffer buffer)
+ public static double getDouble (ByteBuffer buffer, ByteOrder order)
{
- return Double.longBitsToDouble (getLong (buffer));
+ return Double.longBitsToDouble (getLong (buffer, order));
}
- public static final ByteBuffer putDouble (ByteBuffer buffer, double value)
+ public static void putDouble (ByteBuffer buffer, double value, ByteOrder order)
{
- return putLong (buffer, Double.doubleToLongBits (value));
+ putLong (buffer, Double.doubleToLongBits (value), order);
}
- public static final double getDouble (ByteBuffer buffer, int index)
+ public static double getDouble (ByteBuffer buffer, int index, ByteOrder order)
{
- return Double.longBitsToDouble (getLong (buffer, index));
+ return Double.longBitsToDouble (getLong (buffer, index, order));
}
- public static final ByteBuffer putDouble (ByteBuffer buffer, int index,
- double value)
+ public static void putDouble (ByteBuffer buffer, int index,
+ double value, ByteOrder order)
{
- return putLong (buffer, index, Double.doubleToLongBits (value));
+ putLong (buffer, index, Double.doubleToLongBits (value), order);
}
-
} // ByteBufferHelper
diff --git a/libjava/java/nio/ByteBufferImpl.java b/libjava/java/nio/ByteBufferImpl.java
index 76c965d7322..6a3814862c9 100644
--- a/libjava/java/nio/ByteBufferImpl.java
+++ b/libjava/java/nio/ByteBufferImpl.java
@@ -1,5 +1,5 @@
/* ByteBufferImpl.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,32 +58,32 @@ final class ByteBufferImpl extends ByteBuffer
public CharBuffer asCharBuffer ()
{
- return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public ShortBuffer asShortBuffer ()
{
- return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public IntBuffer asIntBuffer ()
{
- return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public LongBuffer asLongBuffer ()
{
- return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public FloatBuffer asFloatBuffer ()
{
- return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public DoubleBuffer asDoubleBuffer ()
{
- return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public boolean isReadOnly ()
@@ -108,15 +108,14 @@ final class ByteBufferImpl extends ByteBuffer
public ByteBuffer compact ()
{
- int copied = 0;
-
- while (remaining () > 0)
+ int pos = position();
+ if (pos > 0)
{
- put (copied, get ());
- copied++;
+ int count = remaining();
+ shiftDown(0, pos, count);
+ position(count);
+ limit(capacity());
}
-
- position (copied);
return this;
}
@@ -182,121 +181,133 @@ final class ByteBufferImpl extends ByteBuffer
final public char getChar ()
{
- return ByteBufferHelper.getChar (this);
+ return ByteBufferHelper.getChar(this, order());
}
final public ByteBuffer putChar (char value)
{
- return ByteBufferHelper.putChar (this, value);
+ ByteBufferHelper.putChar(this, value, order());
+ return this;
}
final public char getChar (int index)
{
- return ByteBufferHelper.getChar (this, index);
+ return ByteBufferHelper.getChar(this, index, order());
}
final public ByteBuffer putChar (int index, char value)
{
- return ByteBufferHelper.putChar (this, index, value);
+ ByteBufferHelper.putChar(this, index, value, order());
+ return this;
}
final public short getShort ()
{
- return ByteBufferHelper.getShort (this);
+ return ByteBufferHelper.getShort(this, order());
}
final public ByteBuffer putShort (short value)
{
- return ByteBufferHelper.putShort (this, value);
+ ByteBufferHelper.putShort(this, value, order());
+ return this;
}
final public short getShort (int index)
{
- return ByteBufferHelper.getShort (this, index);
+ return ByteBufferHelper.getShort(this, index, order());
}
final public ByteBuffer putShort (int index, short value)
{
- return ByteBufferHelper.putShort (this, index, value);
+ ByteBufferHelper.putShort(this, index, value, order());
+ return this;
}
final public int getInt ()
{
- return ByteBufferHelper.getInt (this);
+ return ByteBufferHelper.getInt(this, order());
}
final public ByteBuffer putInt (int value)
{
- return ByteBufferHelper.putInt (this, value);
+ ByteBufferHelper.putInt(this, value, order());
+ return this;
}
final public int getInt (int index)
{
- return ByteBufferHelper.getInt (this, index);
+ return ByteBufferHelper.getInt(this, index, order());
}
final public ByteBuffer putInt (int index, int value)
{
- return ByteBufferHelper.putInt (this, index, value);
+ ByteBufferHelper.putInt(this, index, value, order());
+ return this;
}
final public long getLong ()
{
- return ByteBufferHelper.getLong (this);
+ return ByteBufferHelper.getLong(this, order());
}
final public ByteBuffer putLong (long value)
{
- return ByteBufferHelper.putLong (this, value);
+ ByteBufferHelper.putLong (this, value, order());
+ return this;
}
final public long getLong (int index)
{
- return ByteBufferHelper.getLong (this, index);
+ return ByteBufferHelper.getLong (this, index, order());
}
final public ByteBuffer putLong (int index, long value)
{
- return ByteBufferHelper.putLong (this, index, value);
+ ByteBufferHelper.putLong (this, index, value, order());
+ return this;
}
final public float getFloat ()
{
- return ByteBufferHelper.getFloat (this);
+ return ByteBufferHelper.getFloat (this, order());
}
final public ByteBuffer putFloat (float value)
{
- return ByteBufferHelper.putFloat (this, value);
+ ByteBufferHelper.putFloat (this, value, order());
+ return this;
}
- final public float getFloat (int index)
+ public final float getFloat (int index)
{
- return ByteBufferHelper.getFloat (this, index);
+ return ByteBufferHelper.getFloat (this, index, order());
}
- public final ByteBuffer putFloat (int index, float value)
+ final public ByteBuffer putFloat (int index, float value)
{
- return ByteBufferHelper.putFloat (this, index, value);
+ ByteBufferHelper.putFloat (this, index, value, order());
+ return this;
}
final public double getDouble ()
{
- return ByteBufferHelper.getDouble (this);
+ return ByteBufferHelper.getDouble (this, order());
}
final public ByteBuffer putDouble (double value)
{
- return ByteBufferHelper.putDouble (this, value);
+ ByteBufferHelper.putDouble (this, value, order());
+ return this;
}
final public double getDouble (int index)
{
- return ByteBufferHelper.getDouble (this, index);
+ return ByteBufferHelper.getDouble (this, index, order());
}
final public ByteBuffer putDouble (int index, double value)
{
- return ByteBufferHelper.putDouble (this, index, value);
+ ByteBufferHelper.putDouble (this, index, value, order());
+ return this;
}
}
diff --git a/libjava/java/nio/CharViewBufferImpl.java b/libjava/java/nio/CharViewBufferImpl.java
index 6da6d59afeb..b1cc9071724 100644
--- a/libjava/java/nio/CharViewBufferImpl.java
+++ b/libjava/java/nio/CharViewBufferImpl.java
@@ -1,5 +1,5 @@
/* CharViewBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,54 +40,47 @@ package java.nio;
class CharViewBufferImpl extends CharBuffer
{
- private boolean readOnly;
+ /** Position in bb (i.e. a byte offset) where this buffer starts. */
private int offset;
private ByteBuffer bb;
+ private boolean readOnly;
private ByteOrder endian;
- public CharViewBufferImpl (ByteBuffer bb, boolean readOnly)
- {
- super (bb.remaining () >> 1, bb.remaining () >> 1, bb.position (), 0);
- this.bb = bb;
- this.readOnly = readOnly;
- // FIXME: What if this is called from CharByteBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
- }
-
public CharViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (limit >> 1, limit >> 1, position >> 1, mark >> 1);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
- // FIXME: What if this is called from CharViewBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
+ this.endian = endian;
}
public char get ()
{
- char result = bb.getChar ((position () << 1) + offset);
- position (position () + 1);
+ int p = position();
+ char result = ByteBufferHelper.getChar(bb, (p << 1) + offset, endian);
+ position(p + 1);
return result;
}
public char get (int index)
{
- return bb.getChar ((index << 1) + offset);
+ return ByteBufferHelper.getChar(bb, (index << 1) + offset, endian);
}
public CharBuffer put (char value)
{
- bb.putChar ((position () << 1) + offset, value);
- position (position () + 1);
+ int p = position();
+ ByteBufferHelper.putChar(bb, (p << 1) + offset, value, endian);
+ position(p + 1);
return this;
}
public CharBuffer put (int index, char value)
{
- bb.putChar ((index << 1) + offset, value);
+ ByteBufferHelper.putChar(bb, (index << 1) + offset, value, endian);
return this;
}
@@ -95,59 +88,54 @@ class CharViewBufferImpl extends CharBuffer
{
if (position () > 0)
{
- // Copy all data from position() to limit() to the beginning of the
- // buffer, set position to end of data and limit to capacity
- // XXX: This can surely be optimized, for direct and non-direct buffers
-
int count = limit () - position ();
-
- for (int i = 0; i < count; i++)
- {
- bb.putChar ((i >> 1) + offset,
- bb.getChar (((i + position ()) >> 1) + offset));
- }
-
+ bb.shiftDown(offset, offset + 2 * position(), 2 * count);
position (count);
limit (capacity ());
}
-
return this;
}
- public CharBuffer duplicate ()
- {
- // Create a copy of this object that shares its content
- // FIXME: mark is not correct
- return new CharViewBufferImpl (bb, offset, capacity (), limit (),
- position (), -1, isReadOnly ());
- }
-
public CharBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new CharViewBufferImpl (bb, (position () >> 1) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly ());
+ remaining (), remaining (), 0, -1,
+ isReadOnly (), endian);
}
+ CharBuffer duplicate (boolean readOnly)
+ {
+ int pos = position();
+ reset();
+ int mark = position();
+ position(pos);
+ return new CharViewBufferImpl (bb, offset, capacity(), limit(),
+ pos, mark, readOnly, endian);
+ }
+
+ public CharBuffer duplicate ()
+ {
+ return duplicate(readOnly);
+ }
+
+ public CharBuffer asReadOnlyBuffer ()
+ {
+ return duplicate(true);
+ }
+
public CharSequence subSequence (int start, int end)
{
if (start < 0
- || start > length ()
|| end < start
|| end > length ())
throw new IndexOutOfBoundsException ();
- return new CharViewBufferImpl (bb, array_offset, capacity (), position () + end, position () + start, -1, isReadOnly ());
+ return new CharViewBufferImpl (bb, array_offset, capacity (),
+ position () + end, position () + start,
+ -1, isReadOnly (), endian);
}
- public CharBuffer asReadOnlyBuffer ()
- {
- // Create a copy of this object that shares its content and is read-only
- return new CharViewBufferImpl (bb, (position () >> 1) + offset,
- remaining (), remaining (), 0, -1, true);
- }
-
public boolean isReadOnly ()
{
return readOnly;
@@ -160,6 +148,6 @@ class CharViewBufferImpl extends CharBuffer
public ByteOrder order ()
{
- return ByteOrder.LITTLE_ENDIAN;
+ return endian;
}
}
diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java
index a54c20693fe..37b96a7c02e 100644
--- a/libjava/java/nio/DirectByteBufferImpl.java
+++ b/libjava/java/nio/DirectByteBufferImpl.java
@@ -1,5 +1,5 @@
/* DirectByteBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -117,18 +117,18 @@ class DirectByteBufferImpl extends ByteBuffer
return this;
}
+ native void shiftDown (int dst_offset, int src_offset, int count);
+
public ByteBuffer compact ()
{
- // FIXME this can sure be optimized using memcpy()
- int copied = 0;
-
- while (remaining () > 0)
+ int pos = position();
+ if (pos > 0)
{
- put (copied, get ());
- copied++;
+ int count = remaining();
+ shiftDown(0, pos, count);
+ position(count);
+ limit(capacity());
}
-
- position (copied);
return this;
}
@@ -161,197 +161,163 @@ class DirectByteBufferImpl extends ByteBuffer
public CharBuffer asCharBuffer ()
{
- return new CharViewBufferImpl (this, position () + offset, remaining (), remaining (), 0, -1, isReadOnly ());
+ return new CharViewBufferImpl (this, position (), remaining (), remaining (), 0, -1, isReadOnly (), order());
}
public DoubleBuffer asDoubleBuffer ()
{
- return new DoubleViewBufferImpl (this, position () + offset, remaining (), remaining (), 0, -1, isReadOnly ());
+ return new DoubleViewBufferImpl (this, position (), remaining (), remaining (), 0, -1, isReadOnly (), order());
}
public FloatBuffer asFloatBuffer ()
{
- return new FloatViewBufferImpl (this, position () + offset, remaining (), remaining (), 0, -1, isReadOnly ());
+ return new FloatViewBufferImpl (this, position (), remaining (), remaining (), 0, -1, isReadOnly (), order());
}
public IntBuffer asIntBuffer ()
{
- return new IntViewBufferImpl (this, position () + offset, remaining (), remaining (), 0, -1, isReadOnly ());
+ return new IntViewBufferImpl (this, position (), remaining (), remaining (), 0, -1, isReadOnly (), order());
}
public LongBuffer asLongBuffer ()
{
- return new LongViewBufferImpl (this, position () + offset, remaining (), remaining (), 0, -1, isReadOnly ());
+ return new LongViewBufferImpl (this, position (), remaining (), remaining (), 0, -1, isReadOnly (), order());
}
public ShortBuffer asShortBuffer ()
{
- return new ShortViewBufferImpl (this, position () + offset, remaining (), remaining (), 0, -1, isReadOnly ());
+ return new ShortViewBufferImpl (this, position (), remaining (), remaining (), 0, -1, isReadOnly (), order());
}
final public char getChar ()
{
- // FIXME: this handles little endian only
- return (char) (((get () & 0xff) << 8)
- + (get () & 0xff));
+ return ByteBufferHelper.getChar(this, order());
}
final public ByteBuffer putChar (char value)
{
- // FIXME: this handles little endian only
- put ((byte) ((((int) value) & 0xff00) >> 8));
- put ((byte) (((int) value) & 0x00ff));
+ ByteBufferHelper.putChar(this, value, order());
return this;
}
final public char getChar (int index)
{
- // FIXME: this handles little endian only
- return (char) (((get (index) & 0xff) << 8)
- + (get (index + 1) & 0xff));
+ return ByteBufferHelper.getChar(this, index, order());
}
final public ByteBuffer putChar (int index, char value)
{
- // FIXME: this handles little endian only
- put (index, (byte) ((((int) value) & 0xff00) >> 8));
- put (index + 1, (byte) (((int) value) & 0x00ff));
+ ByteBufferHelper.putChar(this, index, value, order());
return this;
}
final public short getShort ()
{
- // FIXME: this handles little endian only
- return (short) (((get () & 0xff) << 8)
- + (get () & 0xff));
+ return ByteBufferHelper.getShort(this, order());
}
final public ByteBuffer putShort (short value)
{
- // FIXME: this handles little endian only
- put ((byte) ((((int) value) & 0xff00) >> 8));
- put ((byte) (((int) value) & 0x00ff));
+ ByteBufferHelper.putShort(this, value, order());
return this;
}
final public short getShort (int index)
{
- // FIXME: this handles little endian only
- return (short) (((get (index) & 0xff) << 8)
- + (get (index + 1) & 0xff));
+ return ByteBufferHelper.getShort(this, index, order());
}
final public ByteBuffer putShort (int index, short value)
{
- // FIXME: this handles little endian only
- put (index, (byte) ((((int) value) & 0xff00) >> 8));
- put (index + 1, (byte) (((int) value) & 0x00ff));
+ ByteBufferHelper.putShort(this, index, value, order());
return this;
}
final public int getInt ()
{
- // FIXME: this handles little endian only
- return (int) (((get () & 0xff) << 24)
- + ((get () & 0xff) << 16)
- + ((get () & 0xff) << 8)
- + (get () & 0xff));
+ return ByteBufferHelper.getInt(this, order());
}
final public ByteBuffer putInt (int value)
{
- // FIXME: this handles little endian only
- put ((byte) ((((int) value) & 0xff000000) >> 24));
- put ((byte) ((((int) value) & 0x00ff0000) >> 16));
- put ((byte) ((((int) value) & 0x0000ff00) >> 8));
- put ((byte) (((int) value) & 0x000000ff));
+ ByteBufferHelper.putInt(this, value, order());
return this;
}
final public int getInt (int index)
{
- // FIXME: this handles little endian only
- return (int) (((get (index) & 0xff) << 24)
- + ((get (index + 1) & 0xff) << 16)
- + ((get (index + 2) & 0xff) << 8)
- + (get (index + 3) & 0xff));
+ return ByteBufferHelper.getInt(this, index, order());
}
final public ByteBuffer putInt (int index, int value)
{
- // FIXME: this handles little endian only
- put (index, (byte) ((((int) value) & 0xff000000) >> 24));
- put (index + 1, (byte) ((((int) value) & 0x00ff0000) >> 16));
- put (index + 2, (byte) ((((int) value) & 0x0000ff00) >> 8));
- put (index + 3, (byte) (((int) value) & 0x000000ff));
+ ByteBufferHelper.putInt(this, index, value, order());
return this;
}
final public long getLong ()
{
- // FIXME: this handles little endian only
- return (long) (((get () & 0xff) << 56)
- + ((get () & 0xff) << 48)
- + ((get () & 0xff) << 40)
- + ((get () & 0xff) << 32)
- + ((get () & 0xff) << 24)
- + ((get () & 0xff) << 16)
- + ((get () & 0xff) << 8)
- + (get () & 0xff));
+ return ByteBufferHelper.getLong(this, order());
}
final public ByteBuffer putLong (long value)
{
- return ByteBufferHelper.putLong (this, value);
+ ByteBufferHelper.putLong (this, value, order());
+ return this;
}
final public long getLong (int index)
{
- return ByteBufferHelper.getLong (this, index);
+ return ByteBufferHelper.getLong (this, index, order());
}
final public ByteBuffer putLong (int index, long value)
{
- return ByteBufferHelper.putLong (this, index, value);
+ ByteBufferHelper.putLong (this, index, value, order());
+ return this;
}
final public float getFloat ()
{
- return ByteBufferHelper.getFloat (this);
+ return ByteBufferHelper.getFloat (this, order());
}
final public ByteBuffer putFloat (float value)
{
- return ByteBufferHelper.putFloat (this, value);
+ ByteBufferHelper.putFloat (this, value, order());
+ return this;
}
public final float getFloat (int index)
{
- return ByteBufferHelper.getFloat (this, index);
+ return ByteBufferHelper.getFloat (this, index, order());
}
final public ByteBuffer putFloat (int index, float value)
{
- return ByteBufferHelper.putFloat (this, index, value);
+ ByteBufferHelper.putFloat (this, index, value, order());
+ return this;
}
final public double getDouble ()
{
- return ByteBufferHelper.getDouble (this);
+ return ByteBufferHelper.getDouble (this, order());
}
final public ByteBuffer putDouble (double value)
{
- return ByteBufferHelper.putDouble (this, value);
+ ByteBufferHelper.putDouble (this, value, order());
+ return this;
}
final public double getDouble (int index)
{
- return ByteBufferHelper.getDouble (this, index);
+ return ByteBufferHelper.getDouble (this, index, order());
}
final public ByteBuffer putDouble (int index, double value)
{
- return ByteBufferHelper.putDouble (this, index, value);
+ ByteBufferHelper.putDouble (this, index, value, order());
+ return this;
}
}
diff --git a/libjava/java/nio/DoubleViewBufferImpl.java b/libjava/java/nio/DoubleViewBufferImpl.java
index 480b97f6d03..ac27746ba0d 100644
--- a/libjava/java/nio/DoubleViewBufferImpl.java
+++ b/libjava/java/nio/DoubleViewBufferImpl.java
@@ -1,5 +1,5 @@
/* DoubleViewBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,54 +40,47 @@ package java.nio;
class DoubleViewBufferImpl extends DoubleBuffer
{
- private boolean readOnly;
+ /** Position in bb (i.e. a byte offset) where this buffer starts. */
private int offset;
private ByteBuffer bb;
+ private boolean readOnly;
private ByteOrder endian;
- public DoubleViewBufferImpl (ByteBuffer bb, boolean readOnly)
- {
- super (bb.remaining () >> 3, bb.remaining () >> 3, bb.position (), 0);
- this.bb = bb;
- this.readOnly = readOnly;
- // FIXME: What if this is called from DoubleByteBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
- }
-
public DoubleViewBufferImpl (ByteBuffer bb, int offset, int capacity,
int limit, int position, int mark,
- boolean readOnly)
+ boolean readOnly, ByteOrder endian)
{
super (limit >> 3, limit >> 3, position >> 3, mark >> 3);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
- // FIXME: What if this is called from DoubleViewBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
+ this.endian = endian;
}
public double get ()
{
- double result = bb.getDouble ((position () << 3) + offset);
- position (position () + 1);
+ int p = position();
+ double result = ByteBufferHelper.getDouble(bb, (p << 3) + offset, endian);
+ position(p + 1);
return result;
}
public double get (int index)
{
- return bb.getDouble ((index << 3) + offset);
+ return ByteBufferHelper.getDouble(bb, (index << 3) + offset, endian);
}
public DoubleBuffer put (double value)
{
- bb.putDouble ((position () << 3) + offset, value);
- position (position () + 1);
+ int p = position();
+ ByteBufferHelper.putDouble(bb, (p << 3) + offset, value, endian);
+ position(p + 1);
return this;
}
public DoubleBuffer put (int index, double value)
{
- bb.putDouble ((index << 3) + offset, value);
+ ByteBufferHelper.putDouble(bb, (index << 3) + offset, value, endian);
return this;
}
@@ -95,48 +88,41 @@ class DoubleViewBufferImpl extends DoubleBuffer
{
if (position () > 0)
{
- // Copy all data from position() to limit() to the beginning of the
- // buffer, set position to end of data and limit to capacity
- // XXX: This can surely be optimized, for direct and non-direct buffers
-
int count = limit () - position ();
-
- for (int i = 0; i < count; i++)
- {
- bb.putDouble ((i >> 3) + offset,
- bb.getDouble (((i + position ()) >> 3) + offset));
- }
-
+ bb.shiftDown(offset, offset + 8 * position(), 8 * count);
position (count);
limit (capacity ());
}
-
return this;
}
- public DoubleBuffer duplicate ()
+ public DoubleBuffer slice ()
{
- // Create a copy of this object that shares its content
- // FIXME: mark is not correct
- return new DoubleViewBufferImpl (bb, offset, capacity (), limit (),
- position (), -1, isReadOnly ());
+ return new DoubleViewBufferImpl (bb, (position () >> 3) + offset,
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
- public DoubleBuffer slice ()
+ DoubleBuffer duplicate (boolean readOnly)
{
- // Create a sliced copy of this object that shares its content.
- return new DoubleViewBufferImpl (bb, (position () >> 3) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly ());
+ int pos = position();
+ reset();
+ int mark = position();
+ position(pos);
+ return new DoubleViewBufferImpl (bb, offset, capacity(), limit(),
+ pos, mark, readOnly, endian);
}
+ public DoubleBuffer duplicate ()
+ {
+ return duplicate(readOnly);
+ }
+
public DoubleBuffer asReadOnlyBuffer ()
{
- // Create a copy of this object that shares its content and is read-only
- return new DoubleViewBufferImpl (bb, (position () >> 3) + offset,
- remaining (), remaining (), 0, -1, true);
+ return duplicate(true);
}
-
+
public boolean isReadOnly ()
{
return readOnly;
@@ -149,6 +135,6 @@ class DoubleViewBufferImpl extends DoubleBuffer
public ByteOrder order ()
{
- return ByteOrder.LITTLE_ENDIAN;
+ return endian;
}
}
diff --git a/libjava/java/nio/FloatViewBufferImpl.java b/libjava/java/nio/FloatViewBufferImpl.java
index e44cd5e18fd..88bc92553ab 100644
--- a/libjava/java/nio/FloatViewBufferImpl.java
+++ b/libjava/java/nio/FloatViewBufferImpl.java
@@ -1,5 +1,5 @@
/* FloatViewBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,54 +40,47 @@ package java.nio;
class FloatViewBufferImpl extends FloatBuffer
{
- private boolean readOnly;
+ /** Position in bb (i.e. a byte offset) where this buffer starts. */
private int offset;
private ByteBuffer bb;
+ private boolean readOnly;
private ByteOrder endian;
- public FloatViewBufferImpl (ByteBuffer bb, boolean readOnly)
- {
- super (bb.remaining () >> 2, bb.remaining () >> 2, bb.position (), 0);
- this.bb = bb;
- this.readOnly = readOnly;
- // FIXME: What if this is called from FloatByteBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
- }
-
public FloatViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (limit >> 2, limit >> 2, position >> 2, mark >> 2);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
- // FIXME: What if this is called from FloatViewBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
+ this.endian = endian;
}
public float get ()
{
- float result = bb.getFloat ((position () << 2) + offset);
- position (position () + 1);
+ int p = position();
+ float result = ByteBufferHelper.getFloat(bb, (p << 2) + offset, endian);
+ position(p + 1);
return result;
}
public float get (int index)
{
- return bb.getFloat ((index << 2) + offset);
+ return ByteBufferHelper.getFloat(bb, (index << 2) + offset, endian);
}
public FloatBuffer put (float value)
{
- bb.putFloat ((position () << 2) + offset, value);
- position (position () + 1);
+ int p = position();
+ ByteBufferHelper.putFloat(bb, (p << 2) + offset, value, endian);
+ position(p + 1);
return this;
}
public FloatBuffer put (int index, float value)
{
- bb.putFloat ((index << 2) + offset, value);
+ ByteBufferHelper.putFloat(bb, (index << 2) + offset, value, endian);
return this;
}
@@ -95,48 +88,42 @@ class FloatViewBufferImpl extends FloatBuffer
{
if (position () > 0)
{
- // Copy all data from position() to limit() to the beginning of the
- // buffer, set position to end of data and limit to capacity
- // XXX: This can surely be optimized, for direct and non-direct buffers
-
int count = limit () - position ();
-
- for (int i = 0; i < count; i++)
- {
- bb.putFloat ((i >> 2) + offset,
- bb.getFloat (((i + position ()) >> 2) + offset));
- }
-
+ bb.shiftDown(offset, offset + 4 * position(), 4 * count);
position (count);
limit (capacity ());
}
-
return this;
}
- public FloatBuffer duplicate ()
- {
- // Create a copy of this object that shares its content
- // FIXME: mark is not correct
- return new FloatViewBufferImpl (bb, offset, capacity (), limit (),
- position (), -1, isReadOnly ());
- }
-
public FloatBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new FloatViewBufferImpl (bb, (position () >> 2) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly ());
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
- public FloatBuffer asReadOnlyBuffer ()
+ FloatBuffer duplicate (boolean readOnly)
{
- // Create a copy of this object that shares its content and is read-only
- return new FloatViewBufferImpl (bb, (position () >> 2) + offset,
- remaining (), remaining (), 0, -1, true);
+ int pos = position();
+ reset();
+ int mark = position();
+ position(pos);
+ return new FloatViewBufferImpl (bb, offset, capacity(), limit(),
+ pos, mark, readOnly, endian);
}
+ public FloatBuffer duplicate ()
+ {
+ return duplicate(readOnly);
+ }
+
+ public FloatBuffer asReadOnlyBuffer ()
+ {
+ return duplicate(true);
+ }
+
public boolean isReadOnly ()
{
return readOnly;
@@ -149,6 +136,6 @@ class FloatViewBufferImpl extends FloatBuffer
public ByteOrder order ()
{
- return ByteOrder.LITTLE_ENDIAN;
+ return endian;
}
}
diff --git a/libjava/java/nio/IntViewBufferImpl.java b/libjava/java/nio/IntViewBufferImpl.java
index e60f3cb99a4..8e384c9017d 100644
--- a/libjava/java/nio/IntViewBufferImpl.java
+++ b/libjava/java/nio/IntViewBufferImpl.java
@@ -1,5 +1,5 @@
/* IntViewBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,54 +40,47 @@ package java.nio;
class IntViewBufferImpl extends IntBuffer
{
- private boolean readOnly;
+ /** Position in bb (i.e. a byte offset) where this buffer starts. */
private int offset;
private ByteBuffer bb;
+ private boolean readOnly;
private ByteOrder endian;
- public IntViewBufferImpl (ByteBuffer bb, boolean readOnly)
- {
- super (bb.remaining () >> 2, bb.remaining () >> 2, bb.position (), 0);
- this.bb = bb;
- this.readOnly = readOnly;
- // FIXME: What if this is called from IntByteBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
- }
-
public IntViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (limit >> 2, limit >> 2, position >> 2, mark >> 2);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
- // FIXME: What if this is called from IntViewBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
+ this.endian = endian;
}
public int get ()
{
- int result = bb.getInt ((position () << 2) + offset);
- position (position () + 1);
+ int p = position();
+ int result = ByteBufferHelper.getInt(bb, (p << 2) + offset, endian);
+ position(p + 1);
return result;
}
public int get (int index)
{
- return bb.getInt ((index << 2) + offset);
+ return ByteBufferHelper.getInt(bb, (index << 2) + offset, endian);
}
public IntBuffer put (int value)
{
- bb.putInt ((position () << 2) + offset, value);
- position (position () + 1);
+ int p = position();
+ ByteBufferHelper.putInt(bb, (p << 2) + offset, value, endian);
+ position(p + 1);
return this;
}
public IntBuffer put (int index, int value)
{
- bb.putInt ((index << 2) + offset, value);
+ ByteBufferHelper.putInt(bb, (index << 2) + offset, value, endian);
return this;
}
@@ -95,48 +88,42 @@ class IntViewBufferImpl extends IntBuffer
{
if (position () > 0)
{
- // Copy all data from position() to limit() to the beginning of the
- // buffer, set position to end of data and limit to capacity
- // XXX: This can surely be optimized, for direct and non-direct buffers
-
int count = limit () - position ();
-
- for (int i = 0; i < count; i++)
- {
- bb.putInt ((i >> 2) + offset,
- bb.getInt (((i + position ()) >> 2) + offset));
- }
-
+ bb.shiftDown(offset, offset + 4 * position(), 4 * count);
position (count);
limit (capacity ());
}
-
return this;
}
- public IntBuffer duplicate ()
- {
- // Create a copy of this object that shares its content
- // FIXME: mark is not correct
- return new IntViewBufferImpl (bb, offset, capacity (), limit (),
- position (), -1, isReadOnly ());
- }
-
public IntBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new IntViewBufferImpl (bb, (position () >> 2) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly ());
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
- public IntBuffer asReadOnlyBuffer ()
+ IntBuffer duplicate (boolean readOnly)
{
- // Create a copy of this object that shares its content and is read-only
- return new IntViewBufferImpl (bb, (position () >> 2) + offset,
- remaining (), remaining (), 0, -1, true);
+ int pos = position();
+ reset();
+ int mark = position();
+ position(pos);
+ return new IntViewBufferImpl (bb, offset, capacity(), limit(),
+ pos, mark, readOnly, endian);
}
+ public IntBuffer duplicate ()
+ {
+ return duplicate(readOnly);
+ }
+
+ public IntBuffer asReadOnlyBuffer ()
+ {
+ return duplicate(true);
+ }
+
public boolean isReadOnly ()
{
return readOnly;
@@ -149,6 +136,6 @@ class IntViewBufferImpl extends IntBuffer
public ByteOrder order ()
{
- return ByteOrder.LITTLE_ENDIAN;
+ return endian;
}
}
diff --git a/libjava/java/nio/LongViewBufferImpl.java b/libjava/java/nio/LongViewBufferImpl.java
index c7ada48658f..a405ec871a5 100644
--- a/libjava/java/nio/LongViewBufferImpl.java
+++ b/libjava/java/nio/LongViewBufferImpl.java
@@ -1,5 +1,5 @@
/* LongViewBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,54 +40,47 @@ package java.nio;
class LongViewBufferImpl extends LongBuffer
{
- private boolean readOnly;
+ /** Position in bb (i.e. a byte offset) where this buffer starts. */
private int offset;
private ByteBuffer bb;
+ private boolean readOnly;
private ByteOrder endian;
- public LongViewBufferImpl (ByteBuffer bb, boolean readOnly)
- {
- super (bb.remaining () >> 3, bb.remaining () >> 3, bb.position (), 0);
- this.bb = bb;
- this.readOnly = readOnly;
- // FIXME: What if this is called from LongByteBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
- }
-
public LongViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (limit >> 3, limit >> 3, position >> 3, mark >> 3);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
- // FIXME: What if this is called from LongViewBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
+ this.endian = endian;
}
public long get ()
{
- long result = bb.getLong ((position () << 3) + offset);
- position (position () + 1);
+ int p = position();
+ long result = ByteBufferHelper.getLong(bb, (p << 3) + offset, endian);
+ position(p + 1);
return result;
}
public long get (int index)
{
- return bb.getLong ((index << 3) + offset);
+ return ByteBufferHelper.getLong(bb, (index << 3) + offset, endian);
}
public LongBuffer put (long value)
{
- bb.putLong ((position () << 3) + offset, value);
- position (position () + 1);
+ int p = position();
+ ByteBufferHelper.putLong(bb, (p << 3) + offset, value, endian);
+ position(p + 1);
return this;
}
public LongBuffer put (int index, long value)
{
- bb.putLong ((index << 3) + offset, value);
+ ByteBufferHelper.putLong(bb, (index << 3) + offset, value, endian);
return this;
}
@@ -95,48 +88,42 @@ class LongViewBufferImpl extends LongBuffer
{
if (position () > 0)
{
- // Copy all data from position() to limit() to the beginning of the
- // buffer, set position to end of data and limit to capacity
- // XXX: This can surely be optimized, for direct and non-direct buffers
-
int count = limit () - position ();
-
- for (int i = 0; i < count; i++)
- {
- bb.putLong ((i >> 3) + offset,
- bb.getLong (((i + position ()) >> 3) + offset));
- }
-
+ bb.shiftDown(offset, offset + 8 * position(), 8 * count);
position (count);
limit (capacity ());
}
-
return this;
}
- public LongBuffer duplicate ()
- {
- // Create a copy of this object that shares its content
- // FIXME: mark is not correct
- return new LongViewBufferImpl (bb, offset, capacity (), limit (),
- position (), -1, isReadOnly ());
- }
-
public LongBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new LongViewBufferImpl (bb, (position () >> 3) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly ());
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
- public LongBuffer asReadOnlyBuffer ()
+ LongBuffer duplicate (boolean readOnly)
{
- // Create a copy of this object that shares its content and is read-only
- return new LongViewBufferImpl (bb, (position () >> 3) + offset,
- remaining (), remaining (), 0, -1, true);
+ int pos = position();
+ reset();
+ int mark = position();
+ position(pos);
+ return new LongViewBufferImpl (bb, offset, capacity(), limit(),
+ pos, mark, readOnly, endian);
}
+ public LongBuffer duplicate ()
+ {
+ return duplicate(readOnly);
+ }
+
+ public LongBuffer asReadOnlyBuffer ()
+ {
+ return duplicate(true);
+ }
+
public boolean isReadOnly ()
{
return readOnly;
@@ -149,6 +136,6 @@ class LongViewBufferImpl extends LongBuffer
public ByteOrder order ()
{
- return ByteOrder.LITTLE_ENDIAN;
+ return endian;
}
}
diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java
index 47673c66aa4..f1d892f146f 100644
--- a/libjava/java/nio/MappedByteBufferImpl.java
+++ b/libjava/java/nio/MappedByteBufferImpl.java
@@ -1,5 +1,5 @@
/* MappedByteBufferImpl.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -111,15 +111,14 @@ public class MappedByteBufferImpl extends MappedByteBuffer
public ByteBuffer compact ()
{
- int copied = 0;
-
- while (remaining () > 0)
+ int pos = position();
+ if (pos > 0)
{
- put (copied, get ());
- copied++;
+ int count = remaining();
+ shiftDown(0, pos, count);
+ position(count);
+ limit(capacity());
}
-
- position (copied);
return this;
}
@@ -145,151 +144,163 @@ public class MappedByteBufferImpl extends MappedByteBuffer
public CharBuffer asCharBuffer ()
{
- return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new CharViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public ShortBuffer asShortBuffer ()
{
- return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new ShortViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public IntBuffer asIntBuffer ()
{
- return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new IntViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public LongBuffer asLongBuffer ()
{
- return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new LongViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public FloatBuffer asFloatBuffer ()
{
- return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new FloatViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
public DoubleBuffer asDoubleBuffer ()
{
- return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly ());
+ return new DoubleViewBufferImpl (this, position (), remaining(), remaining (), 0, -1, isReadOnly (), order());
}
- public final char getChar()
+ final public char getChar ()
{
- return ByteBufferHelper.getChar (this);
+ return ByteBufferHelper.getChar(this, order());
}
- public final ByteBuffer putChar (char value)
+ final public ByteBuffer putChar (char value)
{
- return ByteBufferHelper.putChar (this, value);
+ ByteBufferHelper.putChar(this, value, order());
+ return this;
}
- public final char getChar (int index)
+ final public char getChar (int index)
{
- return ByteBufferHelper.getChar (this, index);
+ return ByteBufferHelper.getChar(this, index, order());
}
- public final ByteBuffer putChar (int index, char value)
+ final public ByteBuffer putChar (int index, char value)
{
- return ByteBufferHelper.putChar (this, index, value);
+ ByteBufferHelper.putChar(this, index, value, order());
+ return this;
}
- public final short getShort()
+ final public short getShort ()
{
- return ByteBufferHelper.getShort (this);
+ return ByteBufferHelper.getShort(this, order());
}
- public final ByteBuffer putShort (short value)
+ final public ByteBuffer putShort (short value)
{
- return ByteBufferHelper.putShort (this, value);
+ ByteBufferHelper.putShort(this, value, order());
+ return this;
}
- public final short getShort (int index)
+ final public short getShort (int index)
{
- return ByteBufferHelper.getShort (this, index);
+ return ByteBufferHelper.getShort(this, index, order());
}
- public final ByteBuffer putShort (int index, short value)
+ final public ByteBuffer putShort (int index, short value)
{
- return ByteBufferHelper.putShort (this, index, value);
+ ByteBufferHelper.putShort(this, index, value, order());
+ return this;
}
- public final int getInt()
+ final public int getInt ()
{
- return ByteBufferHelper.getInt (this);
+ return ByteBufferHelper.getInt(this, order());
}
- public final ByteBuffer putInt (int value)
+ final public ByteBuffer putInt (int value)
{
- return ByteBufferHelper.putInt (this, value);
+ ByteBufferHelper.putInt(this, value, order());
+ return this;
}
- public final int getInt (int index)
+ final public int getInt (int index)
{
- return ByteBufferHelper.getInt (this, index);
+ return ByteBufferHelper.getInt(this, index, order());
}
- public final ByteBuffer putInt (int index, int value)
+ final public ByteBuffer putInt (int index, int value)
{
- return ByteBufferHelper.putInt (this, index, value);
+ ByteBufferHelper.putInt(this, index, value, order());
+ return this;
}
- public final long getLong()
+ final public long getLong ()
{
- return ByteBufferHelper.getLong (this);
+ return ByteBufferHelper.getLong(this, order());
}
- public final ByteBuffer putLong (long value)
+ final public ByteBuffer putLong (long value)
{
- return ByteBufferHelper.putLong (this, value);
+ ByteBufferHelper.putLong (this, value, order());
+ return this;
}
- public final long getLong (int index)
+ final public long getLong (int index)
{
- return ByteBufferHelper.getLong (this, index);
+ return ByteBufferHelper.getLong (this, index, order());
}
- public final ByteBuffer putLong (int index, long value)
+ final public ByteBuffer putLong (int index, long value)
{
- return ByteBufferHelper.putLong (this, index, value);
+ ByteBufferHelper.putLong (this, index, value, order());
+ return this;
}
- public final float getFloat()
+ final public float getFloat ()
{
- return ByteBufferHelper.getFloat (this);
+ return ByteBufferHelper.getFloat (this, order());
}
- public final ByteBuffer putFloat (float value)
+ final public ByteBuffer putFloat (float value)
{
- return ByteBufferHelper.putFloat (this, value);
+ ByteBufferHelper.putFloat (this, value, order());
+ return this;
}
public final float getFloat (int index)
{
- return ByteBufferHelper.getFloat (this, index);
+ return ByteBufferHelper.getFloat (this, index, order());
}
- public final ByteBuffer putFloat (int index, float value)
+ final public ByteBuffer putFloat (int index, float value)
{
- return ByteBufferHelper.putFloat (this, index, value);
+ ByteBufferHelper.putFloat (this, index, value, order());
+ return this;
}
- public final double getDouble()
+ final public double getDouble ()
{
- return ByteBufferHelper.getDouble (this);
+ return ByteBufferHelper.getDouble (this, order());
}
- public final ByteBuffer putDouble (double value)
+ final public ByteBuffer putDouble (double value)
{
- return ByteBufferHelper.putDouble (this, value);
+ ByteBufferHelper.putDouble (this, value, order());
+ return this;
}
- public final double getDouble (int index)
+ final public double getDouble (int index)
{
- return ByteBufferHelper.getDouble (this, index);
+ return ByteBufferHelper.getDouble (this, index, order());
}
- public final ByteBuffer putDouble (int index, double value)
+ final public ByteBuffer putDouble (int index, double value)
{
- return ByteBufferHelper.putDouble (this, index, value);
+ ByteBufferHelper.putDouble (this, index, value, order());
+ return this;
}
}
diff --git a/libjava/java/nio/ShortViewBufferImpl.java b/libjava/java/nio/ShortViewBufferImpl.java
index 9594642ba89..b217f1cb553 100644
--- a/libjava/java/nio/ShortViewBufferImpl.java
+++ b/libjava/java/nio/ShortViewBufferImpl.java
@@ -1,5 +1,5 @@
/* ShortViewBufferImpl.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,54 +40,47 @@ package java.nio;
class ShortViewBufferImpl extends ShortBuffer
{
- private boolean readOnly;
+ /** Position in bb (i.e. a byte offset) where this buffer starts. */
private int offset;
private ByteBuffer bb;
+ private boolean readOnly;
private ByteOrder endian;
- public ShortViewBufferImpl (ByteBuffer bb, boolean readOnly)
- {
- super (bb.remaining () >> 1, bb.remaining () >> 1, bb.position (), 0);
- this.bb = bb;
- this.readOnly = readOnly;
- // FIXME: What if this is called from ShortByteBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
- }
-
public ShortViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (limit >> 1, limit >> 1, position >> 1, mark >> 1);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
- // FIXME: What if this is called from ShortViewBufferImpl and ByteBuffer has changed its endianess ?
- this.endian = bb.order ();
+ this.endian = endian;
}
public short get ()
{
- short result = bb.getShort ((position () << 1) + offset);
- position (position () + 1);
+ int p = position();
+ short result = ByteBufferHelper.getShort(bb, (p << 1) + offset, endian);
+ position(p + 1);
return result;
}
public short get (int index)
{
- return bb.getShort ((index << 1) + offset);
+ return ByteBufferHelper.getShort(bb, (index << 1) + offset, endian);
}
public ShortBuffer put (short value)
{
- bb.putShort ((position () << 1) + offset, value);
- position (position () + 1);
+ int p = position();
+ ByteBufferHelper.putShort(bb, (p << 1) + offset, value, endian);
+ position(p + 1);
return this;
}
public ShortBuffer put (int index, short value)
{
- bb.putShort ((index << 1) + offset, value);
+ ByteBufferHelper.putShort(bb, (index << 1) + offset, value, endian);
return this;
}
@@ -95,48 +88,42 @@ class ShortViewBufferImpl extends ShortBuffer
{
if (position () > 0)
{
- // Copy all data from position() to limit() to the beginning of the
- // buffer, set position to end of data and limit to capacity
- // XXX: This can surely be optimized, for direct and non-direct buffers
-
int count = limit () - position ();
-
- for (int i = 0; i < count; i++)
- {
- bb.putShort ((i >> 1) + offset,
- bb.getShort (((i + position ()) >> 1) + offset));
- }
-
+ bb.shiftDown(offset, offset + 2 * position(), 2 * count);
position (count);
limit (capacity ());
}
-
return this;
}
- public ShortBuffer duplicate ()
- {
- // Create a copy of this object that shares its content
- // FIXME: mark is not correct
- return new ShortViewBufferImpl (bb, offset, capacity (), limit (),
- position (), -1, isReadOnly ());
- }
-
public ShortBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new ShortViewBufferImpl (bb, (position () >> 1) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly ());
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
- public ShortBuffer asReadOnlyBuffer ()
+ ShortBuffer duplicate (boolean readOnly)
{
- // Create a copy of this object that shares its content and is read-only
- return new ShortViewBufferImpl (bb, (position () >> 1) + offset,
- remaining (), remaining (), 0, -1, true);
+ int pos = position();
+ reset();
+ int mark = position();
+ position(pos);
+ return new ShortViewBufferImpl (bb, offset, capacity(), limit(),
+ pos, mark, readOnly, endian);
}
+ public ShortBuffer duplicate ()
+ {
+ return duplicate(readOnly);
+ }
+
+ public ShortBuffer asReadOnlyBuffer ()
+ {
+ return duplicate(true);
+ }
+
public boolean isReadOnly ()
{
return readOnly;
@@ -149,6 +136,6 @@ class ShortViewBufferImpl extends ShortBuffer
public ByteOrder order ()
{
- return ByteOrder.LITTLE_ENDIAN;
+ return endian;
}
}
diff --git a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
index 17d6a2eaea1..76c6c2b899f 100644
--- a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
+++ b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
@@ -1,5 +1,5 @@
/* AbstractSelectableChannel.java
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -80,8 +80,11 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
{
synchronized (blockingLock())
{
- implConfigureBlocking(blocking);
- this.blocking = blocking;
+ if (this.blocking != blocking)
+ {
+ implConfigureBlocking(blocking);
+ this.blocking = blocking;
+ }
}
return this;
diff --git a/libjava/java/nio/natDirectByteBufferImpl.cc b/libjava/java/nio/natDirectByteBufferImpl.cc
index 2ceea170551..7ff06ffa030 100644
--- a/libjava/java/nio/natDirectByteBufferImpl.cc
+++ b/libjava/java/nio/natDirectByteBufferImpl.cc
@@ -43,3 +43,12 @@ java::nio::DirectByteBufferImpl::putImpl (jint index, jbyte value)
jbyte* pointer = reinterpret_cast<jbyte*> (address) + offset + index;
*pointer = value;
}
+
+void
+java::nio::DirectByteBufferImpl::shiftDown
+(jint dst_offset, jint src_offset, jint count)
+{
+ jbyte* dst = reinterpret_cast<jbyte*> (address) + offset + dst_offset;
+ jbyte* src = reinterpret_cast<jbyte*> (address) + offset + src_offset;
+ ::memmove(dst, src, count);
+}
diff --git a/libjava/java/util/zip/Deflater.java b/libjava/java/util/zip/Deflater.java
index 52c569a412a..333555f0ac3 100644
--- a/libjava/java/util/zip/Deflater.java
+++ b/libjava/java/util/zip/Deflater.java
@@ -1,5 +1,5 @@
/* Deflater.java - Compress a data stream
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,13 +40,15 @@ package java.util.zip;
import gnu.gcj.RawData;
/**
+ * This is the Deflater class. The deflater class compresses input
+ * with the deflate algorithm described in RFC 1951. It has several
+ * compression levels and three different strategies described below.
+ *
+ * This class is <i>not</i> thread safe. This is inherent in the API, due
+ * to the split of deflate and setInput.
+ *
+ * @author Jochen Hoenicke
* @author Tom Tromey
- * @date May 17, 1999
- */
-
-/* Written using on-line Java Platform 1.2 API Specification
- * and JCL book.
- * Believed complete and correct.
*/
public class Deflater
{
@@ -91,95 +93,236 @@ public class Deflater
*/
public static final int DEFLATED = 8;
- public int deflate (byte[] buf)
- {
- return deflate (buf, 0, buf.length);
- }
+ /** Compression level. */
+ private int level;
- public native int deflate (byte[] buf, int off, int len);
- private native void init (int level, boolean noHeader);
- private native void update ();
+ /** Compression strategy. */
+ private int strategy;
+
+ /** The zlib stream. */
+ private RawData zstream;
- public Deflater ()
+ /** True if finished. */
+ private boolean is_finished;
+
+ /** `Flush' flag to pass to next call to deflate. */
+ private int flush_flag;
+
+ /**
+ * Creates a new deflater with default compression level.
+ */
+ public Deflater()
{
- this (DEFAULT_COMPRESSION, false);
+ this(DEFAULT_COMPRESSION, false);
}
- public Deflater (int lvl)
+ /**
+ * Creates a new deflater with given compression level.
+ * @param lvl the compression level, a value between NO_COMPRESSION
+ * and BEST_COMPRESSION, or DEFAULT_COMPRESSION.
+ * @exception IllegalArgumentException if lvl is out of range.
+ */
+ public Deflater(int lvl)
{
- this (lvl, false);
+ this(lvl, false);
}
- public Deflater (int lvl, boolean noHeader)
+ /**
+ * Creates a new deflater with given compression level.
+ * @param lvl the compression level, a value between NO_COMPRESSION
+ * and BEST_COMPRESSION.
+ * @param nowrap true, iff we should suppress the deflate header at the
+ * beginning and the adler checksum at the end of the output. This is
+ * useful for the GZIP format.
+ * @exception IllegalArgumentException if lvl is out of range.
+ */
+ public Deflater(int lvl, boolean noHeader)
{
this.strategy = DEFAULT_STRATEGY;
- init (lvl, noHeader);
- setLevel (lvl);
+ init(lvl, noHeader);
+ setLevel(lvl);
}
- public native void end ();
+ private native void init(int level, boolean noHeader);
+
+ private native void update();
- protected void finalize ()
- {
- end ();
- }
+ /**
+ * Resets the deflater. The deflater acts afterwards as if it was
+ * just created with the same compression level and strategy as it
+ * had before.
+ */
+ public native void reset();
+
+ /**
+ * Frees all objects allocated by the compressor. There's no
+ * reason to call this, since you can just rely on garbage
+ * collection. Exists only for compatibility against Sun's JDK,
+ * where the compressor allocates native memory.
+ * If you call any method (even reset) afterwards the behaviour is
+ * <i>undefined</i>.
+ * @deprecated Just clear all references to deflater instead.
+ */
+ public native void end();
- public native void finish ();
+ /**
+ * Gets the current adler checksum of the data that was processed so
+ * far.
+ */
+ public native int getAdler();
- public synchronized boolean finished ()
+ /**
+ * Gets the number of input bytes processed so far.
+ */
+ public native int getTotalIn();
+
+ /**
+ * Gets the number of output bytes so far.
+ */
+ public native int getTotalOut();
+
+ /**
+ * Finalizes this object.
+ */
+ protected void finalize()
{
- return is_finished;
+ end();
}
- public native int getAdler ();
- public native int getTotalIn ();
- public native int getTotalOut ();
- public native boolean needsInput ();
- public native void reset ();
+ /**
+ * Finishes the deflater with the current input block. It is an error
+ * to give more input after this method was called. This method must
+ * be called to force all bytes to be flushed.
+ */
+ public native void finish();
- public void setDictionary (byte[] buf)
+ /**
+ * Returns true iff the stream was finished and no more output bytes
+ * are available.
+ */
+ public synchronized boolean finished()
{
- setDictionary (buf, 0, buf.length);
+ return is_finished;
}
- public native void setDictionary (byte[] buf, int off, int len);
+ /**
+ * Returns true, if the input buffer is empty.
+ * You should then call setInput(). <br>
+ *
+ * <em>NOTE</em>: This method can also return true when the stream
+ * was finished.
+ */
+ public native boolean needsInput();
- public void setInput (byte[] buf)
+ /**
+ * Sets the data which should be compressed next. This should be only
+ * called when needsInput indicates that more input is needed.
+ * If you call setInput when needsInput() returns false, the
+ * previous input that is still pending will be thrown away.
+ * The given byte array should not be changed, before needsInput() returns
+ * true again.
+ * This call is equivalent to <code>setInput(input, 0, input.length)</code>.
+ * @param input the buffer containing the input data.
+ * @exception IllegalStateException if the buffer was finished() or ended().
+ */
+ public void setInput(byte[] input)
{
- setInput (buf, 0, buf.length);
+ setInput(input, 0, input.length);
}
- public native void setInput (byte[] buf, int off, int len);
+ /**
+ * Sets the data which should be compressed next. This should be
+ * only called when needsInput indicates that more input is needed.
+ * The given byte array should not be changed, before needsInput() returns
+ * true again.
+ * @param input the buffer containing the input data.
+ * @param off the start of the data.
+ * @param len the length of the data.
+ * @exception IllegalStateException if the buffer was finished() or ended()
+ * or if previous input is still pending.
+ */
+ public native void setInput(byte[] input, int off, int len);
- public synchronized void setLevel (int lvl)
+ /**
+ * Sets the compression level. There is no guarantee of the exact
+ * position of the change, but if you call this when needsInput is
+ * true the change of compression level will occur somewhere near
+ * before the end of the so far given input.
+ * @param lvl the new compression level.
+ */
+ public synchronized void setLevel(int lvl)
{
if (lvl != -1 && (lvl < 0 || lvl > 9))
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException();
level = (lvl == -1) ? 6 : lvl;
- update ();
+ update();
}
- public synchronized void setStrategy (int stgy)
+ /**
+ * Sets the compression strategy. Strategy is one of
+ * DEFAULT_STRATEGY, HUFFMAN_ONLY and FILTERED. For the exact
+ * position where the strategy is changed, the same as for
+ * setLevel() applies.
+ * @param stgy the new compression strategy.
+ */
+ public synchronized void setStrategy(int stgy)
{
if (stgy != DEFAULT_STRATEGY && stgy != FILTERED
&& stgy != HUFFMAN_ONLY)
- throw new IllegalArgumentException ();
+ throw new IllegalArgumentException();
strategy = stgy;
- update ();
+ update();
}
- // Compression level.
- private int level;
-
- // Compression strategy.
- private int strategy;
+ /**
+ * Deflates the current input block to the given array. It returns
+ * the number of bytes compressed, or 0 if either
+ * needsInput() or finished() returns true or length is zero.
+ * @param output the buffer where to write the compressed data.
+ */
+ public int deflate(byte[] output)
+ {
+ return deflate(output, 0, output.length);
+ }
- // The zlib stream.
- private RawData zstream;
+ /**
+ * Deflates the current input block to the given array. It returns
+ * the number of bytes compressed, or 0 if either
+ * needsInput() or finished() returns true or length is zero.
+ * @param output the buffer where to write the compressed data.
+ * @param offset the offset into the output array.
+ * @param length the maximum number of bytes that may be written.
+ * @exception IllegalStateException if end() was called.
+ * @exception IndexOutOfBoundsException if offset and/or length
+ * don't match the array length.
+ */
+ public native int deflate(byte[] output, int off, int len);
- // True if finished.
- private boolean is_finished;
+ /**
+ * Sets the dictionary which should be used in the deflate process.
+ * This call is equivalent to <code>setDictionary(dict, 0,
+ * dict.length)</code>.
+ * @param dict the dictionary.
+ * @exception IllegalStateException if setInput () or deflate ()
+ * were already called or another dictionary was already set.
+ */
+ public void setDictionary(byte[] dict)
+ {
+ setDictionary(dict, 0, dict.length);
+ }
- // `Flush' flag to pass to next call to deflate.
- private int flush_flag;
+ /**
+ * Sets the dictionary which should be used in the deflate process.
+ * The dictionary should be a byte array containing strings that are
+ * likely to occur in the data which should be compressed. The
+ * dictionary is not stored in the compressed output, only a
+ * checksum. To decompress the output you need to supply the same
+ * dictionary again.
+ * @param dict the dictionary.
+ * @param offset an offset into the dictionary.
+ * @param length the length of the dictionary.
+ * @exception IllegalStateException if setInput () or deflate () were
+ * already called or another dictionary was already set.
+ */
+ public native void setDictionary(byte[] buf, int off, int len);
}
diff --git a/libjava/java/util/zip/DeflaterOutputStream.java b/libjava/java/util/zip/DeflaterOutputStream.java
index 6a4fa95886b..6cc3fbf9c23 100644
--- a/libjava/java/util/zip/DeflaterOutputStream.java
+++ b/libjava/java/util/zip/DeflaterOutputStream.java
@@ -1,5 +1,5 @@
/* DeflaterOutputStream.java - Output filter for compressing.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/libjava/java/util/zip/GZIPInputStream.java b/libjava/java/util/zip/GZIPInputStream.java
index 68fda79dc88..6699e56ee69 100644
--- a/libjava/java/util/zip/GZIPInputStream.java
+++ b/libjava/java/util/zip/GZIPInputStream.java
@@ -1,5 +1,5 @@
/* GZIPInputStream.java - Input filter for reading gzip file
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,73 +41,81 @@ import java.io.InputStream;
import java.io.IOException;
/**
+ * This filter stream is used to decompress a "GZIP" format stream.
+ * The "GZIP" format is described in RFC 1952.
+ *
+ * @author John Leuner
* @author Tom Tromey
- * @date May 17, 1999
+ * @since JDK 1.1
*/
-
-/* Written using on-line Java Platform 1.2 API Specification
- * and JCL book.
- * Believed complete and correct.
- */
-
-public class GZIPInputStream extends InflaterInputStream
+public class GZIPInputStream
+ extends InflaterInputStream
{
+ /**
+ * The magic number found at the start of a GZIP stream.
+ */
public static final int GZIP_MAGIC = 0x8b1f;
- public void close () throws IOException
- {
- // Nothing to do here.
- super.close();
- }
-
- public GZIPInputStream (InputStream istream) throws IOException
+ /**
+ * Creates a GZIPInputStream with the default buffer size.
+ *
+ * @param in The stream to read compressed data from
+ * (in GZIP format).
+ *
+ * @throws IOException if an error occurs during an I/O operation.
+ */
+ public GZIPInputStream(InputStream in)
+ throws IOException
{
- this (istream, 512);
+ this(in, 512);
}
- private final int eof_read () throws IOException
- {
- int r = in.read();
- if (r == -1)
- throw new ZipException ("gzip header corrupted");
- return r & 0xff;
- }
-
- public GZIPInputStream (InputStream istream, int readsize)
+ /**
+ * Creates a GZIPInputStream with the specified buffer size.
+ *
+ * @param in The stream to read compressed data from
+ * (in GZIP format).
+ * @param size The size of the buffer to use.
+ *
+ * @throws IOException if an error occurs during an I/O operation.
+ * @throws IllegalArgumentException if <code>size</code>
+ * is less than or equal to 0.
+ */
+ public GZIPInputStream(InputStream in, int size)
throws IOException
{
- super (istream, new Inflater (true), readsize);
+ super(in, new Inflater(true), size);
// NOTE: header reading code taken from zlib's gzio.c.
// Read the magic number.
- int magic = eof_read () | (eof_read () << 8);
+ int magic = eof_read() | (eof_read() << 8);
if (magic != GZIP_MAGIC)
- throw new ZipException ("gzip header corrupted");
+ throw new ZipException("gzip header corrupted");
- int method = eof_read ();
- int flags = eof_read ();
+ int method = eof_read();
+ int flags = eof_read();
// Test from zlib.
if (method != Z_DEFLATED || (flags & RESERVED) != 0)
- throw new ZipException ("gzip header corrupted");
+ throw new ZipException("gzip header corrupted");
// Discard time, xflags, OS code.
for (int i = 0; i < 6; ++i)
- eof_read ();
+ eof_read();
// Skip the extra field.
if ((flags & EXTRA_FIELD) != 0)
{
- int len = eof_read () | (eof_read () << 8);
+ int len = eof_read() | (eof_read() << 8);
while (len-- != 0)
- eof_read ();
+ eof_read();
}
if ((flags & ORIG_NAME) != 0)
{
while (true)
{
- int c = eof_read ();
+ int c = eof_read();
if (c == 0)
break;
}
@@ -117,7 +125,7 @@ public class GZIPInputStream extends InflaterInputStream
{
while (true)
{
- int c = eof_read ();
+ int c = eof_read();
if (c == 0)
break;
}
@@ -126,46 +134,78 @@ public class GZIPInputStream extends InflaterInputStream
if ((flags & HEAD_CRC) != 0)
{
// FIXME: consider checking CRC of the header.
- eof_read ();
- eof_read ();
+ eof_read();
+ eof_read();
}
- crc = new CRC32 ();
+ crc = new CRC32();
+ }
+
+ /**
+ * Closes the input stream.
+ *
+ * @throws IOException if an error occurs during an I/O operation.
+ */
+ public void close()
+ throws IOException
+ {
+ // Nothing to do here.
+ super.close();
+ }
+
+ private final int eof_read() throws IOException
+ {
+ int r = in.read();
+ if (r == -1)
+ throw new ZipException("gzip header corrupted");
+ return r & 0xff;
}
- public int read (byte[] buf, int off, int len) throws IOException
+ /**
+ * Reads in GZIP-compressed data and stores it in uncompressed form
+ * into an array of bytes. The method will block until either
+ * enough input data becomes available or the compressed stream
+ * reaches its end.
+ *
+ * @param buf the buffer into which the uncompressed data will
+ * be stored.
+ * @param offset the offset indicating where in <code>buf</code>
+ * the uncompressed data should be placed.
+ * @param len the number of uncompressed bytes to be read.
+ */
+ public int read(byte[] buf, int offset, int len) throws IOException
{
if (eos)
return -1;
- int r = super.read(buf, off, len);
+ int r = super.read(buf, offset, len);
if (r == -1)
{
eos = true;
byte[] tmp = new byte[8];
// First copy remaining bytes from inflater input buffer.
- int avail = inf.getRemaining ();
- System.arraycopy (this.buf, this.len - avail, tmp, 0, avail);
+ int avail = inf.getRemaining();
+ System.arraycopy(this.buf, this.len - avail, tmp, 0, avail);
// Now read remaining bytes from wrapped input stream.
for (int i = avail; i < 8; ++i)
{
- tmp[i] = (byte) eof_read ();
+ tmp[i] = (byte) eof_read();
}
- int header_crc = read4 (tmp, 0);
+ int header_crc = read4(tmp, 0);
if (crc.getValue() != header_crc)
- throw new ZipException ("corrupted gzip file - crc mismatch");
- int isize = read4 (tmp, 4);
+ throw new ZipException("corrupted gzip file - crc mismatch");
+ int isize = read4(tmp, 4);
if (inf.getTotalOut() != isize)
- throw new ZipException ("corrupted gzip file - size mismatch");
+ throw new ZipException("corrupted gzip file - size mismatch");
return -1;
}
- crc.update(buf, off, r);
+ crc.update(buf, offset, r);
return r;
}
- private final int read4 (byte[] buf, int offset) throws IOException
+ private final int read4(byte[] buf, int offset) throws IOException
{
return (((buf[offset + 3] & 0xFF) << 24) + ((buf[offset + 2] & 0xFF) << 16)
+ ((buf[offset + 1] & 0xFF) << 8) + (buf[offset] & 0xFF));
diff --git a/libjava/javax/swing/AbstractCellEditor.java b/libjava/javax/swing/AbstractCellEditor.java
index b2a4f4c7b50..3463c97547c 100644
--- a/libjava/javax/swing/AbstractCellEditor.java
+++ b/libjava/javax/swing/AbstractCellEditor.java
@@ -1,5 +1,5 @@
/* AbstractCellEditor.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,15 +54,15 @@ public abstract class AbstractCellEditor
{
static final long serialVersionUID = -1048006551406220959L;
- /**
- * listenerList
- */
- protected EventListenerList listenerList;
+ /**
+ * listenerList
+ */
+ protected EventListenerList listenerList;
- /**
- * changeEvent
- */
- protected transient ChangeEvent changeEvent;
+ /**
+ * changeEvent
+ */
+ protected transient ChangeEvent changeEvent;
/**
* Constructor AbstractCellEditor
@@ -104,12 +104,6 @@ public abstract class AbstractCellEditor
// TODO
} // cancelCellEditing()
- /**
- * getCellEditorValue
- * @returns Object
- */
- public abstract Object getCellEditorValue();
-
/**
* addCellEditorListener
*
@@ -165,6 +159,4 @@ public abstract class AbstractCellEditor
listeners [index].editingCanceled (changeEvent);
}
}
-
-
-} // AbstractCellEditor
+}
diff --git a/libjava/javax/swing/Box.java b/libjava/javax/swing/Box.java
index eee96b1cdc8..d2faeac557e 100644
--- a/libjava/javax/swing/Box.java
+++ b/libjava/javax/swing/Box.java
@@ -47,9 +47,10 @@ import javax.accessibility.Accessible;
*/
public class Box extends JComponent implements Accessible
{
- Box(int a)
- {
- setLayout(new BoxLayout(this,
- a));
- }
+ private static final long serialVersionUID = 1525417495883046342L;
+
+ public Box(int a)
+ {
+ setLayout(new BoxLayout(this, a));
+ }
}
diff --git a/libjava/javax/swing/ButtonGroup.java b/libjava/javax/swing/ButtonGroup.java
index c872ab76a40..b59d5659434 100644
--- a/libjava/javax/swing/ButtonGroup.java
+++ b/libjava/javax/swing/ButtonGroup.java
@@ -129,11 +129,3 @@ public class ButtonGroup implements Serializable
}
-
-
-
-
-
-
-
-
diff --git a/libjava/javax/swing/CellEditor.java b/libjava/javax/swing/CellEditor.java
index 007ea234ec8..831cde0e7f9 100644
--- a/libjava/javax/swing/CellEditor.java
+++ b/libjava/javax/swing/CellEditor.java
@@ -45,54 +45,49 @@ import javax.swing.event.CellEditorListener;
* @author Andrew Selkirk
* @version 1.0
*/
-public interface CellEditor {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getCellEditorValue
- * @returns Object
- */
- Object getCellEditorValue();
-
- /**
- * isCellEditable
- * @param event TODO
- * @returns boolean
- */
- boolean isCellEditable(EventObject event);
-
- /**
- * shouldSelectCell
- * @param event TODO
- * @returns boolean
- */
- boolean shouldSelectCell(EventObject event);
-
- /**
- * stopCellEditing
- * @returns boolean
- */
- boolean stopCellEditing();
-
- /**
- * cancelCellEditing
- */
- void cancelCellEditing();
-
- /**
- * addCellEditorListener
- * @param value0 TODO
- */
- void addCellEditorListener(CellEditorListener listener);
-
- /**
- * removeCellEditorListener
- * @param listener TODO
- */
- void removeCellEditorListener(CellEditorListener listener);
-
+public interface CellEditor
+{
+ /**
+ * getCellEditorValue
+ * @returns Object
+ */
+ Object getCellEditorValue();
+
+ /**
+ * isCellEditable
+ * @param event TODO
+ * @returns boolean
+ */
+ boolean isCellEditable(EventObject event);
+
+ /**
+ * shouldSelectCell
+ * @param event TODO
+ * @returns boolean
+ */
+ boolean shouldSelectCell(EventObject event);
+
+ /**
+ * stopCellEditing
+ * @returns boolean
+ */
+ boolean stopCellEditing();
+
+ /**
+ * cancelCellEditing
+ */
+ void cancelCellEditing();
+
+ /**
+ * addCellEditorListener
+ * @param value0 TODO
+ */
+ void addCellEditorListener(CellEditorListener listener);
+
+ /**
+ * removeCellEditorListener
+ * @param listener TODO
+ */
+ void removeCellEditorListener(CellEditorListener listener);
} // CellEditor
diff --git a/libjava/javax/swing/CellRendererPane.java b/libjava/javax/swing/CellRendererPane.java
index e93e46446ef..6e2ba210a64 100644
--- a/libjava/javax/swing/CellRendererPane.java
+++ b/libjava/javax/swing/CellRendererPane.java
@@ -52,7 +52,9 @@ import javax.accessibility.AccessibleRole;
* @author Andrew Selkirk
* @version 1.0
*/
-public class CellRendererPane extends Container implements Accessible {
+public class CellRendererPane extends Container implements Accessible
+{
+ private static final long serialVersionUID = -7642183829532984273L;
//-------------------------------------------------------------
// Classes ----------------------------------------------------
@@ -63,6 +65,8 @@ public class CellRendererPane extends Container implements Accessible {
*/
protected class AccessibleCellRendererPane extends AccessibleAWTContainer {
+ private static final long serialVersionUID = 7300340301783504481L;
+
//-------------------------------------------------------------
// Initialization ---------------------------------------------
//-------------------------------------------------------------
diff --git a/libjava/javax/swing/DefaultListModel.java b/libjava/javax/swing/DefaultListModel.java
index 43846a5cdbe..3ba13cdaf5d 100644
--- a/libjava/javax/swing/DefaultListModel.java
+++ b/libjava/javax/swing/DefaultListModel.java
@@ -50,6 +50,7 @@ import java.util.Vector;
*/
public class DefaultListModel extends AbstractListModel
{
+ private static final long serialVersionUID = 2315945659722172272L;
//-------------------------------------------------------------
// Variables --------------------------------------------------
diff --git a/libjava/javax/swing/DefaultListSelectionModel.java b/libjava/javax/swing/DefaultListSelectionModel.java
index 7ad66b0e302..093e3e616af 100644
--- a/libjava/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/javax/swing/DefaultListSelectionModel.java
@@ -1,5 +1,5 @@
/* DefaultListSelectionModel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,15 +47,12 @@ import javax.swing.event.ListSelectionListener;
public class DefaultListSelectionModel implements Cloneable, ListSelectionModel, Serializable
{
- private EventListenerList listenerList = new EventListenerList();
+ protected EventListenerList listenerList = new EventListenerList();
int mode = SINGLE_SELECTION;
Vector sel = new Vector();
- {
- }
-
class Range
{
int i0, i1;
@@ -169,23 +166,59 @@ public class DefaultListSelectionModel implements Cloneable, ListSelectionModel,
sel.addElement(new Range(index0, index1));
}
+ /**
+ * Adds a listener.
+ *
+ * @param listener the listener to add
+ *
+ * @see removeListSelectionListener
+ * @see getListSelectionListeners
+ */
public void addListSelectionListener(ListSelectionListener listener)
{
listenerList.add (ListSelectionListener.class, listener);
}
+ /**
+ * Removes a registered listener.
+ *
+ * @param listener the listener to remove
+ *
+ * @see addListSelectionListener
+ * @see getListSelectionListeners
+ */
public void removeListSelectionListener(ListSelectionListener listener)
{
listenerList.remove (ListSelectionListener.class, listener);
}
-
- public ListSelectionListener[] getListSelectionListeners()
- {
- return (ListSelectionListener[]) getListeners (ListSelectionListener.class);
- }
+ /**
+ * Returns an array of all registerers listeners.
+ *
+ * @return the array
+ *
+ * @since 1.3
+ *
+ * @see getListSelectionListener
+ */
public EventListener[] getListeners (Class listenerType)
{
return listenerList.getListeners (listenerType);
}
+
+ /**
+ * Returns an array of all registerd list selection listeners.
+ *
+ * @return the array
+ *
+ * @since 1.4
+ *
+ * @see addListSelectionListener
+ * @see removeListSelectionListener
+ * @see getListeners
+ */
+ public ListSelectionListener[] getListSelectionListeners()
+ {
+ return (ListSelectionListener[]) getListeners (ListSelectionListener.class);
+ }
}
diff --git a/libjava/javax/swing/JApplet.java b/libjava/javax/swing/JApplet.java
index ed450ced7a5..82976d38c7b 100644
--- a/libjava/javax/swing/JApplet.java
+++ b/libjava/javax/swing/JApplet.java
@@ -80,7 +80,7 @@ public class JApplet extends Applet
public Dimension getPreferredSize()
{
Dimension d = super.getPreferredSize();
- System.out.println("JFrame.getPrefSize(): " + d + " , comp="+countComponents() + ", layout=" + getLayout());
+ System.out.println("JFrame.getPrefSize(): " + d + " , comp="+ getComponentCount () + ", layout=" + getLayout());
return d;
}
diff --git a/libjava/javax/swing/JComboBox.java b/libjava/javax/swing/JComboBox.java
index b0192936c29..b3c5ccf8834 100644
--- a/libjava/javax/swing/JComboBox.java
+++ b/libjava/javax/swing/JComboBox.java
@@ -1,5 +1,5 @@
/* JComboBox.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/libjava/javax/swing/JComponent.java b/libjava/javax/swing/JComponent.java
index b95b7e6c480..fa41951973a 100644
--- a/libjava/javax/swing/JComponent.java
+++ b/libjava/javax/swing/JComponent.java
@@ -1,5 +1,5 @@
/* JComponent.java -- Every component in swing inherits from this class.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,8 +63,9 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.io.Serializable;
-import java.util.Vector;
+import java.util.EventListener;
import java.util.Hashtable;
+import java.util.Vector;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleExtendedComponent;
@@ -86,6 +87,9 @@ import javax.swing.plaf.ComponentUI;
public abstract class JComponent extends Container implements Serializable
{
static final long serialVersionUID = -5242478962609715464L;
+
+ protected EventListenerList listenerList = new EventListenerList();
+
/**
* accessibleContext
*/
@@ -98,9 +102,6 @@ public abstract class JComponent extends Container implements Serializable
boolean use_double_buffer, opaque;
protected ComponentUI ui;
- Vector ancestor_list;
- Vector veto_list;
- Vector change_list;
Hashtable prop_hash;
/**
@@ -273,16 +274,12 @@ public abstract class JComponent extends Container implements Serializable
super();
super.setLayout(new FlowLayout());
- listenerList = new EventListenerList();
-
//eventMask |= AWTEvent.COMP_KEY_EVENT_MASK;
// enableEvents( AWTEvent.KEY_EVENT_MASK );
//updateUI(); // get a proper ui
}
- protected EventListenerList listenerList;
-
public boolean contains(int x, int y)
{
//return dims.contains(x,y);
@@ -301,24 +298,6 @@ public abstract class JComponent extends Container implements Serializable
prop_hash = new Hashtable();
return prop_hash;
}
- public Vector get_veto_list()
- {
- if (veto_list == null)
- veto_list = new Vector();
- return veto_list;
- }
- public Vector get_change_list()
- {
- if (change_list == null)
- change_list = new Vector();
- return change_list;
- }
- public Vector get_ancestor_list()
- {
- if (ancestor_list == null)
- ancestor_list = new Vector();
- return ancestor_list;
- }
public Object getClientProperty(Object key)
{ return get_prop_hash().get(key); }
@@ -326,29 +305,99 @@ public abstract class JComponent extends Container implements Serializable
public void putClientProperty(Object key, Object value)
{ get_prop_hash().put(key, value); }
- public void removeAncestorListener(AncestorListener listener)
- { get_ancestor_list().removeElement(listener); }
-
- public void removePropertyChangeListener(PropertyChangeListener listener)
- { get_change_list().removeElement(listener); }
-
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
- { /* FIXME */ get_change_list().removeElement(listener); }
-
- public void removeVetoableChangeListener(VetoableChangeListener listener)
- { get_veto_list().removeElement(listener); }
-
- public void addAncestorListener(AncestorListener listener)
- { get_ancestor_list().addElement(listener); }
-
- public void addPropertyChangeListener(PropertyChangeListener listener)
- { get_change_list().addElement(listener); }
-
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
- { /* FIXME */ get_change_list().addElement(listener); }
-
- public void addVetoableChangeListener(VetoableChangeListener listener)
- { get_veto_list().addElement(listener); }
+ /**
+ * Unregister an <code>AncestorListener</code>.
+ */
+ public void removeAncestorListener(AncestorListener listener)
+ {
+ listenerList.remove(AncestorListener.class, listener);
+ }
+
+ /**
+ * Unregister a <code>PropertyChangeListener</code>.
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ listenerList.remove(PropertyChangeListener.class, listener);
+ }
+
+ /**
+ * Unregister a <code>PropertyChangeListener</code>.
+ */
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
+ {
+ listenerList.remove(PropertyChangeListener.class, listener);
+ }
+
+ /**
+ * Unregister a <code>VetoableChangeChangeListener</code>.
+ */
+ public void removeVetoableChangeListener(VetoableChangeListener listener)
+ {
+ listenerList.remove(VetoableChangeListener.class, listener);
+ }
+
+ /**
+ * Register an <code>AncestorListener</code>.
+ */
+ public void addAncestorListener(AncestorListener listener)
+ {
+ listenerList.add(AncestorListener.class, listener);
+ }
+
+ /**
+ * Register a <code>PropertyChangeListener</code>.
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ listenerList.add(PropertyChangeListener.class, listener);
+ }
+
+ /**
+ * Register a <code>PropertyChangeListener</code>.
+ */
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
+ {
+ listenerList.add(PropertyChangeListener.class, listener);
+ }
+
+ /**
+ * Register a <code>VetoableChangeListener</code>.
+ */
+ public void addVetoableChangeListener(VetoableChangeListener listener)
+ {
+ listenerList.add(VetoableChangeListener.class, listener);
+ }
+
+ /**
+ * Return all registered listeners of a special type.
+ *
+ * @since 1.3
+ */
+ public EventListener[] getListeners (Class listenerType)
+ {
+ return listenerList.getListeners (listenerType);
+ }
+
+ /**
+ * Return all registered <code>Ancestor</code> objects.
+ *
+ * @since 1.4
+ */
+ public AncestorListener[] getAncestorListeners()
+ {
+ return (AncestorListener[]) getListeners (AncestorListener.class);
+ }
+
+ /**
+ * Return all registered <code>VetoableChangeListener</code> objects.
+ *
+ * @since 1.4
+ */
+ public VetoableChangeListener[] getVetoableChangeListeners()
+ {
+ return (VetoableChangeListener[]) getListeners (VetoableChangeListener.class);
+ }
public void computeVisibleRect(Rectangle rect)
{
@@ -397,6 +446,7 @@ public abstract class JComponent extends Container implements Serializable
}
protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
+ throws PropertyVetoException
{
// Support for reporting constrained property changes.
}
diff --git a/libjava/javax/swing/JEditorPane.java b/libjava/javax/swing/JEditorPane.java
index bce9dc70640..273ed899ea3 100644
--- a/libjava/javax/swing/JEditorPane.java
+++ b/libjava/javax/swing/JEditorPane.java
@@ -1,5 +1,5 @@
/* JEditorPane.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,7 @@ package javax.swing;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.io.InputStream;
+import java.io.IOException;
import java.net.URL;
import javax.accessibility.AccessibleContext;
import javax.swing.text.EditorKit;
@@ -51,6 +52,8 @@ import javax.swing.event.HyperlinkListener;
public class JEditorPane extends JTextComponent
{
+ private static final long serialVersionUID = 3140472492599046285L;
+
URL page_url;
EditorKit kit;
String ctype = "text/plain";
@@ -63,6 +66,7 @@ public class JEditorPane extends JTextComponent
}
public JEditorPane(String url)
+ throws IOException
{
this();
setPage(url);
@@ -75,13 +79,11 @@ public class JEditorPane extends JTextComponent
}
public JEditorPane(URL url)
+ throws IOException
{
setPage(url);
}
- void addHyperlinkListener(HyperlinkListener listener)
- { }
-
protected EditorKit createDefaultEditorKit()
{ return new PlainEditorKit(); }
@@ -171,11 +173,6 @@ public class JEditorPane extends JTextComponent
//Establishes the default bindings of type to classname.
}
- void removeHyperlinkListener(HyperlinkListener listener)
- {
- //Removes a hyperlink listener.
- }
-
void replaceSelection(String content)
{
//Replaces the currently selected content with new content represented by the given string.
@@ -207,11 +204,13 @@ public class JEditorPane extends JTextComponent
}
void setPage(String url)
+ throws IOException
{
// Sets the current URL being displayed.
}
void setPage(URL page)
+ throws IOException
{
// Sets the current URL being displayed.
}
@@ -220,4 +219,23 @@ public class JEditorPane extends JTextComponent
{
super.setText(t);
}
+
+ public void addHyperlinkListener(HyperlinkListener listener)
+ {
+ listenerList.add (HyperlinkListener.class, listener);
+ }
+
+ public void removeHyperlinkListener (HyperlinkListener listener)
+ {
+ listenerList.remove (HyperlinkListener.class, listener);
+ }
+
+ /**
+ * @since 1.4
+ */
+ public HyperlinkListener[] getHyperlinkListeners()
+ {
+ return (HyperlinkListener[]) getListeners (HyperlinkListener.class);
+ }
+
} // class JEditorPane
diff --git a/libjava/javax/swing/JFileChooser.java b/libjava/javax/swing/JFileChooser.java
index 988e75b7743..47b086180d1 100644
--- a/libjava/javax/swing/JFileChooser.java
+++ b/libjava/javax/swing/JFileChooser.java
@@ -59,6 +59,8 @@ import javax.swing.plaf.FileChooserUI;
*/
public class JFileChooser extends JComponent implements Accessible {
+ private static final long serialVersionUID = 3162921138695327837L;
+
//-------------------------------------------------------------
// Classes ----------------------------------------------------
//-------------------------------------------------------------
@@ -68,6 +70,8 @@ public class JFileChooser extends JComponent implements Accessible {
*/
protected class AccessibleJFileChooser extends AccessibleJComponent {
+ private static final long serialVersionUID = 3318922050345221200L;
+
//-------------------------------------------------------------
// Variables --------------------------------------------------
//-------------------------------------------------------------
@@ -906,17 +910,24 @@ public class JFileChooser extends JComponent implements Accessible {
* addActionListener
* @param listener TODO
*/
- public void addActionListener(ActionListener listener) {
- // TODO
- } // addActionListener()
+ public void addActionListener(ActionListener listener)
+ {
+ listenerList.add (ActionListener.class, listener);
+ }
/**
* removeActionListener
* @param listener TODO
*/
- public void removeActionListener(ActionListener listener) {
- // TODO
- } // removeActionListener()
+ public void removeActionListener(ActionListener listener)
+ {
+ listenerList.remove (ActionListener.class, listener);
+ }
+
+ public ActionListener[] getActionListeners()
+ {
+ return (ActionListener[]) listenerList.getListeners (ActionListener.class);
+ }
/**
* fireActionPerformed
diff --git a/libjava/javax/swing/JFormattedTextField.java b/libjava/javax/swing/JFormattedTextField.java
index f26af99e60e..801ffac47be 100644
--- a/libjava/javax/swing/JFormattedTextField.java
+++ b/libjava/javax/swing/JFormattedTextField.java
@@ -52,14 +52,19 @@ import javax.swing.text.NavigationFilter;
*/
public class JFormattedTextField extends JTextField
{
+ private static final long serialVersionUID = 2889768923115424035L;
+
public abstract static class AbstractFormatter implements Serializable
{
+ private static final long serialVersionUID = -5193212041738979680L;
+
public AbstractFormatter ()
{
//Do nothing here.
}
protected Object clone ()
+ throws CloneNotSupportedException
{
throw new InternalError ("not implemented");
}
@@ -99,14 +104,16 @@ public class JFormattedTextField extends JTextField
throw new InternalError ("not implemented");
}
- protected void setEditValid ()
+ protected void setEditValid (boolean valid)
{
throw new InternalError ("not implemented");
}
- public abstract Object stringToValue (String text);
+ public abstract Object stringToValue (String text)
+ throws ParseException;
- public abstract String valueToString (Object value);
+ public abstract String valueToString (Object value)
+ throws ParseException;
}
public abstract static class AbstractFormatterFactory
@@ -155,6 +162,7 @@ public class JFormattedTextField extends JTextField
}
public void commitEdit ()
+ throws ParseException
{
throw new InternalError ("not implemented");
}
diff --git a/libjava/javax/swing/JLabel.java b/libjava/javax/swing/JLabel.java
index c49615c4638..227fe644edb 100644
--- a/libjava/javax/swing/JLabel.java
+++ b/libjava/javax/swing/JLabel.java
@@ -46,6 +46,8 @@ import javax.swing.plaf.LabelUI;
public class JLabel extends JComponent implements Accessible, SwingConstants
{
+ private static final long serialVersionUID = 5496508283662221534L;
+
String text;
Icon icon;
int gap;
diff --git a/libjava/javax/swing/JList.java b/libjava/javax/swing/JList.java
index 22d35a5a2c0..792a0f2b66f 100644
--- a/libjava/javax/swing/JList.java
+++ b/libjava/javax/swing/JList.java
@@ -51,6 +51,8 @@ import javax.swing.plaf.ListUI;
public class JList extends JComponent implements Accessible, Scrollable
{
+ private static final long serialVersionUID = 4406629526391098046L;
+
Color select_back, select_fore;
ListCellRenderer render;
int visibles = 8;
@@ -105,10 +107,23 @@ public class JList extends JComponent implements Accessible, Scrollable
repaint();
}
- void addListSelectionListener(ListSelectionListener listener)
- { sel_model.addListSelectionListener(listener); }
- void removeListSelectionListener(ListSelectionListener listener)
- { sel_model.removeListSelectionListener(listener); }
+ public void addListSelectionListener (ListSelectionListener listener)
+ {
+ sel_model.addListSelectionListener (listener);
+ }
+
+ public void removeListSelectionListener (ListSelectionListener listener)
+ {
+ sel_model.removeListSelectionListener (listener);
+ }
+
+ /**
+ * @since 1.4
+ */
+ public ListSelectionListener[] getListSelectionListeners()
+ {
+ throw new Error ("not implemented");
+ }
void setSelectionMode(int a)
{ sel_model.setSelectionMode(a); }
diff --git a/libjava/javax/swing/SwingUtilities.java b/libjava/javax/swing/SwingUtilities.java
index 1591132882e..e226919eb39 100644
--- a/libjava/javax/swing/SwingUtilities.java
+++ b/libjava/javax/swing/SwingUtilities.java
@@ -1,4 +1,4 @@
-/* SwingUtilities.java --
+/* SwingUtilities.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
+import java.applet.Applet;
import java.awt.Component;
+import java.awt.ComponentOrientation;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.Font;
@@ -55,81 +56,623 @@ import java.lang.reflect.InvocationTargetException;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleStateSet;
+
+/**
+ * This class contains a number of static utility functions which are
+ * useful when drawing swing components, dispatching events, or calculating
+ * regions which need painting.
+ *
+ * @author Graydon Hoare (graydon&064;redhat.com)
+ */
public class SwingUtilities implements SwingConstants
{
- public static FontMetrics getFontMetrics (Font font)
+
+ /**
+ * Calculates the portion of the base rectangle which is inside the
+ * insets.
+ *
+ * @param base The rectangle to apply the insets to
+ * @param insets The insets to apply to the base rectangle
+ * @param ret A rectangle to use for storing the return value, or
+ * <code>null</code>
+ *
+ * @return The calculated area inside the base rectangle and its insets,
+ * either stored in ret or a new Rectangle if ret is <code>null</code>
+ *
+ * @see #calculateInnerArea
+ */
+ public static Rectangle calculateInsetArea(Rectangle base, Insets insets,
+ Rectangle ret)
+ {
+ if (ret == null)
+ ret = new Rectangle();
+ ret.setBounds(base.x + insets.left, base.y + insets.top,
+ base.width - (insets.left + insets.right),
+ base.height - (insets.top + insets.bottom));
+ return ret;
+ }
+
+ /**
+ * Calculates the portion of the component's bounds which is inside the
+ * component's border insets. This area is usually the area a component
+ * should confine its painting to.
+ *
+ * @param c The component to measure the bounds of
+ * @param r A Rectangle to store the return value in, or
+ * <code>null</code>
+ *
+ * @return The calculated area inside the component and its border
+ * insets
+ *
+ * @see #calculateInsetArea
+ */
+ public static Rectangle calculateInnerArea(JComponent c, Rectangle r)
{
- return Toolkit.getDefaultToolkit ().getFontMetrics (font);
+ return calculateInsetArea(c.getBounds(), c.getInsets(), r);
}
- public static JRootPane getRootPane (Component a)
+ /**
+ * Calculates the bounds of a component in the component's own coordinate
+ * space. The result has the same height and width as the component's
+ * bounds, but its location is set to (0,0).
+ *
+ * @param aComponent The component to measure
+ *
+ * @return The component's bounds in its local coordinate space
+ */
+ public static Rectangle getLocalBounds(Component aComponent)
{
- if (a instanceof JRootPane)
- return (JRootPane) a;
-
- a = a.getParent();
+ Rectangle bounds = aComponent.getBounds();
+ return new Rectangle(0, 0, bounds.x, bounds.y);
+ }
+
+ /**
+ * Returns the font metrics object for a given font. The metrics can be
+ * used to calculate crude bounding boxes and positioning information,
+ * for laying out components with textual elements.
+ *
+ * @param font The font to get metrics for
+ *
+ * @return The font's metrics
+ *
+ * @see java.awt.font.GlyphMetrics
+ */
+ public static FontMetrics getFontMetrics(Font font)
+ {
+ return Toolkit.getDefaultToolkit().getFontMetrics(font);
+ }
- if (a != null)
+ /**
+ * If <code>comp</code> is a RootPaneContainer, return its JRootPane.
+ * Otherwise call <code>getAncestorOfClass(JRootPane.class, a)</code>.
+ *
+ * @param comp The component to get the JRootPane of
+ *
+ * @return a suitable JRootPane for <code>comp</code>, or <code>null</code>
+ *
+ * @see javax.swing.RootPaneContainer#getRootPane
+ * @see #getAncestorOfClass
+ */
+ public static JRootPane getRootPane(Component comp)
+ {
+ if (comp instanceof RootPaneContainer)
+ return ((RootPaneContainer)comp).getRootPane();
+ else
+ return (JRootPane) getAncestorOfClass(JRootPane.class, comp);
+ }
+
+ /**
+ * Returns the least ancestor of <code>comp</code> which has the
+ * specified name.
+ *
+ * @param name The name to search for
+ * @param comp The component to search the ancestors of
+ *
+ * @return The nearest ancestor of <code>comp</code> with the given
+ * name, or <code>null</code> if no such ancestor exists
+ *
+ * @see java.awt.Component#getName
+ * @see #getAncestorOfClass
+ */
+ public static Container getAncestorNamed(String name, Component comp)
+ {
+ while (comp != null && (comp.getName() != name))
+ comp = comp.getParent();
+ return (Container) comp;
+ }
+
+ /**
+ * Returns the least ancestor of <code>comp</code> which is an instance
+ * of the specified class.
+ *
+ * @param c The class to search for
+ * @param comp The component to search the ancestors of
+ *
+ * @return The nearest ancestor of <code>comp</code> which is an instance
+ * of the given class, or <code>null</code> if no such ancestor exists
+ *
+ * @see #getAncestorOfClass
+ * @see #windowForComponent
+ * @see
+ *
+ */
+ public static Container getAncestorOfClass(Class c, Component comp)
+ {
+ while (comp != null && (! c.isInstance(comp)))
+ comp = comp.getParent();
+ return (Container) comp;
+ }
+
+ /**
+ * Equivalent to calling <code>getAncestorOfClass(Window, comp)</code>.
+ *
+ * @param comp The component to search for an ancestor window
+ *
+ * @return An ancestral window, or <code>null</code> if none exists
+ */
+ public static Window windowForComponent(Component comp)
+ {
+ return (Window) getAncestorOfClass(Window.class, comp);
+ }
+
+ /**
+ * Returns the "root" of the component tree containint <code>comp</code>
+ * The root is defined as either the <em>least</em> ancestor of
+ * <code>comp</code> which is a {@link Window}, or the <em>greatest</em>
+ * ancestor of <code>comp</code> which is a {@link Applet} if no {@link
+ * Window} ancestors are found.
+ *
+ * @param comp The component to search for a root
+ *
+ * @return The root of the component's tree, or <code>null</code>
+ */
+ public static Component getRoot(Component comp)
+ {
+ Applet app = null;
+ Window win = null;
+
+ while (comp != null)
{
- return getRootPane(a);
+ if (win == null && comp instanceof Window)
+ win = (Window) comp;
+ else if (comp instanceof Applet)
+ app = (Applet) comp;
+ comp = comp.getParent();
}
-
- return null;
+
+ if (win != null)
+ return win;
+ else
+ return app;
+ }
+
+ /**
+ * Return true if a descends from b, in other words if b is an
+ * ancestor of a.
+ *
+ * @param a The child to search the ancestry of
+ * @param b The potential ancestor to search for
+ *
+ * @return true if a is a descendent of b, false otherwise
+ */
+ public static boolean isDescendingFrom(Component a, Component b)
+ {
+ while (true)
+ {
+ if (a == null || b == null)
+ return false;
+ if (a == b)
+ return true;
+ a = a.getParent();
+ }
+ }
+
+ /**
+ * Returns the deepest descendent of parent which is both visible and
+ * contains the point <code>(x,y)</code>. Returns parent when either
+ * parent is not a container, or has no children which contain
+ * <code>(x,y)</code>. Returns <code>null</code> when either
+ * <code>(x,y)</code> is outside the bounds of parent, or parent is
+ * <code>null</code>.
+ *
+ * @param parent The component to search the descendents of
+ * @param x Horizontal coordinate to search for
+ * @param y Vertical coordinate to search for
+ *
+ * @return A component containing <code>(x,y)</code>, or
+ * <code>null</code>
+ *
+ * @see java.awt.Container#findComponentAt
+ */
+ public static Component getDeepestComponentAt(Component parent, int x, int y)
+ {
+ if (parent == null || (! parent.contains(x, y)))
+ return null;
+
+ if (! (parent instanceof Container))
+ return parent;
+
+ Container c = (Container) parent;
+ return c.findComponentAt(x, y);
+ }
+
+ /**
+ * Converts a point from a component's local coordinate space to "screen"
+ * coordinates (such as the coordinate space mouse events are delivered
+ * in). This operation is equivalent to translating the point by the
+ * location of the component (which is the origin of its coordinate
+ * space).
+ *
+ * @param p The point to convert
+ * @param c The component which the point is expressed in terms of
+ *
+ * @see convertPointFromScreen
+ */
+ public static void convertPointToScreen(Point p, Component c)
+ {
+ Point c0 = c.getLocationOnScreen();
+ p.translate(c0.x, c0.y);
+ }
+
+ /**
+ * Converts a point from "screen" coordinates (such as the coordinate
+ * space mouse events are delivered in) to a component's local coordinate
+ * space. This operation is equivalent to translating the point by the
+ * negation of the component's location (which is the origin of its
+ * coordinate space).
+ *
+ * @param p The point to convert
+ * @param c The component which the point should be expressed in terms of
+ */
+ public static void convertPointFromScreen(Point p, Component c)
+ {
+ Point c0 = c.getLocationOnScreen();
+ p.translate(-c0.x, -c0.y);
+ }
+
+ /**
+ * Converts a point <code>(x,y)</code> from the coordinate space of one
+ * component to another. This is equivalent to converting the point from
+ * <code>source</code> space to screen space, then back from screen space
+ * to <code>destination</code> space. If exactly one of the two
+ * Components is <code>null</code>, it is taken to refer to the root
+ * ancestor of the other component. If both are <code>null</code>, no
+ * transformation is done.
+ *
+ * @param source The component which the point is expressed in terms of
+ * @param x Horizontal coordinate of point to transform
+ * @param y Vertical coordinate of point to transform
+ * @param destination The component which the return value will be
+ * expressed in terms of
+ *
+ * @return The point <code>(x,y)</code> converted from the coordinate space of the
+ * source component to the coordinate space of the destination component
+ *
+ * @see #convertPointToScreen
+ * @see #convertPointFromScreen
+ * @see #convertRectangle
+ * @see #getRoot
+ */
+ public static Point convertPoint(Component source, int x, int y,
+ Component destination)
+ {
+ Point pt = new Point(x, y);
+
+ if (source == null && destination == null)
+ return pt;
+
+ if (source == null)
+ source = getRoot(destination);
+
+ if (destination == null)
+ destination = getRoot(source);
+
+ convertPointToScreen(pt, source);
+ convertPointFromScreen(pt, destination);
+
+ return pt;
+ }
+
+
+ /**
+ * Converts a rectangle from the coordinate space of one component to
+ * another. This is equivalent to converting the rectangle from
+ * <code>source</code> space to screen space, then back from screen space
+ * to <code>destination</code> space. If exactly one of the two
+ * Components is <code>null</code>, it is taken to refer to the root
+ * ancestor of the other component. If both are <code>null</code>, no
+ * transformation is done.
+ *
+ * @param source The component which the rectangle is expressed in terms of
+ * @param rect The rectangle to convert
+ * @param destination The component which the return value will be
+ * expressed in terms of
+ *
+ * @return A new rectangle, equal in size to the input rectangle, but
+ * with its position converted from the coordinate space of the source
+ * component to the coordinate space of the destination component
+ *
+ * @see #convertPointToScreen
+ * @see #convertPointFromScreen
+ * @see #convertPoint
+ * @see #getRoot
+ */
+ public static Rectangle convertRectangle(Component source,
+ Rectangle rect,
+ Component destination)
+ {
+ Point pt = convertPoint(source, rect.x, rect.y, destination);
+ return new Rectangle(pt.x, pt.y, rect.width, rect.height);
}
- public static void updateComponentTreeUI(JFrame comp)
+ /**
+ * Convert a mouse event which refrers to one component to another. This
+ * includes changing the mouse event's coordinate space, as well as the
+ * source property of the event. If <code>source</code> is
+ * <code>null</code>, it is taken to refer to <code>destination</code>'s
+ * root component. If <code>destination</code> is <code>null</code>, the
+ * new event will remain expressed in <code>source</code>'s coordinate
+ * system.
+ *
+ * @param source The component the mouse event currently refers to
+ * @param sourceEvent The mouse event to convert
+ * @param destination The component the new mouse event should refer to
+ *
+ * @return A new mouse event expressed in terms of the destination
+ * component's coordinate space, and with the destination component as
+ * its source
+ *
+ * @see #convertPoint
+ */
+ public static MouseEvent convertMouseEvent(Component source,
+ MouseEvent sourceEvent,
+ Component destination)
{
+ Point newpt = convertPoint(source, sourceEvent.getX(), sourceEvent.getY(),
+ destination);
+
+ return new MouseEvent(destination, sourceEvent.getID(),
+ sourceEvent.getWhen(), sourceEvent.getModifiers(),
+ newpt.x, newpt.y, sourceEvent.getClickCount(),
+ sourceEvent.isPopupTrigger(), sourceEvent.getButton());
}
+ /**
+ * Recursively walk the component tree under <code>comp</code> calling
+ * <code>updateUI</code> on each {@link JComponent} found. This causes
+ * the entire tree to re-initialize its UI delegates.
+ *
+ * @param comp The component to walk the children of, calling <code>updateUI</code>
+ */
+ public static void updateComponentTreeUI(Component comp)
+ {
+ if (comp == null)
+ return;
+
+ if (comp instanceof Container)
+ {
+ Component[] children = ((Container)comp).getComponents();
+ for (int i = 0; i < children.length; ++i)
+ updateComponentTreeUI(children[i]);
+ }
+
+ if (comp instanceof JComponent)
+ ((JComponent)comp).updateUI();
+ }
+
+ /**
+ * <p>Layout a "compound label" consisting of a text string and an icon
+ * which is to be placed near the rendered text. Once the text and icon
+ * are laid out, the text rectangle and icon rectangle parameters are
+ * altered to store the calculated positions.</p>
+ *
+ * <p>The size of the text is calculated from the provided font metrics
+ * object. This object should be the metrics of the font you intend to
+ * paint the label with.</p>
+ *
+ * <p>The position values control where the text is placed relative to
+ * the icon. The horizontal position value should be one of the constants
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>. The
+ * vertical position value should be one fo the constants
+ * <code>TOP</code>, <code>BOTTOM</code>, <code>CENTER</code>.</p>
+ *
+ * <p>The text-icon gap value controls the number of pixels between the
+ * icon and the text.</p>
+ *
+ * <p>The alignment values control where the text and icon are placed, as
+ * a combined unit, within the view rectangle. The horizontal alignment
+ * value should be one of the constants <code>LEADING</code>,
+ * <code>TRAILING</code>, <code>LEFT</code>, <code>RIGHT</code> or
+ * <code>CENTER</code>. The vertical alignment valus should be one of the
+ * constants <code>TOP</code>, <code>BOTTOM</code> or
+ * <code>CENTER</code>.</p>
+ *
+ * <p>If the <code>LEADING</code> or <code>TRAILING</code> constants are
+ * given for horizontal alignment, they are interpreted relative to the
+ * provided component's orientation property, a constant in the {@link
+ * java.awt.ComponentOrientation} class. For example, if the component's
+ * orientation is <code>LEFT_TO_RIGHT</code>, then the
+ * <code>LEADING</code> alignment is a synonym for <code>LEFT</code> and
+ * the <code>TRAILING</code> alignment is a synonym for
+ * <code>RIGHT</code></p>
+ *
+ * <p>If the text and icon are equal to or larger than the view
+ * rectangle, the horizontal and vertical alignment values have no
+ * affect.</p>
+ *
+ * @param c A component used for its orientation value
+ * @param fm The font metrics used to measure the text
+ * @param text The text to place in the compound label
+ * @param icon The icon to place next to the text
+ * @param verticalAlignment The vertical alignment of the label relative
+ * to its component
+ * @param horizontalAlignment The horizontal alignment of the label
+ * relative to its component
+ * @param verticalTextPosition The vertical position of the label's text
+ * relative to its icon
+ * @param horizontalTextPosition The horizontal position of the label's
+ * text relative to its icon
+ * @param viewR The view rectangle, specifying the area which layout is
+ * constrained to
+ * @param iconR A rectangle which is modified to hold the laid-out
+ * position of the icon
+ * @param textR A rectangle which is modified to hold the laid-out
+ * position of the text
+ * @param textIconGap The distance between text and icon
+ *
+ * @return The string of characters, possibly truncated with an elipsis,
+ * which is laid out in this label
+ */
public static String layoutCompoundLabel(JComponent c,
FontMetrics fm,
- String text,
- Icon i,
- int vert_a,
- int hor_i,
- int vert_text_pos,
- int hor_text_pos,
- Rectangle vr,
- Rectangle ir,
- Rectangle tr,
- int gap)
- {
- // view rect 'vr' already ok,
- // we need to compute ir (icon rect) and tr (text-rect)
-
- int next_x = vr.x;
- int next_y = vr.y;
-
- ir.height = ir.width = ir.y = ir.x = 0;
-
- if (i != null)
+ String text,
+ Icon icon,
+ int verticalAlignment,
+ int horizontalAlignment,
+ int verticalTextPosition,
+ int horizontalTextPosition,
+ Rectangle viewR,
+ Rectangle iconR,
+ Rectangle textR,
+ int textIconGap)
+ {
+
+ // Work out basic height and width.
+
+ if (icon == null)
+ {
+ textIconGap = 0;
+ iconR.width = 0;
+ iconR.height = 0;
+ }
+ else
{
- ir.x = vr.x;
- ir.y = vr.y;
- ir.width = i.getIconWidth();
- ir.height = i.getIconWidth();
+ iconR.width = icon.getIconWidth();
+ iconR.height = icon.getIconWidth();
+ }
+ textR.width = fm.stringWidth(text);
+ textR.height = fm.getHeight();
+ // Work out the position of text and icon, assuming the top-left coord
+ // starts at (0,0). We will fix that up momentarily, after these
+ // "position" decisions are made and we look at alignment.
- next_x += gap + i.getIconWidth();
- next_y += gap + i.getIconHeight();
+ switch (horizontalTextPosition)
+ {
+ case LEFT:
+ textR.x = 0;
+ iconR.x = textR.width + textIconGap;
+ break;
+ case RIGHT:
+ iconR.x = 0;
+ textR.x = iconR.width + textIconGap;
+ break;
+ case CENTER:
+ int centerLine = Math.max(textR.width, iconR.width) / 2;
+ textR.x = centerLine - textR.width/2;
+ iconR.x = centerLine - iconR.width/2;
+ break;
}
-
- tr.x = next_x;
- tr.y = vr.y; // + (vr.height/2);
- tr.width = fm.stringWidth(text);
- tr.height = fm.getHeight(); // + fm.getAscent()/2;
+ switch (verticalTextPosition)
+ {
+ case TOP:
+ textR.y = 0;
+ iconR.y = textR.height + textIconGap;
+ break;
+ case BOTTOM:
+ iconR.y = 0;
+ textR.y = iconR.height + textIconGap;
+ break;
+ case CENTER:
+ int centerLine = Math.max(textR.height, iconR.height) / 2;
+ textR.y = centerLine - textR.height/2;
+ iconR.y = centerLine - iconR.height/2;
+ break;
+ }
- return text;
- }
+ // Fix up the orientation-based alignments.
-}
+ if (horizontalAlignment == LEADING)
+ {
+ if (c.getComponentOrientation() == ComponentOrientation.LEFT_TO_RIGHT)
+ horizontalAlignment = LEFT;
+ else if (c.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
+ horizontalAlignment = RIGHT;
+ }
+ else if (horizontalAlignment == TRAILING)
+ {
+ if (c.getComponentOrientation() == ComponentOrientation.LEFT_TO_RIGHT)
+ horizontalAlignment = RIGHT;
+ else if (c.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
+ horizontalAlignment = LEFT;
+ }
+ // The two rectangles are laid out correctly now, but only assuming
+ // that their upper left corner is at (0,0). If we have any alignment other
+ // than TOP and LEFT, we need to adjust them.
+ Rectangle u = textR.union(iconR);
+ int horizontalAdjustment = viewR.x;
+ int verticalAdjustment = viewR.y;
+ switch (verticalAlignment)
+ {
+ case TOP:
+ break;
+ case BOTTOM:
+ verticalAdjustment += (viewR.height - u.height);
+ break;
+ case CENTER:
+ verticalAdjustment += ((viewR.height/2) - (u.height/2));
+ break;
+ }
+ switch (horizontalAlignment)
+ {
+ case LEFT:
+ break;
+ case RIGHT:
+ horizontalAdjustment += (viewR.width - u.width);
+ break;
+ case CENTER:
+ horizontalAdjustment += ((viewR.width/2) - (u.width/2));
+ break;
+ }
+ iconR.x += horizontalAdjustment;
+ iconR.y += verticalAdjustment;
+ textR.x += horizontalAdjustment;
+ textR.y += verticalAdjustment;
+ return text;
+ }
+ /**
+ * Calls {@link java.awt.EventQueue.invokeLater} with the
+ * specified {@link Runnable}.
+ */
+ public static void invokeLater(Runnable doRun)
+ {
+ java.awt.EventQueue.invokeLater(doRun);
+ }
+ /**
+ * Calls {@link java.awt.EventQueue.invokeAndWait} with the
+ * specified {@link Runnable}.
+ */
+ public static void invokeAndWait(Runnable doRun)
+ throws InterruptedException,
+ InvocationTargetException
+ {
+ java.awt.EventQueue.invokeAndWait(doRun);
+ }
+ /**
+ * Calls {@link java.awt.EventQueue.isEventDispatchThread}.
+ */
+ public static boolean isEventDispatchThread()
+ {
+ return java.awt.EventQueue.isDispatchThread();
+ }
+}
diff --git a/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
index c39801dc10a..3fa0ad1945f 100644
--- a/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
+++ b/libjava/javax/swing/colorchooser/AbstractColorChooserPanel.java
@@ -49,22 +49,15 @@ import javax.swing.JPanel;
* @author Andrew Selkirk
* @version 1.0
*/
-public abstract class AbstractColorChooserPanel extends JPanel {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
+public abstract class AbstractColorChooserPanel extends JPanel
+{
+ private static final long serialVersionUID = -977469671210173863L;
/**
* chooser
*/
private JColorChooser chooser;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructor AbstractColorChooserPanel
*/
@@ -72,11 +65,6 @@ public abstract class AbstractColorChooserPanel extends JPanel {
// TODO
} // AbstractColorChooserPanel()
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
/**
* getDisplayName
* @returns String
@@ -144,6 +132,4 @@ public abstract class AbstractColorChooserPanel extends JPanel {
public void paint(Graphics graphics) {
// TODO
} // paint()
-
-
} // AbstractColorChooserPanel
diff --git a/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
index f88bf928747..65cc7b9f038 100644
--- a/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/libjava/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -614,13 +614,14 @@ public class BasicGraphicsUtils
b.getToolkit().getFontMetrics(b.getFont()), // see comment above
b.getText(),
b.getIcon(),
- b.getVerticalAlignment(),
- b.getHorizontalAlignment(),
+ SwingUtilities.TOP, // important:
+ SwingUtilities.LEFT, // large vrect, stick to the top left
b.getVerticalTextPosition(),
b.getHorizontalTextPosition(),
viewRect, iconRect, textRect,
textIconGap);
+
/* +------------------------+ +------------------------+
* | | | |
* | ICON | | CONTENTCONTENTCONTENT |
diff --git a/libjava/javax/swing/table/AbstractTableModel.java b/libjava/javax/swing/table/AbstractTableModel.java
index 38e36e1744c..dd8eb69382c 100644
--- a/libjava/javax/swing/table/AbstractTableModel.java
+++ b/libjava/javax/swing/table/AbstractTableModel.java
@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing.table;
import java.io.Serializable;
@@ -271,25 +270,4 @@ public abstract class AbstractTableModel implements TableModel, Serializable
{
return listenerList.getListeners (listenerType);
}
-
- /**
- * getValueAt
- * @param value0 TODO
- * @param value1 TODO
- * @return Object
- */
- public abstract Object getValueAt (int row, int column);
-
- /**
- * getColumnCount
- * @return int
- */
- public abstract int getColumnCount();
-
- /**
- * getRowCount
- * @return int
- */
- public abstract int getRowCount();
-
-} // AbstractTableModel
+}
diff --git a/libjava/javax/swing/table/JTableHeader.java b/libjava/javax/swing/table/JTableHeader.java
index 7f1a600ca73..d747664cd12 100644
--- a/libjava/javax/swing/table/JTableHeader.java
+++ b/libjava/javax/swing/table/JTableHeader.java
@@ -60,7 +60,7 @@ import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener;
import javax.swing.plaf.TableHeaderUI;
-public class JTableHeader
+public class JTableHeader extends JComponent
{
protected class AccessibleJTableHeader
{
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 007aabc4008..3e8b11bbe8d 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -2051,7 +2051,7 @@ _Jv_GetJNIEnvNewFrame (jclass klass)
// This is `extern "C"' because the compiler uses it.
extern "C" void *
_Jv_LookupJNIMethod (jclass klass, _Jv_Utf8Const *name,
- _Jv_Utf8Const *signature, int args_size)
+ _Jv_Utf8Const *signature, MAYBE_UNUSED int args_size)
{
char buf[10 + 6 * (name->length + signature->length) + 12];
int long_start;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
index e16b2d457d6..7f5d44a2d7c 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
@@ -88,6 +88,25 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
}
JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel
+ (JNIEnv *env, jobject obj, jstring jtext)
+{
+ const char *text;
+ GtkWidget *label;
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, obj);
+ label = gtk_bin_get_child (GTK_BIN(ptr));
+ text = (*env)->GetStringUTFChars (env, jtext, NULL);
+
+ gdk_threads_enter ();
+ gtk_label_set_text (GTK_LABEL(label), text);
+ gdk_threads_leave ();
+
+ (*env)->ReleaseStringUTFChars (env, jtext, text);
+}
+
+JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index b244fd7d59d..62a97e255d0 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -575,6 +575,134 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_O
(*env)->ReleaseStringUTFChars (env, jname, name);
}
+gboolean
+filter_expose_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
+{
+ // Prevent the default event handler from getting this signal if applicable
+ // FIXME: I came up with these filters by looking for patterns in the unwanted
+ // expose events that are fed back to us from gtk/X. Perhaps there is
+ // a way to prevent them from occuring in the first place.
+ if (event->type == GDK_EXPOSE && (!GTK_IS_LAYOUT(widget)
+ || event->any.window != widget->window))
+ {
+ g_signal_stop_emission_by_name(GTK_OBJECT(widget), "event");
+ return FALSE;
+ }
+ else
+ {
+ // There may be non-expose events that are triggered while we're
+ // painting a heavyweight peer.
+ return pre_event_handler(widget, event, peer);
+ }
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter
+ (JNIEnv *env, jobject obj)
+{
+ void *ptr = NSA_GET_PTR (env, obj);
+ jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
+ g_assert (gref);
+ GtkObject *filterobj;
+ GtkWidget *vbox, *layout;
+ GList *children;
+
+ gdk_threads_enter ();
+
+ // GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
+ // Events go to the GtkLayout layer, so we filter them there.
+ if (GTK_IS_WINDOW(ptr))
+ {
+ children = gtk_container_get_children(GTK_CONTAINER(ptr));
+ vbox = children->data;
+ g_assert (GTK_IS_VBOX(vbox));
+
+ children = gtk_container_get_children(GTK_CONTAINER(vbox));
+ do
+ {
+ layout = children->data;
+ children = children->next;
+ }
+ while (!GTK_IS_LAYOUT (layout) && children != NULL);
+ g_assert (GTK_IS_LAYOUT(layout));
+
+ filterobj = GTK_OBJECT(layout);
+ }
+ else
+ {
+ filterobj = GTK_OBJECT(ptr);
+ }
+
+ g_signal_handlers_block_by_func (filterobj, *pre_event_handler, *gref);
+ g_signal_connect( filterobj, "event",
+ G_CALLBACK(filter_expose_event_handler), *gref);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter
+ (JNIEnv *env, jobject obj)
+{
+ void *ptr = NSA_GET_PTR (env, obj);
+ jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
+ g_assert (gref);
+ GtkObject *filterobj;
+ GtkWidget *vbox, *layout;
+ GList *children;
+
+ gdk_threads_enter ();
+
+ // GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
+ // Events go to the GtkLayout layer, so we filter them there.
+ if (GTK_IS_WINDOW(ptr))
+ {
+ children = gtk_container_get_children(GTK_CONTAINER(ptr));
+ vbox = children->data;
+ g_assert (GTK_IS_VBOX(vbox));
+
+ children = gtk_container_get_children(GTK_CONTAINER(vbox));
+ do
+ {
+ layout = children->data;
+ children = children->next;
+ }
+ while (!GTK_IS_LAYOUT (layout) && children != NULL);
+ g_assert (GTK_IS_LAYOUT(layout));
+
+ filterobj = GTK_OBJECT(layout);
+ }
+ else
+ {
+ filterobj = GTK_OBJECT(ptr);
+ }
+
+ g_signal_handlers_disconnect_by_func (filterobj,
+ *filter_expose_event_handler, *gref);
+ g_signal_handlers_unblock_by_func (filterobj, *pre_event_handler, *gref);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetQueueDrawArea
+ (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+ GdkRectangle rect;
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ rect.x = x + GTK_WIDGET(ptr)->allocation.x;
+ rect.y = y + GTK_WIDGET(ptr)->allocation.y;
+ rect.width = width;
+ rect.height = height;
+
+ gdk_threads_enter ();
+
+ gdk_window_invalidate_rect (GTK_WIDGET (ptr)->window, &rect, 0);
+ gdk_window_process_all_updates();
+
+ gdk_threads_leave ();
+}
+
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectJObject
(JNIEnv *env, jobject obj)
{
@@ -621,7 +749,7 @@ find_fg_color_widget (GtkWidget *widget)
{
GtkWidget *fg_color_widget;
- if (GTK_IS_EVENT_BOX (widget))
+ if (GTK_IS_EVENT_BOX (widget) || GTK_IS_BUTTON (widget))
fg_color_widget = gtk_bin_get_child (GTK_BIN(widget));
else
fg_color_widget = widget;
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
index 6004847c369..64b2995ffbc 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
@@ -1012,12 +1012,21 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
break;
case GDK_EXPOSE:
{
- (*gdk_env)->CallVoidMethod (gdk_env, peer,
- postExposeEventID,
- (jint)event->expose.area.x,
- (jint)event->expose.area.y,
- (jint)event->expose.area.width,
- (jint)event->expose.area.height);
+ // This filters out unwanted feedback expose events from gtk/X
+ // when we explictly invalidate and update heavyweight components,
+ // thus avoiding an infinite loop.
+ // FIXME: I'm not quite sure why we're getting these expose events.
+ // Maybe there is a way to avoid them?
+ if((event->any.window == widget->window && event->any.send_event)
+ || GTK_IS_LAYOUT(widget))
+ {
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postExposeEventID,
+ (jint)event->expose.area.x,
+ (jint)event->expose.area.y,
+ (jint)event->expose.area.width,
+ (jint)event->expose.area.height);
+ }
}
break;
case GDK_FOCUS_CHANGE:
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
index be7e2d0a4e2..c916b3fe128 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
@@ -40,72 +40,14 @@ exception statement from your version. */
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
#include "gnu_java_awt_peer_gtk_GtkScrollbarPeer.h"
-struct range_scrollbar
-{
- GtkRange *range;
- jobject *scrollbar;
-};
-
-static void
-post_change_event (GtkRange *range,
- struct range_scrollbar *rs)
-{
- GtkAdjustment *adj;
- adj = gtk_range_get_adjustment (range);
- (*gdk_env)->CallVoidMethod (gdk_env, *(rs->scrollbar), postAdjustmentEventID,
- AWT_ADJUSTMENT_TRACK, (jint) adj->value);
-
-}
-
-static void
-post_adjustment_event (GtkRange *range, GtkScrollType scroll,
- struct range_scrollbar *rs)
-{
- jint type;
- GtkAdjustment *adj;
-
- adj = gtk_range_get_adjustment (range);
-
- switch (scroll)
- {
- case GTK_SCROLL_STEP_UP:
- case GTK_SCROLL_STEP_RIGHT:
- case GTK_SCROLL_STEP_FORWARD:
- type = AWT_ADJUSTMENT_UNIT_INCREMENT;
- break;
- case GTK_SCROLL_STEP_DOWN:
- case GTK_SCROLL_STEP_LEFT:
- case GTK_SCROLL_STEP_BACKWARD:
- type = AWT_ADJUSTMENT_UNIT_DECREMENT;
- break;
- case GTK_SCROLL_PAGE_UP:
- case GTK_SCROLL_PAGE_RIGHT:
- case GTK_SCROLL_PAGE_FORWARD:
- type = AWT_ADJUSTMENT_BLOCK_INCREMENT;
- break;
- case GTK_SCROLL_PAGE_DOWN:
- case GTK_SCROLL_PAGE_LEFT:
- case GTK_SCROLL_PAGE_BACKWARD:
- type = AWT_ADJUSTMENT_BLOCK_DECREMENT;
- break;
- case GTK_SCROLL_JUMP:
- case GTK_SCROLL_NONE: /* Apparently generated when slider is dragged. */
- type = AWT_ADJUSTMENT_TRACK;
- break;
- default: /* Can this happen? If so, is this right? */
- return;
- }
-
- (*gdk_env)->CallVoidMethod (gdk_env, *(rs->scrollbar), postAdjustmentEventID,
- type, (jint) adj->value);
-}
+static void post_change_event (GtkRange *range, jobject peer);
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
(JNIEnv *env, jobject obj, jint orientation, jint value,
jint min, jint max, jint step_incr, jint page_incr, jint visible_amount)
{
- GtkWidget *sb;
+ GtkWidget *scrollbar;
GtkObject *adj;
/* Create global reference and save it for future use */
@@ -113,16 +55,26 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
gdk_threads_enter ();
- adj = gtk_adjustment_new (value, min, max,
- step_incr, page_incr,
- visible_amount);
-
- sb = (orientation) ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj)) :
+ adj = gtk_adjustment_new ((gdouble) value,
+ (gdouble) min,
+ (gdouble) max,
+ (gdouble) step_incr,
+ (gdouble) page_incr,
+ (gdouble) visible_amount);
+
+ scrollbar = (orientation) ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj)) :
gtk_hscrollbar_new (GTK_ADJUSTMENT (adj));
+ GTK_RANGE (scrollbar)->round_digits = 0;
+ /* These calls seem redundant but they are not. They clamp values
+ so that the slider's entirety is always between the two
+ steppers. */
+ gtk_range_set_range (GTK_RANGE (scrollbar), (gdouble) min, (gdouble) max);
+ gtk_range_set_value (GTK_RANGE (scrollbar), (gdouble) value);
+
gdk_threads_leave ();
- NSA_SET_PTR (env, obj, sb);
+ NSA_SET_PTR (env, obj, scrollbar);
}
JNIEXPORT void JNICALL
@@ -137,7 +89,7 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectJObject
gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_SCROLLBAR (ptr)->range);
+ connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
gdk_threads_leave ();
}
@@ -146,27 +98,14 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectSignals
(JNIEnv *env, jobject obj)
{
- struct range_scrollbar *rs;
void *ptr = NSA_GET_PTR (env, obj);
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
g_assert (gref);
- rs = (struct range_scrollbar *) malloc (sizeof (struct range_scrollbar));
-
gdk_threads_enter ();
- gtk_widget_realize (GTK_WIDGET (ptr));
-
- rs->range = GTK_RANGE (ptr);
- rs->scrollbar = gref;
-
- g_signal_connect (G_OBJECT (GTK_RANGE (ptr)),
- "move-slider",
- GTK_SIGNAL_FUNC (post_adjustment_event), rs);
-
- g_signal_connect (G_OBJECT (GTK_RANGE (ptr)),
- "value-changed",
- GTK_SIGNAL_FUNC (post_change_event), rs);
+ g_signal_connect (G_OBJECT (ptr), "value-changed",
+ G_CALLBACK (post_change_event), *gref);
gdk_threads_leave ();
@@ -186,8 +125,8 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement
gdk_threads_enter ();
- adj = GTK_RANGE (ptr)->adjustment;
- adj->step_increment = amount;
+ adj = gtk_range_get_adjustment (GTK_RANGE (ptr));
+ adj->step_increment = (gdouble) amount;
gtk_adjustment_changed (adj);
gdk_threads_leave ();
@@ -204,8 +143,8 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement
gdk_threads_enter ();
- adj = GTK_RANGE (ptr)->adjustment;
- adj->page_increment = amount;
+ adj = gtk_range_get_adjustment (GTK_RANGE (ptr));
+ adj->page_increment = (gdouble) amount;
gtk_adjustment_changed (adj);
gdk_threads_leave ();
@@ -222,12 +161,22 @@ Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues
gdk_threads_enter ();
- adj = GTK_RANGE (ptr)->adjustment;
- adj->value = value;
- adj->page_size = visible;
- adj->lower = min;
- adj->upper = max;
+ adj = gtk_range_get_adjustment (GTK_RANGE (ptr));
+ adj->page_size = (gdouble) visible;
+
+ gtk_range_set_range (GTK_RANGE (ptr), (gdouble) min, (gdouble) max);
+ gtk_range_set_value (GTK_RANGE (ptr), (gdouble) value);
+
gtk_adjustment_changed (adj);
gdk_threads_leave ();
}
+
+static void
+post_change_event (GtkRange *range, jobject peer)
+{
+ GtkAdjustment *adj;
+ adj = gtk_range_get_adjustment (range);
+ (*gdk_env)->CallVoidMethod (gdk_env, peer, postAdjustmentEventID,
+ AWT_ADJUSTMENT_TRACK, (jint) adj->value);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 610fc142f85..da1550fa8c7 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -376,18 +376,37 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
- (JNIEnv *env, jobject obj, jobject menubar)
+ (JNIEnv *env, jobject obj)
{
void *wptr;
GtkWidget *box;
GtkWidget *mptr;
+ GList* children;
wptr = NSA_GET_PTR (env, obj);
- mptr = NSA_GET_PTR (env, menubar);
gdk_threads_enter ();
box = GTK_BIN (wptr)->child;
+
+ children = gtk_container_get_children (GTK_CONTAINER (box));
+
+ while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
+ {
+ children = children->next;
+ }
+
+ /* If there isn't a MenuBar in this Frame's list of children
+ then we can just return. */
+ if (!GTK_IS_MENU_SHELL (children->data))
+ return;
+ else
+ mptr = children->data;
+
+ /* This will actually destroy the MenuBar. By removing it from
+ its parent, the reference count for the MenuBar widget will
+ decrement to 0. The widget will be automatically destroyed
+ by Gtk. */
gtk_container_remove (GTK_CONTAINER (box), GTK_WIDGET (mptr));
gdk_threads_leave();
@@ -433,6 +452,77 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
return height;
}
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_moveLayout
+ (JNIEnv *env, jobject obj, jint offset)
+{
+ void* ptr;
+ GList* children;
+ GtkBox* vbox;
+ GtkLayout* layout;
+ GtkWidget* widget;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ children = gtk_container_get_children (GTK_CONTAINER (ptr));
+ vbox = children->data;
+ g_assert (GTK_IS_VBOX (vbox));
+
+ children = gtk_container_get_children (GTK_CONTAINER (vbox));
+ do
+ {
+ layout = children->data;
+ children = children->next;
+ }
+ while (!GTK_IS_LAYOUT (layout) && children != NULL);
+ g_assert (GTK_IS_LAYOUT (layout));
+ children = gtk_container_get_children (GTK_CONTAINER (layout));
+
+ while (children != NULL)
+ {
+ widget = children->data;
+ gtk_layout_move (layout, widget, widget->allocation.x,
+ widget->allocation.y+offset);
+ children = children->next;
+ }
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkLayoutSetVisible
+ (JNIEnv *env, jobject obj, jboolean vis)
+{
+ void* ptr;
+ GList* children;
+ GtkBox* vbox;
+ GtkLayout* layout;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ children = gtk_container_get_children (GTK_CONTAINER (ptr));
+ vbox = children->data;
+ g_assert (GTK_IS_VBOX (vbox));
+
+ children = gtk_container_get_children (GTK_CONTAINER (vbox));
+ do
+ {
+ layout = children->data;
+ children = children->next;
+ }
+ while (!GTK_IS_LAYOUT (layout) && children != NULL);
+ g_assert (GTK_IS_LAYOUT (layout));
+
+ if (vis)
+ gtk_widget_show (GTK_WIDGET (layout));
+ else
+ gtk_widget_hide (GTK_WIDGET (layout));
+ gdk_threads_leave ();
+}
static void
window_get_frame_extents (GtkWidget *window,
int *top, int *left, int *bottom, int *right)
diff --git a/libjava/libart.m4 b/libjava/libart.m4
deleted file mode 100644
index 48d86651636..00000000000
--- a/libjava/libart.m4
+++ /dev/null
@@ -1,168 +0,0 @@
-# Configure paths for LIBART
-# Raph Levien 98-11-18
-# stolen from Manish Singh 98-9-30
-# stolen back from Frank Belew
-# stolen from Manish Singh
-# Shamelessly stolen from Owen Taylor
-
-dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
-dnl
-AC_DEFUN(AM_PATH_LIBART,
-[dnl
-dnl Get the cflags and libraries from the libart-config script
-dnl
-AC_ARG_WITH(libart-prefix,[ --with-libart-prefix=PFX Prefix where LIBART is installed (optional)],
- libart_prefix="$withval", libart_prefix="")
-AC_ARG_WITH(libart-exec-prefix,[ --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
- libart_exec_prefix="$withval", libart_exec_prefix="")
-AC_ARG_ENABLE(libarttest, [ --disable-libarttest Do not try to compile and run a test LIBART program],
- , enable_libarttest=yes)
-
- if test x$libart_exec_prefix != x ; then
- libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
- if test x${LIBART_CONFIG+set} != xset ; then
- LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
- fi
- fi
- if test x$libart_prefix != x ; then
- libart_args="$libart_args --prefix=$libart_prefix"
- if test x${LIBART_CONFIG+set} != xset ; then
- LIBART_CONFIG=$libart_prefix/bin/libart-config
- fi
- fi
-
- AC_PATH_PROG(LIBART_CONFIG, libart2-config, no)
- if test "$LIBART_CONFIG" = "no" ; then
- AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
- fi
- min_libart_version=ifelse([$1], ,0.2.5,$1)
- AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
- no_libart=""
- if test "$LIBART_CONFIG" = "no" ; then
- no_libart=yes
- else
- LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
- LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
-
- libart_major_version=`$LIBART_CONFIG $libart_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x$enable_libarttest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $LIBART_CFLAGS"
- LIBS="$LIBS $LIBART_LIBS"
-dnl
-dnl Now check if the installed LIBART is sufficiently new. (Also sanity
-dnl checks the results of libart-config to some extent
-dnl
- rm -f conf.libarttest
- AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libart_lgpl/libart.h>
-
-char*
-my_strdup (char *str)
-{
- char *new_str;
-
- if (str)
- {
- new_str = malloc ((strlen (str) + 1) * sizeof(char));
- strcpy (new_str, str);
- }
- else
- new_str = NULL;
-
- return new_str;
-}
-
-int main ()
-{
- int major, minor, micro;
- char *tmp_version;
-
- system ("touch conf.libarttest");
-
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = my_strdup("$min_libart_version");
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_libart_version");
- exit(1);
- }
-
- if (($libart_major_version > major) ||
- (($libart_major_version == major) && ($libart_minor_version > minor)) ||
- (($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
- {
- return 0;
- }
- else
- {
- printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
- printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
- printf("*** best to upgrade to the required version.\n");
- printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
- printf("*** to point to the correct copy of libart-config, and remove the file\n");
- printf("*** config.cache before re-running configure\n");
- return 1;
- }
-}
-
-],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_libart" = x ; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT(no)
- if test "$LIBART_CONFIG" = "no" ; then
- echo "*** The libart-config script installed by LIBART could not be found"
- echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the LIBART_CONFIG environment variable to the"
- echo "*** full path to libart-config."
- else
- if test -f conf.libarttest ; then
- :
- else
- echo "*** Could not run LIBART test program, checking why..."
- CFLAGS="$CFLAGS $LIBART_CFLAGS"
- LIBS="$LIBS $LIBART_LIBS"
- AC_TRY_LINK([
-#include <stdio.h>
-#include <libart_lgpl/libart.h>
-], [ return 0; ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding LIBART or finding the wrong"
- echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
- echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
- echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- LIBART_CFLAGS=""
- LIBART_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(LIBART_CFLAGS)
- AC_SUBST(LIBART_LIBS)
- rm -f conf.libarttest
-])
diff --git a/libjava/verify.cc b/libjava/verify.cc
index 8c037ed6381..236bc4dcebf 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -40,7 +40,7 @@ static void debug_print (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
static inline void
-debug_print (const char *fmt, ...)
+debug_print (MAYBE_UNUSED const char *fmt, ...)
{
#ifdef VERIFY_DEBUG
va_list ap;