diff options
author | Diego Novillo <dnovillo@redhat.com> | 2003-10-28 15:01:42 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@redhat.com> | 2003-10-28 15:01:42 +0000 |
commit | 24bf4c1d916fa273088284f258db01e29f94c350 (patch) | |
tree | 91a4e1dbdedca3bdb0a6b828162323fd33b00276 /libjava | |
parent | eaeec5c6587b40452ef09945b8166a8c95919e51 (diff) |
Mainline merge as of 2003-10-26.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@73009 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
70 files changed, 3003 insertions, 1103 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d751c102c11..d4c19813d11 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,287 @@ +2003-10-26 Bryce McKinlay <bryce@mckinlay.net.nz> + + * java/lang/reflect/AccessibleObject.java (secureSetAccessible): + Don't check for AccessibleObject. Update javadocs. + + * java/util/TreeMap.java: Doc fixes. HashMap -> TreeMap. + +2003-10-26 Bryce McKinlay <bryce@mckinlay.net.nz> + + * java/lang/reflect/Constructor.java (toString): Avoid extra + whitespace on constructor with no modifiers. + * java/lang/reflect/natConstructor.java (newInstance): Look up + caller and perform accessibility check only if constructor is + non-public and accessible flag is not set. + +2003-10-26 Bryce McKinlay <bryce@mckinlay.net.nz> + + * jni.cc (_Jv_JNI_CallAnyMethodV, _Jv_JNI_CallAnyMethodA, + _Jv_JNI_CallAnyVoidMethodV, _Jv_JNI_CallAnyVoidMethodA): Don't + use _Jv_LookupDeclaredMethod(). Call _Jv_CallAnyMethodA with + is_virtual_call argument. + * include/jvm.h (_Jv_isVirtualMethod): Moved and renamed from + natClass.cc. + * java/lang/natClass.cc (_Jv_LayoutVTableMethods): Use + _Jv_isVirtualMethod. + * java/lang/reflect/natMethod.cc (invoke): Don't use + _Jv_LookupDeclaredMethod. + (_Jv_CallAnyMethodA): New is_virtual_call argument. If specified, + look up method in target object's vtable. + +2003-10-25 Graydon Hoare <graydon@redhat.com> + + * gnu/java/awt/ClasspathToolkit.java: New abstract class. + * gnu/java/awt/peer/ClasspathFontPeer.java: New abstract class. + * gnu/java/awt/peer/gtk/GdkClasspathFontPeer.java, + jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.c: + New concrete implementation of ClasspathFontPeer, with native part. + * gnu/java/awt/peer/gtk/GdkGlyphVector.java, + jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c: + New class, with native part. + * gnu/java/awt/peer/gtk/GdkGraphics2D.java, + jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c: + implement setFont, cairoSetFont, drawGlyphVector, cairoShowGlyphs. + +2003-10-25 Bryce McKinlay <bryce@mckinlay.net.nz> + + * java/lang/reflect/Method.java (toString): Avoid extra whitespace + on method with no modifiers. + +2003-10-25 Bryce McKinlay <bryce@mckinlay.net.nz> + + PR libgcj/11780: + * java/lang/reflect/natMethod.cc (invoke): Look up caller and perform + accessibility check only if target is non-public and accessible flag + is not set. + * java/lang/reflect/natField.cc (getAddr): Likewise. + +2003-10-24 Thomas Fitzsimmons <fitzsim@redhat.com> + + * gnu/java/awt/peer/gtk/GtkDialogPeer.java (handleEvent): + Remove method. + * gnu/java/awt/peer/gtk/GtkWindowPeer.java (postWindowEvent): + New method. + * java/awt/Window.java (Window(Window,GraphicsConfiguration), + show, hide, dispose, getOwnedWindows): Synchronize on tree lock. + (dispose): Post WINDOW_CLOSED event. + (addWindowFocusListener, addWindowStateListener): Assign result + of multicaster add back to window listener. + (removeWindowFocusListener, removeWindowStateListener): Assign + result of multicaster remove back to window listener. + (dispatchEventImpl): Add null checks for focus and state + listeners. + (processWindowEvent): Handle case where windowListener is null + but state or focus listeners exist. + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c: Add JNI + glue for postWindowEvent. + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c + (window_delete_cb, window_destroy_cb, window_show_cb, + window_focus_in_cb, window_focus_out_cb, window_window_state_cb, + window_get_new_state): New functions. + * jni/gtk-peer/gtkpeer.h: Define window event and frame state + macros. Declare postWindowEventID. + +2003-10-24 Anthony Green <green@redhat.com> + + * java/lang/natClass.cc (_Jv_LinkSymbolTable): Fix case where + we have no interpreter. + +2003-10-22 Andrew Haley <aph@redhat.com> + + * java/lang/natClass.cc (initializeClass): Call + _Jv_linkExceptionClassTable. + (_Jv_LinkSymbolTable): Call )_Jv_ThrowNoSuchMethodError. Call + _Jv_Defer_Resolution on a method whose ncode is NULL. + (_Jv_linkExceptionClassTable): New function. + (_Jv_LayoutVTableMethods): If superclass looks like a constant pool + entry, look it up. + * java/lang/Class.h (struct _Jv_CatchClass): New. + (_Jv_linkExceptionClassTable): New friend. + (_Jv_Defer_Resolution): New friend. + (class Class.catch_classes): New field. + * include/java-interp.h (Jv_Defer_Resolution): New method. + (_Jv_PrepareClass): Make a friend of _Jv_MethodBase. + (_Jv_MethodBase.deferred): New field. + (_Jv_Defer_Resolution): New function. + * resolve.cc (_Jv_PrepareClass): Resolve deferred handlers. + * exception.cc (get_ttype_entry): Change return type to void**. + (PERSONALITY_FUNCTION): Remove all code related to using a + Utf8Const* for a match type. Change match type to be a pointer to + a pointer, rather than a pointer to a Class. + * defineclass.cc (handleCodeAttribute): Initialize + method->deferred. + (handleMethodsEnd): Likewise. + +2003-10-23 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> + + * java/lang/natObject.cc (_Jv_ObjectCheckMonitor): Use + _Jv_MutexCheckMonitor instead of accessing mutex.owner directly. + +2003-10-22 Tom Tromey <tromey@redhat.com> + + PR libgcj/12416: + * java/lang/Class.h: Updated. + * java/lang/natClass.cc (_getFields): Removed. + (getFields): Likewise. + (getDeclaredFields): Added `public_only' parameter. + * java/lang/Class.java (getFields): Now implemented in java; from + Classpath. + (getDeclaredFields): Likewise. + (getDeclaredFields(boolean)): Declare. + (_getFields): Removed. + (internalGetFields): New method, from Classpath. + + PR libgcj/12656: + * gnu/gcj/runtime/natFirstThread.cc (call_main): Use + _Jv_LookupDeclaredMethod, not _Jv_GetMethodLocal. + +2003-10-22 David Daney <ddaney@avtrex.com) + + * include/mips-signal.h: New file. + * sysdep/dwarf2-backtrace.cc: New file. + * sysdep/mips: New directory. + * sysdep/mips/locks.h: New file. + * Makefile.am(extra_cc_files): New, to allow extra c++ files to be + added to libgcj. + (extra_cc_source_files): Ditto. + * configure.host(disable_dladdr): New shell variable passed to + configure. + (mips*-*-linux*): sysdeps_dir=mips, + can_unwind_signal=yes, disable_dladdr=yes, use -mxgot. + (mipsel*-linux* | mipsisa32el*-linux*): Enable hash synchronization. + * configure.in:(mips*-*-linux*): Use sysdep/dwarf2-backtrace.cc to + generate backtrace, and include/mips-signal.h as SIGNAL_HANDLER + (HAVE_DLADDR): Make it depend on setting of disable_dladdr. + (EXTRA_CC_FILES): New, to support conditional addition of + sysdep/dwarf2-backtrace.cc. + * configure: Regenerated. + * Makefile.in: Regenerated. + * gcj/Makefile.in: Regenerated. + * include/config.h.in: Regenerated. + * include/Makefile.in: Regenerated. + * testsuite/Makefile.in: Regenerated. + +2003-10-22 Sascha Brawer <brawer@dandelis.ch> + + * java/awt/geom/QuadCurve2D.java (subdivide): Added documentation. + java/awt/geom/doc-files/QuadCurve2D-3.png: New illustration. + +2003-10-22 Sascha Brawer <brawer@dandelis.ch> + + * java/awt/geom/QuadCurve2D.java: Reformatted, wrote Javadoc. + * java/awt/geom/doc-files: New directory. + * java/awt/geom/doc-files/QuadCurve2D-1.png, + java/awt/geom/doc-files/QuadCurve2D-2.png: New illustrations. + +2003-10-22 Sascha Brawer <brawer@dandelis.ch> + + * java/awt/geom/QuadCurve2D.java (subdivide): Implement. + +2003-10-22 Sascha Brawer <brawer@dandelis.ch> + + * java/awt/geom/QuadCurve2D.java (getFlatness, getFlatnessSq): Implement. + +2003-10-22 Michael Koch <konqueror@gmx.de> + + * java/io/File.java + (equals): Removed redundant obj == null check. + (createTempFile): Merged comments from classpath. + +2003-10-21 Sascha Brawer <brawer@dandelis.ch> + + Fix for bug #2944, reported by David Holmes <dholmes@dltech.com.au> + * java/util/logging/ErrorManager.java (everUsed): Made volatile. + (error): Synchronize on instance, not class. + +2003-10-21 Mark Wielaard <mark@klomp.org> + + Reported by M.Negovanovic + * java/beans/Introspector.java (getBeanInfo(ClassLoader, String)): New + method. + (reallyFindExplicitBeanInfo): Use new getBeanInfo() method. + +2003-10-21 Sascha Brawer <brawer@dandelis.ch> + + Fix for Classpath bug #6076. + * java/awt/geom/GeneralPath.java (append): Re-written. + +2003-10-21 Sascha Brawer <brawer@dandelis.ch> + + Fix for Classpath bug #6089. + * java/awt/geom/GeneralPath.java (curveTo): Set correct segment type. + (getPathIterator, GeneralPathIterator): Re-written from scratch. + +2003-10-21 Sascha Brawer <brawer@dandelis.ch> + + * java/awt/geom/GeneralPath.java (getCurrentPoint): Return last + point, not start of subpath. Fixes Classpath bug #6075. + +2003-10-21 Michael Koch <konqueror@gmx.de> + + * java/nio/ByteOrder.java, + java/nio/DirectByteBufferImpl.java, + java/nio/channels/FileChannelImpl.java: + Add code to load library with code for native methods if needed. + +2003-10-21 Michael Koch <konqueror@gmx.de> + + * gnu/java/net/PlainDatagramSocketImpl.java, + gnu/java/net/PlainSocketImpl.java, + gnu/java/net/natPlainDatagramSocketImplPosix.cc, + gnu/java/net/natPlainDatagramSocketImplWin32.cc, + gnu/java/net/natPlainSocketImplPosix.cc, + gnu/java/net/natPlainSocketImplWin32.cc: + Renamed fnum to native_fd to match classpath more. + +2003-10-21 Jerry Quinn <jlquinn@optonline.net> + + * posix-threads.cc (_Jv_CondNotify,_Jv_CondNotifyAll): Rename + _Jv_PthreadCheckMonitor to _Jv_MutexCheckMonitor. + * include/no-threads.h (_Jv_MutexCheckMonitor): New. + * include/posix-threads.h (_Jv_MutexCheckMonitor): Rename from + _Jv_PthreadCheckMonitor. Simplify code. + (_Jv_MutexUnlock): Use _Jv_MutexCheckMonitor. + * include/win32-threads.h (_Jv_MutexCheckMonitor): New. + * java/lang/Object.h (_Jv_ObjectCheckMonitor): Declare. + * java/lang/Thread.java (holdsLock): New. + * java/lang/natObject.cc (_Jv_ObjectCheckMonitor): New, with and + without JV_HASH_SYNCHRONIZATION. + * java/lang/natThread.cc (java::lang::Thread::holdsLock): New. + +2003-10-20 Michael Koch <konqueror@gmx.de> + + * java/text/RuleBasedCollator.java + (RuleBasedCollator): Check rules not empty, fixed search in already + existing collation elements. + (is_special): Removed common whitespace characters. + (text_argument): Dont return on whitespaces, add characters between + two ' to string buffer. + +2003-10-18 Michael Koch <konqueror@gmx.de> + + * gnu/java/net/protocol/file/Connection.java, + gnu/java/net/protocol/file/Handler.java, + gnu/java/net/protocol/http/Connection.java, + gnu/java/net/protocol/http/Handler.java, + gnu/java/net/protocol/jar/Connection.java, + gnu/java/net/protocol/jar/Handler.java: + Merged copyright text from classpath to make + it possible to merge the classes. + +2003-10-18 Mark Wielaard <mark@klomp.org> + + Reported by M.Negovanovic + * java/beans/IndexedPropertyDescriptor.java + (IndexedPropertyDescriptor): this.setIndex = setIndex, not getIndex. + +2003-10-17 Mohan Embar <gnustuff@thisiscool.com> + + * win32.cc (_Jv_pipe): Implemented. + * gnu/java/nio/natPipeImpl.cc (nativeInit): Use + _Jv_pipe instead of ::pipe. + * include/posix.h (_Jv_pipe): New inline. + * include/win32.h (_Jv_pipe): New declaration. + 2003-10-17 Ralph Loader <rcl@ihug.co.nz> * java/lang/StringBuffer.java (getChars): Fix array index checks. diff --git a/libjava/Makefile.am b/libjava/Makefile.am index bc4ea9a7130..91d1647ff9e 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -138,6 +138,7 @@ nat_files = $(nat_source_files:.cc=.lo) x_nat_files = $(x_nat_source_files:.cc=.lo) ## Objects from C sources in subdirs. c_files = $(c_source_files:.c=.lo) +extra_cc_files = $(extra_cc_source_files:.cc=.lo) ## Objects from gtk-related C sources in subdirs. gtk_c_files = $(gtk_c_source_files:.c=.lo) ## Objects from Java sources in subdirs. @@ -149,13 +150,13 @@ libgcj_la_SOURCES = prims.cc jni.cc exception.cc \ resolve.cc defineclass.cc interpret.cc verify.cc \ $(nat_source_files) EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc \ - win32-threads.cc posix.cc win32.cc \ - $(c_source_files) $(java_source_files) $(built_java_source_files) + win32-threads.cc posix.cc win32.cc $(c_source_files) \ + $(extra_cc_source_files) $(java_source_files) $(built_java_source_files) libgcj_la_DEPENDENCIES = libgcj-@gcc_version@.jar $(javao_files) \ - $(c_files) $(GCOBJS) $(THREADOBJS) $(PLATFORMOBJS) $(LIBLTDL) \ - $(LIBFFI) $(ZLIBS) $(GCLIBS) + $(c_files) $(extra_cc_files) $(GCOBJS) $(THREADOBJS) \ + $(PLATFORMOBJS) $(LIBLTDL) $(LIBFFI) $(ZLIBS) $(GCLIBS) -libgcj_la_LIBADD = $(javao_files) $(c_files) $(GCOBJS) \ +libgcj_la_LIBADD = $(javao_files) $(c_files) $(extra_cc_files) $(GCOBJS) \ $(THREADOBJS) $(PLATFORMOBJS) # Include THREADLIBS here to ensure that the correct version of # certain linuxthread functions get linked: @@ -418,6 +419,9 @@ $(nat_files) $(x_nat_files): %.lo: %.cc $(c_files): %.lo: %.c $(LTCOMPILE) -c -o $@ $< +$(extra_cc_files): %.lo: %.cc + $(LTCXXCOMPILE) -c -o $@ $< + $(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h ## FIXME: see above @@ -2632,6 +2636,8 @@ c_source_files = \ java/lang/e_sqrt.c java/lang/s_scalbn.c java/lang/sf_rint.c \ java/lang/k_cos.c java/lang/s_sin.c java/lang/sf_fabs.c +extra_cc_source_files = $(EXTRA_CC_FILES) + #java/awt/natToolkit.cc ## This lists all the C++ source files in subdirectories. diff --git a/libjava/Makefile.in b/libjava/Makefile.in index 7a80131862d..d730fd9c0c6 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -76,6 +76,7 @@ DIVIDESPEC = @DIVIDESPEC@ DLLTOOL = @DLLTOOL@ EXCEPTIONSPEC = @EXCEPTIONSPEC@ EXEEXT = @EXEEXT@ +EXTRA_CC_FILES = @EXTRA_CC_FILES@ GCDEPS = @GCDEPS@ GCINCS = @GCINCS@ GCJ = @GCJ@ @@ -226,6 +227,7 @@ INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \ nat_files = $(nat_source_files:.cc=.lo) x_nat_files = $(x_nat_source_files:.cc=.lo) c_files = $(c_source_files:.c=.lo) +extra_cc_files = $(extra_cc_source_files:.cc=.lo) gtk_c_files = $(gtk_c_source_files:.c=.lo) javao_files = $(java_source_files:.java=.lo) \ $(built_java_source_files:.java=.lo) @@ -237,15 +239,15 @@ libgcj_la_SOURCES = prims.cc jni.cc exception.cc \ $(nat_source_files) EXTRA_libgcj_la_SOURCES = boehm.cc nogc.cc posix-threads.cc no-threads.cc \ - win32-threads.cc posix.cc win32.cc \ - $(c_source_files) $(java_source_files) $(built_java_source_files) + win32-threads.cc posix.cc win32.cc $(c_source_files) \ + $(extra_cc_source_files) $(java_source_files) $(built_java_source_files) libgcj_la_DEPENDENCIES = libgcj-@gcc_version@.jar $(javao_files) \ - $(c_files) $(GCOBJS) $(THREADOBJS) $(PLATFORMOBJS) $(LIBLTDL) \ - $(LIBFFI) $(ZLIBS) $(GCLIBS) + $(c_files) $(extra_cc_files) $(GCOBJS) $(THREADOBJS) \ + $(PLATFORMOBJS) $(LIBLTDL) $(LIBFFI) $(ZLIBS) $(GCLIBS) -libgcj_la_LIBADD = $(javao_files) $(c_files) $(GCOBJS) \ +libgcj_la_LIBADD = $(javao_files) $(c_files) $(extra_cc_files) $(GCOBJS) \ $(THREADOBJS) $(PLATFORMOBJS) # Include THREADLIBS here to ensure that the correct version of @@ -2351,6 +2353,8 @@ c_source_files = \ java/lang/k_cos.c java/lang/s_sin.c java/lang/sf_fabs.c +extra_cc_source_files = $(EXTRA_CC_FILES) + #java/awt/natToolkit.cc nat_source_files = \ @@ -2722,14 +2726,13 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ DATA = $(jar_DATA) $(pkgconfig_DATA) $(toolexecmainlib_DATA) DIST_COMMON = README COPYING ChangeLog Makefile.am Makefile.in NEWS \ -THANKS acinclude.m4 aclocal.m4 config.guess config.sub configure \ -configure.in install-sh libgcj-test.spec.in libgcj.pc.in libgcj.spec.in \ -ltmain.sh missing mkinstalldirs +THANKS acinclude.m4 aclocal.m4 configure configure.in \ +libgcj-test.spec.in libgcj.pc.in libgcj.spec.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best DIST_SUBDIRS = @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ @@ -4956,6 +4959,9 @@ $(nat_files) $(x_nat_files): %.lo: %.cc $(c_files): %.lo: %.c $(LTCOMPILE) -c -o $@ $< +$(extra_cc_files): %.lo: %.cc + $(LTCXXCOMPILE) -c -o $@ $< + $(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h $(gtk_c_files): %.lo: %.c diff --git a/libjava/configure b/libjava/configure index 01e259f6100..a749310edbe 100755 --- a/libjava/configure +++ b/libjava/configure @@ -2966,6 +2966,9 @@ if test "${with_ecos+set}" = set; then fi +EXTRA_CC_FILES= + + PLATFORMOBJS= case "$TARGET_ECOS" in no) case "$host" in @@ -2976,7 +2979,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:2980: checking whether 'ld' is at least 2.13" >&5 +echo "configure:2983: 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` @@ -3022,7 +3025,7 @@ esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:3026: checking how to run the C preprocessor" >&5 +echo "configure:3029: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -3037,13 +3040,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 3041 "configure" +#line 3044 "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:3047: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3050: \"$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 : @@ -3054,13 +3057,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 3058 "configure" +#line 3061 "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:3064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3067: \"$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 : @@ -3071,13 +3074,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 3075 "configure" +#line 3078 "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:3081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3084: \"$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 : @@ -3102,7 +3105,7 @@ fi echo "$ac_t""$CPP" 1>&6 cat > conftest.$ac_ext <<EOF -#line 3106 "configure" +#line 3109 "configure" #include "confdefs.h" #include <stdint.h> EOF @@ -3117,7 +3120,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3121 "configure" +#line 3124 "configure" #include "confdefs.h" #include <inttypes.h> EOF @@ -3132,7 +3135,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3136 "configure" +#line 3139 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -3147,7 +3150,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3151 "configure" +#line 3154 "configure" #include "confdefs.h" #include <sys/config.h> EOF @@ -3164,7 +3167,7 @@ rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3168 "configure" +#line 3171 "configure" #include "confdefs.h" #include <time.h> EOF @@ -3179,7 +3182,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3183 "configure" +#line 3186 "configure" #include "confdefs.h" #include <time.h> EOF @@ -3242,7 +3245,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:3246: checking for X" >&5 +echo "configure:3249: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -3304,12 +3307,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 3308 "configure" +#line 3311 "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:3313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3316: \"$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* @@ -3378,14 +3381,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 3382 "configure" +#line 3385 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:3389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3392: \"$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. @@ -3491,17 +3494,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:3495: checking whether -R must be followed by a space" >&5 +echo "configure:3498: 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 3498 "configure" +#line 3501 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:3505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -3517,14 +3520,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <<EOF -#line 3521 "configure" +#line 3524 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:3528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -3556,7 +3559,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:3560: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:3563: 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 @@ -3564,7 +3567,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <<EOF -#line 3568 "configure" +#line 3571 "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 @@ -3575,7 +3578,7 @@ int main() { dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:3579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3582: \"$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 @@ -3597,7 +3600,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:3601: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:3604: 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 @@ -3605,7 +3608,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <<EOF -#line 3609 "configure" +#line 3612 "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 @@ -3616,7 +3619,7 @@ int main() { dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:3620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3623: \"$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 @@ -3645,12 +3648,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:3649: checking for gethostbyname" >&5 +echo "configure:3652: 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 3654 "configure" +#line 3657 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -3673,7 +3676,7 @@ gethostbyname(); ; return 0; } EOF -if { (eval echo configure:3677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3680: \"$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 @@ -3694,7 +3697,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3698: checking for gethostbyname in -lnsl" >&5 +echo "configure:3701: 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 @@ -3702,7 +3705,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3706 "configure" +#line 3709 "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 @@ -3713,7 +3716,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:3717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3720: \"$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 @@ -3743,12 +3746,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:3747: checking for connect" >&5 +echo "configure:3750: 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 3752 "configure" +#line 3755 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -3771,7 +3774,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:3775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3778: \"$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 @@ -3792,7 +3795,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3796: checking for connect in -lsocket" >&5 +echo "configure:3799: 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 @@ -3800,7 +3803,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 3804 "configure" +#line 3807 "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 @@ -3811,7 +3814,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:3815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3818: \"$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 @@ -3835,12 +3838,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:3839: checking for remove" >&5 +echo "configure:3842: 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 3844 "configure" +#line 3847 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove(); below. */ @@ -3863,7 +3866,7 @@ remove(); ; return 0; } EOF -if { (eval echo configure:3867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3870: \"$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 @@ -3884,7 +3887,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:3888: checking for remove in -lposix" >&5 +echo "configure:3891: 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 @@ -3892,7 +3895,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 3896 "configure" +#line 3899 "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 @@ -3903,7 +3906,7 @@ int main() { remove() ; return 0; } EOF -if { (eval echo configure:3907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3910: \"$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 @@ -3927,12 +3930,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:3931: checking for shmat" >&5 +echo "configure:3934: 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 3936 "configure" +#line 3939 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat(); below. */ @@ -3955,7 +3958,7 @@ shmat(); ; return 0; } EOF -if { (eval echo configure:3959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -3976,7 +3979,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:3980: checking for shmat in -lipc" >&5 +echo "configure:3983: 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 @@ -3984,7 +3987,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <<EOF -#line 3988 "configure" +#line 3991 "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 @@ -3995,7 +3998,7 @@ int main() { shmat() ; return 0; } EOF -if { (eval echo configure:3999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4002: \"$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 @@ -4028,7 +4031,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:4032: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4035: 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 @@ -4036,7 +4039,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4040 "configure" +#line 4043 "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 @@ -4047,7 +4050,7 @@ int main() { IceConnectionNumber() ; return 0; } EOF -if { (eval echo configure:4051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4054: \"$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 @@ -4145,7 +4148,7 @@ fi libsubdir=.libs echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6 -echo "configure:4149: checking for garbage collector to use" >&5 +echo "configure:4152: 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" @@ -4197,7 +4200,7 @@ esac echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6 -echo "configure:4201: checking for thread model used by GCC" >&5 +echo "configure:4204: 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 @@ -4408,12 +4411,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:4412: checking for $ac_func" >&5 +echo "configure:4415: 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 4417 "configure" +#line 4420 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4436,7 +4439,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4443: \"$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 @@ -4463,12 +4466,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:4467: checking for $ac_func" >&5 +echo "configure:4470: 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 4472 "configure" +#line 4475 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4491,7 +4494,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4498: \"$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 @@ -4518,12 +4521,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:4522: checking for $ac_func" >&5 +echo "configure:4525: 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 4527 "configure" +#line 4530 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4546,7 +4549,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4553: \"$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 @@ -4573,12 +4576,12 @@ done for ac_func in nl_langinfo setlocale do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4577: checking for $ac_func" >&5 +echo "configure:4580: 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 4582 "configure" +#line 4585 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4601,7 +4604,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4608: \"$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 @@ -4628,12 +4631,12 @@ done for ac_func in inet_aton inet_addr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4632: checking for $ac_func" >&5 +echo "configure:4635: 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 4637 "configure" +#line 4640 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4656,7 +4659,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4663: \"$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 @@ -4683,12 +4686,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:4687: checking for $ac_func" >&5 +echo "configure:4690: 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 4692 "configure" +#line 4695 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4711,7 +4714,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4718: \"$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 @@ -4738,12 +4741,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:4742: checking for $ac_func" >&5 +echo "configure:4745: 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 4747 "configure" +#line 4750 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4766,7 +4769,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4773: \"$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 @@ -4794,17 +4797,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4798: checking for $ac_hdr" >&5 +echo "configure:4801: 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 4803 "configure" +#line 4806 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4811: \"$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* @@ -4831,12 +4834,12 @@ fi done echo $ac_n "checking for backtrace""... $ac_c" 1>&6 -echo "configure:4835: checking for backtrace" >&5 +echo "configure:4838: 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 4840 "configure" +#line 4843 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char backtrace(); below. */ @@ -4859,7 +4862,7 @@ backtrace(); ; return 0; } EOF -if { (eval echo configure:4863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4866: \"$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 @@ -4878,6 +4881,15 @@ if eval "test \"`echo '$ac_cv_func_'backtrace`\" = yes"; then ia64-*-linux*) # Has broken backtrace() ;; + mips*-*-linux*) + # Has broken backtrace(), but we supply our own. + if test -d sysdep; then true; else mkdir -p sysdep; fi + EXTRA_CC_FILES="${EXTRA_CC_FILES} sysdep/dwarf2-backtrace.cc" + cat >> confdefs.h <<\EOF +#define HAVE_BACKTRACE 1 +EOF + + ;; *) cat >> confdefs.h <<\EOF #define HAVE_BACKTRACE 1 @@ -4903,7 +4915,7 @@ fi echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6 -echo "configure:4907: checking for dladdr in -ldl" >&5 +echo "configure:4919: 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 @@ -4911,7 +4923,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4915 "configure" +#line 4927 "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 @@ -4922,7 +4934,7 @@ int main() { dladdr() ; return 0; } EOF -if { (eval echo configure:4926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4938: \"$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 @@ -4938,10 +4950,16 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF + if test "x${disable_dladdr}" = "xyes"; then + #Broken dladdr(). + true + else + cat >> confdefs.h <<\EOF #define HAVE_DLADDR 1 EOF + fi + else echo "$ac_t""no" 1>&6 fi @@ -4952,7 +4970,7 @@ do ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_file""... $ac_c" 1>&6 -echo "configure:4956: checking for $ac_file" >&5 +echo "configure:4974: 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 @@ -5010,7 +5028,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:5014: checking for iconv" >&5 +echo "configure:5032: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5018,7 +5036,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext <<EOF -#line 5022 "configure" +#line 5040 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -5028,7 +5046,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:5032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -5040,7 +5058,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS $am_cv_libiconv_ldpath -liconv" cat > conftest.$ac_ext <<EOF -#line 5044 "configure" +#line 5062 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -5050,7 +5068,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:5054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5072: \"$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 @@ -5071,13 +5089,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:5075: checking for iconv declaration" >&5 +echo "configure:5093: 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 5081 "configure" +#line 5099 "configure" #include "confdefs.h" #include <stdlib.h> @@ -5096,7 +5114,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else @@ -5127,17 +5145,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5131: checking for $ac_hdr" >&5 +echo "configure:5149: 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 5136 "configure" +#line 5154 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5141: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5159: \"$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* @@ -5165,19 +5183,19 @@ done if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:5169: checking for LC_MESSAGES" >&5 +echo "configure:5187: 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 5174 "configure" +#line 5192 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:5181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5199: \"$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 @@ -5198,12 +5216,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:5202: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:5220: 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 5207 "configure" +#line 5225 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -5211,7 +5229,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:5215: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -5232,12 +5250,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:5236: checking for tm_zone in struct tm" >&5 +echo "configure:5254: 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 5241 "configure" +#line 5259 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -5245,7 +5263,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:5249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -5265,12 +5283,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:5269: checking for tzname" >&5 +echo "configure:5287: 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 5274 "configure" +#line 5292 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -5280,7 +5298,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:5284: \"$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* ac_cv_var_tzname=yes else @@ -5305,12 +5323,12 @@ fi for ac_func in gethostbyname_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5309: checking for $ac_func" >&5 +echo "configure:5327: 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 5314 "configure" +#line 5332 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5333,7 +5351,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5355: \"$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 @@ -5360,7 +5378,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext <<EOF -#line 5364 "configure" +#line 5382 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -5380,7 +5398,7 @@ rm -f conftest* *" -D_REENTRANT "*) ;; *) echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6 -echo "configure:5384: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5 +echo "configure:5402: 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 @@ -5393,14 +5411,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 5397 "configure" +#line 5415 "configure" #include "confdefs.h" #include <netdb.h> int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:5404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=no else @@ -5410,14 +5428,14 @@ else CPPFLAGS_SAVE="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_REENTRANT" cat > conftest.$ac_ext <<EOF -#line 5414 "configure" +#line 5432 "configure" #include "confdefs.h" #include <netdb.h> int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:5421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=yes else @@ -5452,12 +5470,12 @@ EOF esac echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6 -echo "configure:5456: checking for struct hostent_data" >&5 +echo "configure:5474: 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 5461 "configure" +#line 5479 "configure" #include "confdefs.h" #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT) @@ -5468,7 +5486,7 @@ int main() { struct hostent_data data; ; return 0; } EOF -if { (eval echo configure:5472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_struct_hostent_data=yes else @@ -5500,7 +5518,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 5504 "configure" +#line 5522 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -5511,12 +5529,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:5515: checking for $ac_func" >&5 +echo "configure:5533: 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 5520 "configure" +#line 5538 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5539,7 +5557,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5561: \"$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 @@ -5566,7 +5584,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext <<EOF -#line 5570 "configure" +#line 5588 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -5593,12 +5611,12 @@ rm -f conftest* for ac_func in gethostname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5597: checking for $ac_func" >&5 +echo "configure:5615: 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 5602 "configure" +#line 5620 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5621,7 +5639,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5643: \"$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 @@ -5645,7 +5663,7 @@ EOF EOF cat > conftest.$ac_ext <<EOF -#line 5649 "configure" +#line 5667 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -5669,12 +5687,12 @@ done for ac_func in usleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5673: checking for $ac_func" >&5 +echo "configure:5691: 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 5678 "configure" +#line 5696 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5697,7 +5715,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5719: \"$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 @@ -5717,7 +5735,7 @@ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then EOF cat > conftest.$ac_ext <<EOF -#line 5721 "configure" +#line 5739 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -5748,12 +5766,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:5752: checking for $ac_func" >&5 +echo "configure:5770: 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 5757 "configure" +#line 5775 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5776,7 +5794,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5798: \"$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 @@ -5806,12 +5824,12 @@ done for ac_func in sched_yield do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5810: checking for $ac_func" >&5 +echo "configure:5828: 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 5815 "configure" +#line 5833 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5834,7 +5852,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5856: \"$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 @@ -5856,7 +5874,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6 -echo "configure:5860: checking for sched_yield in -lrt" >&5 +echo "configure:5878: 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 @@ -5864,7 +5882,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lrt $LIBS" cat > conftest.$ac_ext <<EOF -#line 5868 "configure" +#line 5886 "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 @@ -5875,7 +5893,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:5879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5897: \"$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 @@ -5901,7 +5919,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6 -echo "configure:5905: checking for sched_yield in -lposix4" >&5 +echo "configure:5923: 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 @@ -5909,7 +5927,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <<EOF -#line 5913 "configure" +#line 5931 "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 @@ -5920,7 +5938,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:5924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5942: \"$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 @@ -5956,7 +5974,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 5960 "configure" +#line 5978 "configure" #include "confdefs.h" #include <pthread.h> int main() { @@ -5965,7 +5983,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5969: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE_M_COUNT 1 @@ -5977,7 +5995,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 5981 "configure" +#line 5999 "configure" #include "confdefs.h" #include <pthread.h> int main() { @@ -5986,7 +6004,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE___M_COUNT 1 @@ -6006,12 +6024,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:6010: checking for $ac_func" >&5 +echo "configure:6028: 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 6033 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6034,7 +6052,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:6056: \"$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 @@ -6065,12 +6083,12 @@ done for ac_func in memmove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6069: checking for $ac_func" >&5 +echo "configure:6087: 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 6074 "configure" +#line 6092 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6093,7 +6111,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6115: \"$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 @@ -6123,12 +6141,12 @@ done for ac_func in memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6127: checking for $ac_func" >&5 +echo "configure:6145: 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 6132 "configure" +#line 6150 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6151,7 +6169,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6173: \"$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 @@ -6180,7 +6198,7 @@ done fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:6184: checking for dlopen in -ldl" >&5 +echo "configure:6202: 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 @@ -6188,7 +6206,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 6192 "configure" +#line 6210 "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 @@ -6199,7 +6217,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:6203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6221: \"$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 @@ -6244,7 +6262,7 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for socket libraries""... $ac_c" 1>&6 -echo "configure:6248: checking for socket libraries" >&5 +echo "configure:6266: 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 @@ -6252,12 +6270,12 @@ else gcj_checkBoth=0 unset ac_cv_func_connect echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:6256: checking for connect" >&5 +echo "configure:6274: 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 6261 "configure" +#line 6279 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -6280,7 +6298,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:6284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6302: \"$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 @@ -6303,7 +6321,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:6307: checking for main in -lsocket" >&5 +echo "configure:6325: 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 @@ -6311,14 +6329,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 6315 "configure" +#line 6333 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:6322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6340: \"$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 @@ -6345,12 +6363,12 @@ fi LIBS="$LIBS -lsocket -lnsl" unset ac_cv_func_accept echo $ac_n "checking for accept""... $ac_c" 1>&6 -echo "configure:6349: checking for accept" >&5 +echo "configure:6367: 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 6354 "configure" +#line 6372 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char accept(); below. */ @@ -6373,7 +6391,7 @@ accept(); ; return 0; } EOF -if { (eval echo configure:6377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6395: \"$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 @@ -6400,12 +6418,12 @@ fi gcj_oldLibs=$LIBS LIBS="$LIBS $gcj_cv_lib_sockets" echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:6404: checking for gethostbyname" >&5 +echo "configure:6422: 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 6409 "configure" +#line 6427 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -6428,7 +6446,7 @@ gethostbyname(); ; return 0; } EOF -if { (eval echo configure:6432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6450: \"$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 @@ -6446,7 +6464,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:6450: checking for main in -lnsl" >&5 +echo "configure:6468: 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 @@ -6454,14 +6472,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 6458 "configure" +#line 6476 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:6465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6483: \"$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 @@ -6493,7 +6511,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:6497: checking for deflate in -lz" >&5 +echo "configure:6515: 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 @@ -6501,7 +6519,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <<EOF -#line 6505 "configure" +#line 6523 "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 @@ -6512,7 +6530,7 @@ int main() { deflate() ; return 0; } EOF -if { (eval echo configure:6516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6534: \"$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 @@ -6561,7 +6579,7 @@ fi # 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:6565: checking for $ac_word" >&5 +echo "configure:6583: 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 @@ -6609,7 +6627,7 @@ fi min_gtk_version=2.0.0 echo $ac_n "checking for GTK+ - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:6613: checking for GTK+ - version >= $min_gtk_version" >&5 +echo "configure:6631: 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 @@ -6644,7 +6662,7 @@ echo "configure:6613: checking for GTK+ - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 6648 "configure" +#line 6666 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -6719,7 +6737,7 @@ main () } EOF -if { (eval echo configure:6723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -6753,7 +6771,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext <<EOF -#line 6757 "configure" +#line 6775 "configure" #include "confdefs.h" #include <gtk/gtk.h> @@ -6763,7 +6781,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:6767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6785: \"$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" @@ -6822,7 +6840,7 @@ fi # 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:6826: checking for $ac_word" >&5 +echo "configure:6844: 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 @@ -6872,7 +6890,7 @@ fi min_glib_version=2.0.0 echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 -echo "configure:6876: checking for GLIB - version >= $min_glib_version" >&5 +echo "configure:6894: 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 @@ -6911,7 +6929,7 @@ echo "configure:6876: checking for GLIB - version >= $min_glib_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 6915 "configure" +#line 6933 "configure" #include "confdefs.h" #include <glib.h> @@ -6986,7 +7004,7 @@ main () } EOF -if { (eval echo configure:6990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -7020,7 +7038,7 @@ fi CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat > conftest.$ac_ext <<EOF -#line 7024 "configure" +#line 7042 "configure" #include "confdefs.h" #include <glib.h> @@ -7030,7 +7048,7 @@ int main() { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } EOF -if { (eval echo configure:7034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7052: \"$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" @@ -7109,7 +7127,7 @@ 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:7113: checking for $ac_word" >&5 +echo "configure:7131: 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 @@ -7146,7 +7164,7 @@ fi # Extract the first word of "libart-config", so it can be a program name with args. set dummy libart-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7150: checking for $ac_word" >&5 +echo "configure:7168: 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 @@ -7182,7 +7200,7 @@ fi fi min_libart_version=2.1.0 echo $ac_n "checking for LIBART - version >= $min_libart_version""... $ac_c" 1>&6 -echo "configure:7186: checking for LIBART - version >= $min_libart_version" >&5 +echo "configure:7204: checking for LIBART - version >= $min_libart_version" >&5 no_libart="" if test "$LIBART_CONFIG" = "no" ; then no_libart=yes @@ -7206,7 +7224,7 @@ echo "configure:7186: checking for LIBART - version >= $min_libart_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 7210 "configure" +#line 7228 "configure" #include "confdefs.h" #include <stdio.h> @@ -7264,7 +7282,7 @@ int main () EOF -if { (eval echo configure:7268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -7298,7 +7316,7 @@ fi CFLAGS="$CFLAGS $LIBART_CFLAGS" LIBS="$LIBS $LIBART_LIBS" cat > conftest.$ac_ext <<EOF -#line 7302 "configure" +#line 7320 "configure" #include "confdefs.h" #include <stdio.h> @@ -7308,7 +7326,7 @@ int main() { return 0; ; return 0; } EOF -if { (eval echo configure:7312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7330: \"$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" @@ -7347,7 +7365,7 @@ rm -f conftest* # requires -ldl. if test "$GC" = boehm; then echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6 -echo "configure:7351: checking for main in -ldl" >&5 +echo "configure:7369: 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 @@ -7355,14 +7373,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 7359 "configure" +#line 7377 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:7366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7384: \"$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 @@ -7483,7 +7501,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:7487: checking for $ac_word" >&5 +echo "configure:7505: 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 @@ -7515,7 +7533,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:7519: checking for $ac_word" >&5 +echo "configure:7537: 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 @@ -7577,13 +7595,13 @@ exec 5>>./config.log CPPFLAGS=$GCJ_SAVE_CPPFLAGS echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:7581: checking size of void *" >&5 +echo "configure:7599: 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 7587 "configure" +#line 7605 "configure" #include "confdefs.h" #include "confdefs.h" #include <sys/types.h> @@ -7593,7 +7611,7 @@ int main() { switch (0) case 0: case (sizeof (void *) == $ac_size):; ; return 0; } EOF -if { (eval echo configure:7597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sizeof_void_p=$ac_size else @@ -7706,17 +7724,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:7710: checking for $ac_hdr" >&5 +echo "configure:7728: 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 7715 "configure" +#line 7733 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7738: \"$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* @@ -7746,17 +7764,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:7750: checking for $ac_hdr" >&5 +echo "configure:7768: 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 7755 "configure" +#line 7773 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7760: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7778: \"$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* @@ -7786,17 +7804,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:7790: checking for $ac_hdr" >&5 +echo "configure:7808: 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 7795 "configure" +#line 7813 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7818: \"$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* @@ -7832,12 +7850,12 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:7836: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:7854: 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 7841 "configure" +#line 7859 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -7853,7 +7871,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:7857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -7875,12 +7893,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:7879: checking for ANSI C header files" >&5 +echo "configure:7897: 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 7884 "configure" +#line 7902 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -7888,7 +7906,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7910: \"$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* @@ -7905,7 +7923,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 7909 "configure" +#line 7927 "configure" #include "confdefs.h" #include <string.h> EOF @@ -7923,7 +7941,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 7927 "configure" +#line 7945 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -7944,7 +7962,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 7948 "configure" +#line 7966 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -7955,7 +7973,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:7959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -7979,12 +7997,12 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:7983: checking for ssize_t" >&5 +echo "configure:8001: 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 7988 "configure" +#line 8006 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -8013,9 +8031,9 @@ fi echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6 -echo "configure:8017: checking for in_addr_t" >&5 +echo "configure:8035: checking for in_addr_t" >&5 cat > conftest.$ac_ext <<EOF -#line 8019 "configure" +#line 8037 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -8029,7 +8047,7 @@ int main() { in_addr_t foo; ; return 0; } EOF -if { (eval echo configure:8033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_IN_ADDR_T 1 @@ -8045,16 +8063,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:8049: checking whether struct ip_mreq is in netinet/in.h" >&5 +echo "configure:8067: checking whether struct ip_mreq is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 8051 "configure" +#line 8069 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct ip_mreq mreq; ; return 0; } EOF -if { (eval echo configure:8058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8076: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_IP_MREQ 1 @@ -8070,16 +8088,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:8074: checking whether struct ipv6_mreq is in netinet/in.h" >&5 +echo "configure:8092: checking whether struct ipv6_mreq is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 8076 "configure" +#line 8094 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct ipv6_mreq mreq6; ; return 0; } EOF -if { (eval echo configure:8083: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_IPV6_MREQ 1 @@ -8095,16 +8113,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:8099: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 +echo "configure:8117: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 8101 "configure" +#line 8119 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct sockaddr_in6 addr6; ; return 0; } EOF -if { (eval echo configure:8108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_INET6 1 @@ -8120,9 +8138,9 @@ fi rm -f conftest* echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6 -echo "configure:8124: checking for socklen_t in sys/socket.h" >&5 +echo "configure:8142: checking for socklen_t in sys/socket.h" >&5 cat > conftest.$ac_ext <<EOF -#line 8126 "configure" +#line 8144 "configure" #include "confdefs.h" #define _POSIX_PII_SOCKET #include <sys/types.h> @@ -8131,7 +8149,7 @@ int main() { socklen_t x = 5; ; return 0; } EOF -if { (eval echo configure:8135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_SOCKLEN_T 1 @@ -8147,16 +8165,16 @@ fi rm -f conftest* echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:8151: checking for tm_gmtoff in struct tm" >&5 +echo "configure:8169: checking for tm_gmtoff in struct tm" >&5 cat > conftest.$ac_ext <<EOF -#line 8153 "configure" +#line 8171 "configure" #include "confdefs.h" #include <time.h> int main() { struct tm tim; tim.tm_gmtoff = 0; ; return 0; } EOF -if { (eval echo configure:8160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define STRUCT_TM_HAS_GMTOFF 1 @@ -8169,16 +8187,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:8173: checking for global timezone variable" >&5 +echo "configure:8191: checking for global timezone variable" >&5 cat > conftest.$ac_ext <<EOF -#line 8175 "configure" +#line 8193 "configure" #include "confdefs.h" #include <time.h> int main() { void i(){long z2 = 2*timezone;} ; return 0; } EOF -if { (eval echo configure:8182: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TIMEZONE 1 @@ -8191,16 +8209,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:8195: checking for global _timezone variable" >&5 +echo "configure:8213: checking for global _timezone variable" >&5 cat > conftest.$ac_ext <<EOF -#line 8197 "configure" +#line 8215 "configure" #include "confdefs.h" #include <time.h> int main() { long z2 = _timezone; ; return 0; } EOF -if { (eval echo configure:8204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_UNDERSCORE_TIMEZONE 1 @@ -8222,19 +8240,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:8226: checking for working alloca.h" >&5 +echo "configure:8244: 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 8231 "configure" +#line 8249 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:8238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8256: \"$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 @@ -8255,12 +8273,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:8259: checking for alloca" >&5 +echo "configure:8277: 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 8264 "configure" +#line 8282 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -8288,7 +8306,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:8292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8310: \"$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 @@ -8320,12 +8338,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:8324: checking whether alloca needs Cray hooks" >&5 +echo "configure:8342: 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 8329 "configure" +#line 8347 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -8350,12 +8368,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:8354: checking for $ac_func" >&5 +echo "configure:8372: 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 8359 "configure" +#line 8377 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8378,7 +8396,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8400: \"$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 @@ -8405,7 +8423,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:8409: checking stack direction for C alloca" >&5 +echo "configure:8427: 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 @@ -8413,7 +8431,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 8417 "configure" +#line 8435 "configure" #include "confdefs.h" find_stack_direction () { @@ -8432,7 +8450,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:8436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8454: \"$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 @@ -8453,21 +8471,21 @@ EOF fi -for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h +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:8461: checking for $ac_hdr" >&5 +echo "configure:8479: 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 8466 "configure" +#line 8484 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8489: \"$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* @@ -8496,12 +8514,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8500: checking for $ac_func" >&5 +echo "configure:8518: 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 8505 "configure" +#line 8523 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8524,7 +8542,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8546: \"$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 @@ -8549,7 +8567,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:8553: checking for working mmap" >&5 +echo "configure:8571: 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 @@ -8557,7 +8575,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 8561 "configure" +#line 8579 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -8585,24 +8603,11 @@ else #include <fcntl.h> #include <sys/mman.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#if HAVE_STDLIB_H -# include <stdlib.h> -#endif - -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#if HAVE_UNISTD_H -# include <unistd.h> -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -8710,7 +8715,7 @@ main() } EOF -if { (eval echo configure:8714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8719: \"$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 @@ -8738,7 +8743,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:8742: checking for $ac_word" >&5 +echo "configure:8747: 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 @@ -8806,6 +8811,9 @@ case "${host}" in *mingw*) SIGNAL_HANDLER=include/win32-signal.h ;; + mips*-*-linux*) + SIGNAL_HANDLER=include/mips-signal.h + ;; *) SIGNAL_HANDLER=include/default-signal.h ;; @@ -9035,6 +9043,7 @@ s%@LIBGCJDEBUG@%$LIBGCJDEBUG%g s%@INTERPRETER@%$INTERPRETER%g s%@LIBFFI@%$LIBFFI%g s%@LIBFFIINCS@%$LIBFFIINCS%g +s%@EXTRA_CC_FILES@%$EXTRA_CC_FILES%g s%@PLATFORMOBJS@%$PLATFORMOBJS%g s%@CPP@%$CPP%g s%@SYSTEMSPEC@%$SYSTEMSPEC%g diff --git a/libjava/configure.host b/libjava/configure.host index d6935c38e55..2d04bbca934 100644 --- a/libjava/configure.host +++ b/libjava/configure.host @@ -28,6 +28,8 @@ # pthread_self calls by caching thread IDs in a hashtable # can_unwind_signal Set to "yes" if the EH unwinder supports throwing # from a signal handler. +# disable_dladdr Set to "yes" if dladdr should not be used +# (i.e it is broken). libgcj_flags= libgcj_cflags= @@ -39,6 +41,7 @@ enable_hash_synchronization_default=no sysdeps_dir=generic slow_pthread_self= can_unwind_signal=no +disable_dladdr= case "${target_optspace}:${host}" in yes:*) @@ -213,6 +216,17 @@ EOF rm -f conftest conftest.c fi ;; + mips*-*-linux* ) + sysdeps_dir=mips + can_unwind_signal=yes + libgcj_flags="${libgcj_flags} -mxgot" + case "${host}" in + mipsel*-linux* | mipsisa32el*-linux*) + enable_hash_synchronization_default=yes + disable_dladdr=yes + ;; + esac + ;; *-*-darwin*) enable_hash_synchronization_default=no slow_pthread_self= diff --git a/libjava/configure.in b/libjava/configure.in index aaae5e69255..ad14a9190b5 100644 --- a/libjava/configure.in +++ b/libjava/configure.in @@ -232,6 +232,9 @@ AC_ARG_WITH(ecos, TARGET_ECOS="$with_ecos" ) +EXTRA_CC_FILES= +AC_SUBST(EXTRA_CC_FILES) + PLATFORMOBJS= case "$TARGET_ECOS" in no) case "$host" in @@ -600,6 +603,13 @@ else ia64-*-linux*) # Has broken backtrace() ;; + mips*-*-linux*) + # Has broken backtrace(), but we supply our own. + if test -d sysdep; then true; else mkdir -p sysdep; fi + EXTRA_CC_FILES="${EXTRA_CC_FILES} sysdep/dwarf2-backtrace.cc" + AC_DEFINE(HAVE_BACKTRACE, 1, + [Define if your platform has a working backtrace() function.]) + ;; *) AC_DEFINE(HAVE_BACKTRACE, 1, [Define if your platform has a working backtrace() function.]) @@ -616,7 +626,13 @@ else ]) AC_CHECK_LIB(dl, dladdr, [ - AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])]) + if test "x${disable_dladdr}" = "xyes"; then + #Broken dladdr(). + true + else + AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()]) + fi + ]) if test x"$build" = x"$host"; then AC_CHECK_FILES(/proc/self/exe, [ AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])]) @@ -1107,6 +1123,9 @@ case "${host}" in *mingw*) SIGNAL_HANDLER=include/win32-signal.h ;; + mips*-*-linux*) + SIGNAL_HANDLER=include/mips-signal.h + ;; *) SIGNAL_HANDLER=include/default-signal.h ;; diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc index 4cd4f4f1936..2e8b4d97434 100644 --- a/libjava/defineclass.cc +++ b/libjava/defineclass.cc @@ -1270,6 +1270,7 @@ void _Jv_ClassReader::handleCodeAttribute _Jv_InterpMethod *method = (_Jv_InterpMethod*) (_Jv_AllocBytes (size)); + method->deferred = NULL; method->max_stack = max_stack; method->max_locals = max_locals; method->code_length = code_length; @@ -1328,6 +1329,7 @@ void _Jv_ClassReader::handleMethodsEnd () m->self = method; m->function = NULL; def->interpreted_methods[i] = m; + m->deferred = NULL; if ((method->accflags & Modifier::STATIC)) { diff --git a/libjava/exception.cc b/libjava/exception.cc index 9647d446d18..088d48268e3 100644 --- a/libjava/exception.cc +++ b/libjava/exception.cc @@ -161,7 +161,7 @@ parse_lsda_header (_Unwind_Context *context, const unsigned char *p, return p; } -static jclass +static void ** get_ttype_entry (_Unwind_Context *context, lsda_header_info *info, long i) { _Unwind_Ptr ptr; @@ -169,7 +169,7 @@ get_ttype_entry (_Unwind_Context *context, lsda_header_info *info, long i) i *= size_of_encoded_value (info->ttype_encoding); read_encoded_value (context, info->ttype_encoding, info->TType - i, &ptr); - return reinterpret_cast<jclass>(ptr); + return reinterpret_cast<void **>(ptr); } @@ -336,23 +336,15 @@ PERSONALITY_FUNCTION (int version, { // Positive filter values are handlers. - jclass catch_type = get_ttype_entry (context, &info, ar_filter); + void **catch_word = get_ttype_entry (context, &info, ar_filter); + jclass catch_type = (jclass)*catch_word; + + // FIXME: This line is a kludge to work around exception + // handlers written in C++, which don't yet use indirect + // dispatch. + if (catch_type == *(void **)&java::lang::Class::class$) + catch_type = (jclass)catch_word; - typedef struct { - int __attribute__ ((mode (pointer))) dummy; - Utf8Const *utf8; - } utf8_hdr; - utf8_hdr *p = (utf8_hdr *)catch_type; - if (p->dummy == -1) - { - using namespace gnu::gcj::runtime; - java::lang::Class *klass - = StackTrace::getClass ((gnu::gcj::RawData *)ip); - java::lang::ClassLoader *loader - = klass ? klass->getClassLoaderInternal () : NULL; - catch_type = _Jv_FindClass (p->utf8, loader); - } - if (_Jv_IsInstanceOf (xh->value, catch_type)) { handler_switch_value = ar_filter; diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in index 064b5227625..407858ce5a7 100644 --- a/libjava/gcj/Makefile.in +++ b/libjava/gcj/Makefile.in @@ -76,6 +76,7 @@ DIVIDESPEC = @DIVIDESPEC@ DLLTOOL = @DLLTOOL@ EXCEPTIONSPEC = @EXCEPTIONSPEC@ EXEEXT = @EXEEXT@ +EXTRA_CC_FILES = @EXTRA_CC_FILES@ GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@ GCDEPS = @GCDEPS@ GCINCS = @GCINCS@ diff --git a/libjava/gnu/gcj/runtime/natFirstThread.cc b/libjava/gnu/gcj/runtime/natFirstThread.cc index 1d62471df7e..e3100c53fc0 100644 --- a/libjava/gnu/gcj/runtime/natFirstThread.cc +++ b/libjava/gnu/gcj/runtime/natFirstThread.cc @@ -1,6 +1,6 @@ // natFirstThread.cc - Implementation of FirstThread native methods. -/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation This file is part of libgcj. @@ -26,7 +26,8 @@ gnu::gcj::runtime::FirstThread::call_main (void) Utf8Const* main_signature = _Jv_makeUtf8Const ("([Ljava.lang.String;)V", 22); Utf8Const* main_name = _Jv_makeUtf8Const ("main", 4); - _Jv_Method *meth = _Jv_GetMethodLocal (klass, main_name, main_signature); + _Jv_Method *meth = _Jv_LookupDeclaredMethod (klass, main_name, + main_signature); // Some checks from Java Spec section 12.1.4. const char *msg = NULL; diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java index 11c0371bd08..7adb307b75a 100644 --- a/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java +++ b/libjava/gnu/java/awt/peer/gtk/GdkGraphics2D.java @@ -48,6 +48,8 @@ import java.awt.image.renderable.*; import java.text.AttributedCharacterIterator; import java.util.Map; import java.lang.Integer; +import gnu.java.awt.ClasspathToolkit; +import gnu.java.awt.peer.ClasspathFontPeer; import gnu.classpath.Configuration; public class GdkGraphics2D extends Graphics2D @@ -75,8 +77,8 @@ public class GdkGraphics2D extends Graphics2D private Shape clip; private AffineTransform transform; private GtkComponentPeer component; - private GdkFont font; - + private Font font; + native private int[] initState (GtkComponentPeer component); native private void initState (int width, int height); native private void copyState (GdkGraphics2D g); @@ -172,6 +174,10 @@ public class GdkGraphics2D extends Graphics2D private native void cairoSetMatrix (double m00, double m10, double m01, double m11, double m02, double m12); + private native void cairoSetFont (GdkClasspathFontPeer peer); + private native void cairoShowGlyphs (int codes[], + float positions[], + int nglyphs); private native void cairoSetOperator (int cairoOperator); private native void cairoSetRGBColor (double red, double green, double blue); private native void cairoSetAlpha (double alpha); @@ -1024,8 +1030,14 @@ public class GdkGraphics2D extends Graphics2D } public void drawGlyphVector (GlyphVector g, float x, float y) - { - throw new java.lang.UnsupportedOperationException (); + { + cairoSave (); + cairoTranslate ((double)x, (double)y); + int nglyphs = g.getNumGlyphs (); + int codes[] = g.getGlyphCodes (0, nglyphs, (int []) null); + float posns[] = g.getGlyphPositions (0, nglyphs, (float []) null); + cairoShowGlyphs (codes, posns, nglyphs); + cairoRestore (); } public void copyArea (int x, int y, int width, int height, int dx, int dy) @@ -1132,10 +1144,16 @@ public class GdkGraphics2D extends Graphics2D public void setFont (Font f) { - if (f instanceof GdkFont) - font = (GdkFont) f; + if (f.getPeer() instanceof GdkClasspathFontPeer) + font = f; else - font = new GdkFont (f.getAttributes ()); + font = + ((ClasspathToolkit)(Toolkit.getDefaultToolkit ())) + .getFont (f.getName(), f.getAttributes ()); + + if (f != null && + f.getPeer() instanceof GdkClasspathFontPeer) + cairoSetFont ((GdkClasspathFontPeer) f.getPeer()); } public String toString() diff --git a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java index 551d05ded8f..27867321c3c 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java @@ -80,13 +80,4 @@ public class GtkDialogPeer extends GtkWindowPeer args.add ("allow_shrink", dialog.isResizable ()); args.add ("allow_grow", dialog.isResizable ()); } - - public void handleEvent (AWTEvent event) - { -// int id = event.getID(); - -// if (id == WindowEvent.WINDOW_CLOSING) -// System.out.println ("got a closing event"); - } - } diff --git a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java index 8875913d4fc..821afa929f1 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java @@ -42,6 +42,8 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.Insets; import java.awt.Window; +import java.awt.Frame; +import java.awt.event.WindowEvent; import java.awt.peer.WindowPeer; public class GtkWindowPeer extends GtkContainerPeer @@ -56,6 +58,9 @@ public class GtkWindowPeer extends GtkContainerPeer static protected final int GDK_WINDOW_TYPE_HINT_DOCK = 6; static protected final int GDK_WINDOW_TYPE_HINT_DESKTOP = 7; + private boolean hasBeenShown = false; + private int oldState = Frame.NORMAL; + // Unfortunately, X does not provide a clean way to calculate the // dimensions of a window's borders before it has been displayed. // So when creating the application's first window we guess the @@ -211,4 +216,29 @@ public class GtkWindowPeer extends GtkContainerPeer awtComponent.getHeight()); nativeSetVisible (b); } + + void postWindowEvent (int id, Window opposite, int newState) + { + if (id == WindowEvent.WINDOW_OPENED) + { + // Post a WINDOW_OPENED event the first time this window is shown. + if (!hasBeenShown) + { + q.postEvent (new WindowEvent ((Window) awtComponent, id, + opposite)); + hasBeenShown = true; + } + } + else if (id == WindowEvent.WINDOW_STATE_CHANGED) + { + if (oldState != newState) + { + q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite, + oldState, newState)); + oldState = newState; + } + } + else + q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite)); + } } diff --git a/libjava/gnu/java/net/PlainDatagramSocketImpl.java b/libjava/gnu/java/net/PlainDatagramSocketImpl.java index bc868644e40..9f710d37b4c 100644 --- a/libjava/gnu/java/net/PlainDatagramSocketImpl.java +++ b/libjava/gnu/java/net/PlainDatagramSocketImpl.java @@ -45,8 +45,8 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.NetworkInterface; import java.net.SocketAddress; -import java.net.SocketOptions; import java.net.SocketException; +import java.net.SocketOptions; import gnu.classpath.Configuration; /** @@ -94,7 +94,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl /** * This is the actual underlying file descriptor */ - int fnum = -1; + int native_fd = -1; // FIXME: Is this necessary? Could it help w/ DatagramSocket.getLocalAddress? // InetAddress address; @@ -116,7 +116,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl { synchronized (this) { - if (fnum != -1) + if (native_fd != -1) close(); } super.finalize(); @@ -124,7 +124,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl public int getNativeFD() { - return fnum; + return native_fd; } /** diff --git a/libjava/gnu/java/net/PlainSocketImpl.java b/libjava/gnu/java/net/PlainSocketImpl.java index 01ba28851d7..80139115cfe 100644 --- a/libjava/gnu/java/net/PlainSocketImpl.java +++ b/libjava/gnu/java/net/PlainSocketImpl.java @@ -1,5 +1,6 @@ /* PlainSocketImpl.java -- Default socket implementation - Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -100,7 +101,7 @@ public final class PlainSocketImpl extends SocketImpl * * When the socket is closed this is reset to -1. */ - int fnum = -1; + int native_fd = -1; // This value is set/read by setOption/getOption. int timeout = 0; @@ -129,14 +130,13 @@ public final class PlainSocketImpl extends SocketImpl { synchronized (this) { - if (fnum != -1) + if (native_fd != -1) try { close(); } catch (IOException ex) { - // ignore } } super.finalize(); @@ -144,7 +144,7 @@ public final class PlainSocketImpl extends SocketImpl public int getNativeFD() { - return fnum; + return native_fd; } /** diff --git a/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc b/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc index f1897b789d9..65d083c0970 100644 --- a/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc +++ b/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc @@ -81,9 +81,9 @@ gnu::java::net::PlainDatagramSocketImpl::create () _Jv_platform_close_on_exec (sock); - // We use fnum in place of fd here. From leaving fd null we avoid + // We use native_fd in place of fd here. From leaving fd null we avoid // the double close problem in FileDescriptor.finalize. - fnum = sock; + native_fd = sock; } void @@ -121,20 +121,20 @@ gnu::java::net::PlainDatagramSocketImpl::bind (jint lport, else throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (_Jv_bind (fnum, ptr, len) == 0) + if (_Jv_bind (native_fd, ptr, len) == 0) { socklen_t addrlen = sizeof(u); if (lport != 0) localPort = lport; - else if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0) + else if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) == 0) localPort = ntohs (u.address.sin_port); else goto error; /* Allow broadcast by default. */ int broadcast = 1; - if (::setsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast, + if (::setsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast, sizeof (broadcast)) != 0) goto error; @@ -167,7 +167,7 @@ gnu::java::net::PlainDatagramSocketImpl::peek (::java::net::InetAddress *i) union SockAddr u; socklen_t addrlen = sizeof(u); ssize_t retlen = - ::recvfrom (fnum, (char *) NULL, 0, MSG_PEEK, (sockaddr*) &u, + ::recvfrom (native_fd, (char *) NULL, 0, MSG_PEEK, (sockaddr*) &u, &addrlen); if (retlen < 0) goto error; @@ -212,23 +212,23 @@ gnu::java::net::PlainDatagramSocketImpl::peekData (::java::net::DatagramPacket * ssize_t retlen = 0; // Do timeouts via select since SO_RCVTIMEO is not always available. - if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE) + if (timeout > 0 && native_fd >= 0 && native_fd < FD_SETSIZE) { fd_set rset; struct timeval tv; FD_ZERO(&rset); - FD_SET(fnum, &rset); + FD_SET(native_fd, &rset); tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; int retval; - if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0) + if ((retval = _Jv_select (native_fd + 1, &rset, NULL, NULL, &tv)) < 0) goto error; else if (retval == 0) throw new ::java::io::InterruptedIOException (); } retlen = - ::recvfrom (fnum, (char *) dbytes, p->getLength(), MSG_PEEK, (sockaddr*) &u, + ::recvfrom (native_fd, (char *) dbytes, p->getLength(), MSG_PEEK, (sockaddr*) &u, &addrlen); if (retlen < 0) goto error; @@ -275,8 +275,8 @@ gnu::java::net::PlainDatagramSocketImpl::close () // The method isn't declared to throw anything, so we disregard // the return value. - _Jv_close (fnum); - fnum = -1; + _Jv_close (native_fd); + native_fd = -1; timeout = 0; } @@ -310,7 +310,7 @@ gnu::java::net::PlainDatagramSocketImpl::send (::java::net::DatagramPacket *p) else throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::sendto (fnum, (char *) dbytes, p->getLength(), 0, ptr, len) >= 0) + if (::sendto (native_fd, (char *) dbytes, p->getLength(), 0, ptr, len) >= 0) return; char* strerr = strerror (errno); @@ -331,23 +331,23 @@ gnu::java::net::PlainDatagramSocketImpl::receive (::java::net::DatagramPacket *p ssize_t retlen = 0; // Do timeouts via select since SO_RCVTIMEO is not always available. - if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE) + if (timeout > 0 && native_fd >= 0 && native_fd < FD_SETSIZE) { fd_set rset; struct timeval tv; FD_ZERO(&rset); - FD_SET(fnum, &rset); + FD_SET(native_fd, &rset); tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; int retval; - if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0) + if ((retval = _Jv_select (native_fd + 1, &rset, NULL, NULL, &tv)) < 0) goto error; else if (retval == 0) throw new ::java::io::InterruptedIOException (); } retlen = - ::recvfrom (fnum, (char *) dbytes, p->getLength(), 0, (sockaddr*) &u, + ::recvfrom (native_fd, (char *) dbytes, p->getLength(), 0, (sockaddr*) &u, &addrlen); if (retlen < 0) goto error; @@ -392,7 +392,7 @@ gnu::java::net::PlainDatagramSocketImpl::setTimeToLive (jint ttl) char val = (char) ttl; socklen_t val_len = sizeof(val); - if (::setsockopt (fnum, IPPROTO_IP, IP_MULTICAST_TTL, &val, val_len) == 0) + if (::setsockopt (native_fd, IPPROTO_IP, IP_MULTICAST_TTL, &val, val_len) == 0) return; char* strerr = strerror (errno); @@ -406,7 +406,7 @@ gnu::java::net::PlainDatagramSocketImpl::getTimeToLive () char val; socklen_t val_len = sizeof(val); - if (::getsockopt (fnum, IPPROTO_IP, IP_MULTICAST_TTL, &val, &val_len) == 0) + if (::getsockopt (native_fd, IPPROTO_IP, IP_MULTICAST_TTL, &val, &val_len) == 0) return ((int) val) & 0xFF; char* strerr = strerror (errno); @@ -466,7 +466,7 @@ gnu::java::net::PlainDatagramSocketImpl::mcastGrp (::java::net::InetAddress *ine else throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::setsockopt (fnum, level, opname, ptr, len) == 0) + if (::setsockopt (native_fd, level, opname, ptr, len) == 0) return; char* strerr = strerror (errno); @@ -480,7 +480,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, int val; socklen_t val_len = sizeof (val); - if (fnum < 0) + if (native_fd < 0) throw new ::java::net::SocketException (JvNewStringUTF ("Socket closed")); if (_Jv_IsInstanceOf (value, &::java::lang::Boolean::class$)) @@ -513,7 +513,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, return; case _Jv_SO_BROADCAST_ : - if (::setsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &val, val_len) != 0) goto error; break; @@ -528,7 +528,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, #if defined(SO_SNDBUF) && defined(SO_RCVBUF) int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, val_len) != 0) + if (::setsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, val_len) != 0) goto error; #else throw new ::java::lang::InternalError ( @@ -537,7 +537,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, return; case _Jv_SO_REUSEADDR_ : #if defined(SO_REUSEADDR) - if (::setsockopt (fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, val_len) != 0) goto error; #else @@ -583,7 +583,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::setsockopt (fnum, level, opname, ptr, len) != 0) + if (::setsockopt (native_fd, level, opname, ptr, len) != 0) goto error; return; @@ -598,7 +598,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, break; case _Jv_IP_TOS_ : - if (::setsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, val_len) != 0) goto error; return; @@ -639,7 +639,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) break; case _Jv_SO_BROADCAST_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean (val != 0); @@ -654,7 +654,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) #if defined(SO_SNDBUF) && defined(SO_RCVBUF) int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::getsockopt (fnum, SOL_SOCKET, opt, (char *) &val, &val_len) != 0) + if (::getsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, &val_len) != 0) goto error; else return new ::java::lang::Integer (val); @@ -668,7 +668,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) if (localAddress == NULL) { jbyteArray laddr; - if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != 0) + if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) != 0) goto error; if (u.address.sin_family == AF_INET) { @@ -691,7 +691,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) break; case _Jv_SO_REUSEADDR_ : #if defined(SO_REUSEADDR) - if (::getsockopt (fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean (val != 0); @@ -707,7 +707,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) char *bytes; inaddr_len = sizeof(inaddr); - if (::getsockopt (fnum, IPPROTO_IP, IP_MULTICAST_IF, (char *) &inaddr, + if (::getsockopt (native_fd, IPPROTO_IP, IP_MULTICAST_IF, (char *) &inaddr, &inaddr_len) != 0) goto error; @@ -729,13 +729,13 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) break; case _Jv_IP_MULTICAST_LOOP_ : - if (::getsockopt (fnum, SOL_SOCKET, IP_MULTICAST_LOOP, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, IP_MULTICAST_LOOP, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean (val != 0); case _Jv_IP_TOS_ : - if (::getsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Integer (val); diff --git a/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc b/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc index f9311417d7c..1098e6158a8 100644 --- a/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc +++ b/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc @@ -71,9 +71,9 @@ gnu::java::net::PlainDatagramSocketImpl::create () _Jv_platform_close_on_exec (sock); - // We use fnum in place of fd here. From leaving fd null we avoid + // We use native_fd in place of fd here. From leaving fd null we avoid // the double close problem in FileDescriptor.finalize. - fnum = (int) sock; + native_fd = (int) sock; } void @@ -111,20 +111,20 @@ gnu::java::net::PlainDatagramSocketImpl::bind (jint lport, else throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::bind (fnum, ptr, len) == 0) + if (::bind (native_fd, ptr, len) == 0) { socklen_t addrlen = sizeof(u); if (lport != 0) localPort = lport; - else if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0) + else if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) == 0) localPort = ntohs (u.address.sin_port); else goto error; /* Allow broadcast by default. */ int broadcast = 1; - if (::setsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast, + if (::setsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &broadcast, sizeof (broadcast)) != 0) goto error; @@ -157,7 +157,7 @@ gnu::java::net::PlainDatagramSocketImpl::peek (::java::net::InetAddress *i) union SockAddr u; socklen_t addrlen = sizeof(u); ssize_t retlen = - ::recvfrom (fnum, (char *) NULL, 0, MSG_PEEK, (sockaddr*) &u, + ::recvfrom (native_fd, (char *) NULL, 0, MSG_PEEK, (sockaddr*) &u, &addrlen); if (retlen < 0) goto error; @@ -204,14 +204,14 @@ gnu::java::net::PlainDatagramSocketImpl::peekData(::java::net::DatagramPacket *p if (timeout > 0) { - int nRet= ::setsockopt(fnum, SOL_SOCKET, SO_RCVTIMEO, + int nRet= ::setsockopt(native_fd, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)); if (nRet != NO_ERROR) goto error; } retlen = - ::recvfrom (fnum, (char *) dbytes, p->getLength(), MSG_PEEK, (sockaddr*) &u, + ::recvfrom (native_fd, (char *) dbytes, p->getLength(), MSG_PEEK, (sockaddr*) &u, &addrlen); if (retlen == SOCKET_ERROR) goto error; @@ -262,8 +262,8 @@ gnu::java::net::PlainDatagramSocketImpl::close () // The method isn't declared to throw anything, so we disregard // the return value. - ::closesocket (fnum); - fnum = -1; + ::closesocket (native_fd); + native_fd = -1; timeout = 0; } @@ -297,7 +297,7 @@ gnu::java::net::PlainDatagramSocketImpl::send (::java::net::DatagramPacket *p) else throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::sendto (fnum, (char *) dbytes, p->getLength(), 0, ptr, len) >= 0) + if (::sendto (native_fd, (char *) dbytes, p->getLength(), 0, ptr, len) >= 0) return; DWORD dwErrorCode = WSAGetLastError (); @@ -321,14 +321,14 @@ gnu::java::net::PlainDatagramSocketImpl::receive (::java::net::DatagramPacket *p // This implementation doesn't allow specifying an infinite // timeout after specifying a finite one, but Sun's JDK 1.4.1 // didn't seem to allow this either.... - int nRet= ::setsockopt(fnum, SOL_SOCKET, SO_RCVTIMEO, + int nRet= ::setsockopt(native_fd, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)); if (nRet != NO_ERROR) goto error; } retlen = - ::recvfrom (fnum, (char *) dbytes, p->getLength(), 0, (sockaddr*) &u, + ::recvfrom (native_fd, (char *) dbytes, p->getLength(), 0, (sockaddr*) &u, &addrlen); if (retlen < 0) goto error; @@ -374,7 +374,7 @@ gnu::java::net::PlainDatagramSocketImpl::setTimeToLive (jint ttl) char val = (char) ttl; socklen_t val_len = sizeof(val); - if (::setsockopt (fnum, IPPROTO_IP, IP_MULTICAST_TTL, &val, val_len) == 0) + if (::setsockopt (native_fd, IPPROTO_IP, IP_MULTICAST_TTL, &val, val_len) == 0) return; _Jv_ThrowIOException (); @@ -387,7 +387,7 @@ gnu::java::net::PlainDatagramSocketImpl::getTimeToLive () char val; socklen_t val_len = sizeof(val); - if (::getsockopt (fnum, IPPROTO_IP, IP_MULTICAST_TTL, &val, &val_len) == 0) + if (::getsockopt (native_fd, IPPROTO_IP, IP_MULTICAST_TTL, &val, &val_len) == 0) return ((int) val) & 0xFF; _Jv_ThrowIOException (); @@ -446,7 +446,7 @@ gnu::java::net::PlainDatagramSocketImpl::mcastGrp (::java::net::InetAddress *ine else throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::setsockopt (fnum, level, opname, ptr, len) == 0) + if (::setsockopt (native_fd, level, opname, ptr, len) == 0) return; _Jv_ThrowIOException (); @@ -459,7 +459,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, int val; socklen_t val_len = sizeof (val); - if (fnum < 0) + if (native_fd < 0) throw new ::java::net::SocketException (JvNewStringUTF ("Socket closed")); if (_Jv_IsInstanceOf (value, &::java::lang::Boolean::class$)) @@ -492,7 +492,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, return; case _Jv_SO_BROADCAST_ : - if (::setsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &val, val_len) != 0) goto error; break; @@ -506,11 +506,11 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, case _Jv_SO_RCVBUF_ : int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, val_len) != 0) + if (::setsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, val_len) != 0) goto error; return; case _Jv_SO_REUSEADDR_ : - if (::setsockopt (fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, val_len) != 0) goto error; return; @@ -552,7 +552,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); - if (::setsockopt (fnum, level, opname, ptr, len) != 0) + if (::setsockopt (native_fd, level, opname, ptr, len) != 0) goto error; return; @@ -567,7 +567,7 @@ gnu::java::net::PlainDatagramSocketImpl::setOption (jint optID, break; case _Jv_IP_TOS_ : - if (::setsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, val_len) != 0) goto error; return; @@ -607,7 +607,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) break; case _Jv_SO_BROADCAST_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean (val != 0); @@ -621,7 +621,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) case _Jv_SO_SNDBUF_ : int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::getsockopt (fnum, SOL_SOCKET, opt, (char *) &val, &val_len) != 0) + if (::getsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, &val_len) != 0) goto error; else return new ::java::lang::Integer (val); @@ -631,7 +631,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) if (localAddress == NULL) { jbyteArray laddr; - if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != 0) + if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) != 0) goto error; if (u.address.sin_family == AF_INET) { @@ -653,7 +653,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) return localAddress; break; case _Jv_SO_REUSEADDR_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean (val != 0); @@ -664,7 +664,7 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) char *bytes; inaddr_len = sizeof(inaddr); - if (::getsockopt (fnum, IPPROTO_IP, IP_MULTICAST_IF, (char *) &inaddr, + if (::getsockopt (native_fd, IPPROTO_IP, IP_MULTICAST_IF, (char *) &inaddr, &inaddr_len) != 0) goto error; @@ -682,13 +682,13 @@ gnu::java::net::PlainDatagramSocketImpl::getOption (jint optID) break; case _Jv_IP_MULTICAST_LOOP_ : - if (::getsockopt (fnum, SOL_SOCKET, IP_MULTICAST_LOOP, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, IP_MULTICAST_LOOP, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean (val != 0); case _Jv_IP_TOS_ : - if (::getsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Integer (val); diff --git a/libjava/gnu/java/net/natPlainSocketImplPosix.cc b/libjava/gnu/java/net/natPlainSocketImplPosix.cc index d73b077a9be..8a09f9af595 100644 --- a/libjava/gnu/java/net/natPlainSocketImplPosix.cc +++ b/libjava/gnu/java/net/natPlainSocketImplPosix.cc @@ -73,9 +73,9 @@ gnu::java::net::PlainSocketImpl::create (jboolean stream) _Jv_platform_close_on_exec (sock); - // We use fnum in place of fd here. From leaving fd null we avoid + // We use native_fd in place of fd here. From leaving fd null we avoid // the double close problem in FileDescriptor.finalize. - fnum = sock; + native_fd = sock; } void @@ -113,16 +113,16 @@ gnu::java::net::PlainSocketImpl::bind (::java::net::InetAddress *host, jint lpor throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); // Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT. - ::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i)); + ::setsockopt(native_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i)); - if (_Jv_bind (fnum, ptr, len) == 0) + if (_Jv_bind (native_fd, ptr, len) == 0) { address = host; socklen_t addrlen = sizeof(u); if (lport != 0) localport = lport; - else if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0) + else if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) == 0) localport = ntohs (u.address.sin_port); else goto error; @@ -170,31 +170,31 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, if (timeout > 0) { - int flags = ::fcntl (fnum, F_GETFL); - ::fcntl (fnum, F_SETFL, flags | O_NONBLOCK); + int flags = ::fcntl (native_fd, F_GETFL); + ::fcntl (native_fd, F_SETFL, flags | O_NONBLOCK); - if ((_Jv_connect (fnum, ptr, len) != 0) && (errno != EINPROGRESS)) + if ((_Jv_connect (native_fd, ptr, len) != 0) && (errno != EINPROGRESS)) goto error; fd_set fset; struct timeval tv; FD_ZERO(&fset); - FD_SET(fnum, &fset); + FD_SET(native_fd, &fset); tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; int retval; - if ((retval = _Jv_select (fnum + 1, &fset, &fset, NULL, &tv)) < 0) + if ((retval = _Jv_select (native_fd + 1, &fset, &fset, NULL, &tv)) < 0) goto error; else if (retval == 0) throw new ::java::net::SocketTimeoutException (JvNewStringUTF ("Connect timed out")); // Set the socket back into a blocking state. - ::fcntl (fnum, F_SETFL, flags); + ::fcntl (native_fd, F_SETFL, flags); } else { - if (_Jv_connect (fnum, ptr, len) != 0) + if (_Jv_connect (native_fd, ptr, len) != 0) goto error; } @@ -204,7 +204,7 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, // A bind may not have been done on this socket; if so, set localport now. if (localport == 0) { - if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0) + if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) == 0) localport = ntohs (u.address.sin_port); else goto error; @@ -220,7 +220,7 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, void gnu::java::net::PlainSocketImpl::listen (jint backlog) { - if (::listen (fnum, backlog) != 0) + if (::listen (native_fd, backlog) != 0) { char* strerr = strerror (errno); throw new ::java::io::IOException (JvNewStringUTF (strerr)); @@ -235,23 +235,23 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s) int new_socket = 0; // Do timeouts via select since SO_RCVTIMEO is not always available. - if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE) + if (timeout > 0 && native_fd >= 0 && native_fd < FD_SETSIZE) { fd_set fset; struct timeval tv; FD_ZERO(&fset); - FD_SET(fnum, &fset); + FD_SET(native_fd, &fset); tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; int retval; - if ((retval = _Jv_select (fnum + 1, &fset, &fset, NULL, &tv)) < 0) + if ((retval = _Jv_select (native_fd + 1, &fset, &fset, NULL, &tv)) < 0) goto error; else if (retval == 0) throw new ::java::net::SocketTimeoutException ( JvNewStringUTF("Accept timed out")); } - new_socket = _Jv_accept (fnum, (sockaddr*) &u, &addrlen); + new_socket = _Jv_accept (native_fd, (sockaddr*) &u, &addrlen); if (new_socket < 0) goto error; @@ -277,7 +277,7 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s) else throw new ::java::net::SocketException (JvNewStringUTF ("invalid family")); - s->fnum = new_socket; + s->native_fd = new_socket; s->localport = localport; s->address = new ::java::net::InetAddress (raddr, NULL); s->port = rport; @@ -296,7 +296,7 @@ gnu::java::net::PlainSocketImpl::close() JvSynchronize sync (this); // should we use shutdown here? how would that effect so_linger? - int res = _Jv_close (fnum); + int res = _Jv_close (native_fd); if (res == -1) { @@ -306,7 +306,7 @@ gnu::java::net::PlainSocketImpl::close() throw new ::java::io::IOException (JvNewStringUTF (strerror (errno))); } // Safe place to reset the file pointer. - fnum = -1; + native_fd = -1; timeout = 0; } @@ -319,7 +319,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jint b) while (r != 1) { - r = _Jv_write (this$0->fnum, &d, 1); + r = _Jv_write (this$0->native_fd, &d, 1); if (r == -1) { if (::java::lang::Thread::interrupted()) @@ -352,7 +352,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, jint off while (len > 0) { - int r = _Jv_write (this$0->fnum, bytes, len); + int r = _Jv_write (this$0->native_fd, bytes, len); if (r == -1) { @@ -389,22 +389,22 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(void) { jbyte b; jint timeout = this$0->timeout; - jint fnum = this$0->fnum; + jint native_fd = this$0->native_fd; // Do timeouts via select. - if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE) + if (timeout > 0 && native_fd >= 0 && native_fd < FD_SETSIZE) { // Create the file descriptor set. fd_set read_fds; FD_ZERO (&read_fds); - FD_SET (fnum,&read_fds); + FD_SET (native_fd,&read_fds); // Create the timeout struct based on our internal timeout value. struct timeval timeout_value; timeout_value.tv_sec = timeout / 1000; timeout_value.tv_usec = (timeout % 1000) * 1000; // Select on the fds. int sel_retval = - _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value); + _Jv_select (native_fd + 1, &read_fds, NULL, NULL, &timeout_value); // If select returns 0 we've waited without getting data... // that means we've timed out. if (sel_retval == 0) @@ -414,7 +414,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(void) // either way we need to try to read. } - int r = _Jv_read (fnum, &b, 1); + int r = _Jv_read (native_fd, &b, 1); if (r == 0) return -1; @@ -445,7 +445,7 @@ jint gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jint offset, jint count) { - jint fnum = this$0->fnum; + jint native_fd = this$0->native_fd; jint timeout = this$0->timeout; if (! buffer) @@ -459,19 +459,19 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jint jbyte *bytes = elements (buffer) + offset; // Do timeouts via select. - if (timeout > 0 && fnum >= 0 && fnum < FD_SETSIZE) + if (timeout > 0 && native_fd >= 0 && native_fd < FD_SETSIZE) { // Create the file descriptor set. fd_set read_fds; FD_ZERO (&read_fds); - FD_SET (fnum, &read_fds); + FD_SET (native_fd, &read_fds); // Create the timeout struct based on our internal timeout value. struct timeval timeout_value; timeout_value.tv_sec = timeout / 1000; timeout_value.tv_usec =(timeout % 1000) * 1000; // Select on the fds. int sel_retval = - _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value); + _Jv_select (native_fd + 1, &read_fds, NULL, NULL, &timeout_value); // We're only interested in the 0 return. // error returns still require us to try to read // the socket to see what happened. @@ -485,7 +485,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jint } // Read the socket. - int r = ::recv (fnum, (char *) bytes, count, 0); + int r = ::recv (native_fd, (char *) bytes, count, 0); if (r == 0) return -1; @@ -521,7 +521,7 @@ gnu::java::net::PlainSocketImpl::available(void) bool num_set = false; #if defined(FIONREAD) - r = ::ioctl (fnum, FIONREAD, &num); + r = ::ioctl (native_fd, FIONREAD, &num); if (r == -1 && errno == ENOTTY) { @@ -532,7 +532,7 @@ gnu::java::net::PlainSocketImpl::available(void) else num_set = true; #elif defined(HAVE_SELECT) - if (fnum < 0) + if (native_fd < 0) { errno = EBADF; r = -1; @@ -549,15 +549,15 @@ gnu::java::net::PlainSocketImpl::available(void) #if defined(HAVE_SELECT) if (! num_set) - if (! num_set && fnum >= 0 && fnum < FD_SETSIZE) + if (! num_set && native_fd >= 0 && native_fd < FD_SETSIZE) { fd_set rd; FD_ZERO (&rd); - FD_SET (fnum, &rd); + FD_SET (native_fd, &rd); struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 0; - r = _Jv_select (fnum + 1, &rd, NULL, NULL, &tv); + r = _Jv_select (native_fd + 1, &rd, NULL, NULL, &tv); if(r == -1) goto posix_error; num = r == 0 ? 0 : 1; @@ -576,7 +576,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va int val; socklen_t val_len = sizeof (val); - if (fnum < 0) + if (native_fd < 0) throw new ::java::net::SocketException (JvNewStringUTF ("Socket closed")); if (_Jv_IsInstanceOf (value, &::java::lang::Boolean::class$)) @@ -609,7 +609,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va { case _Jv_TCP_NODELAY_ : #ifdef TCP_NODELAY - if (::setsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val, + if (::setsockopt (native_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &val, val_len) != 0) goto error; #else @@ -619,7 +619,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va return; case _Jv_SO_KEEPALIVE_ : - if (::setsockopt (fnum, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, val_len) != 0) goto error; break; @@ -630,7 +630,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va break; case _Jv_SO_OOBINLINE_ : - if (::setsockopt (fnum, SOL_SOCKET, SO_OOBINLINE, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_OOBINLINE, (char *) &val, val_len) != 0) goto error; break; @@ -641,7 +641,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va l_val.l_onoff = (val != -1); l_val.l_linger = val; - if (::setsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_LINGER, (char *) &l_val, sizeof(l_val)) != 0) goto error; #else @@ -655,7 +655,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va #if defined(SO_SNDBUF) && defined(SO_RCVBUF) int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, val_len) != 0) + if (::setsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, val_len) != 0) goto error; #else throw new ::java::lang::InternalError ( @@ -684,7 +684,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va break; case _Jv_IP_TOS_ : - if (::setsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, val_len) != 0) goto error; break; @@ -721,7 +721,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) { #ifdef TCP_NODELAY case _Jv_TCP_NODELAY_ : - if (::getsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val, + if (::getsockopt (native_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &val, &val_len) != 0) goto error; else @@ -734,7 +734,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) case _Jv_SO_LINGER_ : #ifdef SO_LINGER - if (::getsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_LINGER, (char *) &l_val, &l_val_len) != 0) goto error; @@ -749,20 +749,20 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) break; case _Jv_SO_KEEPALIVE_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, &val_len) != 0) goto error; else return new ::java::lang::Boolean (val != 0); case _Jv_SO_BROADCAST_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean ((jboolean)val); case _Jv_SO_OOBINLINE_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_OOBINLINE, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_OOBINLINE, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Boolean ((jboolean)val); @@ -772,7 +772,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) #if defined(SO_SNDBUF) && defined(SO_RCVBUF) int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::getsockopt (fnum, SOL_SOCKET, opt, (char *) &val, &val_len) != 0) + if (::getsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, &val_len) != 0) goto error; else return new ::java::lang::Integer (val); @@ -787,7 +787,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) { jbyteArray laddr; - if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != 0) + if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) != 0) goto error; if (u.address.sin_family == AF_INET) @@ -826,7 +826,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) break; case _Jv_IP_TOS_ : - if (::getsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, &val_len) != 0) goto error; return new ::java::lang::Integer (val); @@ -853,13 +853,13 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) void gnu::java::net::PlainSocketImpl::shutdownInput (void) { - if (::shutdown (fnum, 0)) + if (::shutdown (native_fd, 0)) throw new ::java::net::SocketException (JvNewStringUTF (strerror (errno))); } void gnu::java::net::PlainSocketImpl::shutdownOutput (void) { - if (::shutdown (fnum, 1)) + if (::shutdown (native_fd, 1)) throw new ::java::net::SocketException (JvNewStringUTF (strerror (errno))); } diff --git a/libjava/gnu/java/net/natPlainSocketImplWin32.cc b/libjava/gnu/java/net/natPlainSocketImplWin32.cc index 57607e85696..411acfa023a 100644 --- a/libjava/gnu/java/net/natPlainSocketImplWin32.cc +++ b/libjava/gnu/java/net/natPlainSocketImplWin32.cc @@ -54,9 +54,9 @@ gnu::java::net::PlainSocketImpl::create (jboolean stream) _Jv_platform_close_on_exec (sock); - // We use fnum in place of fd here. From leaving fd null we avoid + // We use native_fd in place of fd here. From leaving fd null we avoid // the double close problem in FileDescriptor.finalize. - fnum = sock; + native_fd = sock; } void @@ -94,16 +94,16 @@ gnu::java::net::PlainSocketImpl::bind (::java::net::InetAddress *host, jint lpor throw new ::java::net::SocketException (JvNewStringUTF ("invalid length")); // Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT. - ::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i)); + ::setsockopt(native_fd, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i)); - if (::bind (fnum, ptr, len) != SOCKET_ERROR) + if (::bind (native_fd, ptr, len) != SOCKET_ERROR) { address = host; socklen_t addrlen = sizeof(u); if (lport != 0) localport = lport; - else if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != SOCKET_ERROR) + else if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) != SOCKET_ERROR) localport = ntohs (u.address.sin_port); else goto error; @@ -165,10 +165,10 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, if (timeout > 0) { // FIXME: we're creating a fresh WSAEVENT for each connect(). - WSAEventWrapper aWSAEventWrapper(fnum, FD_CONNECT); + WSAEventWrapper aWSAEventWrapper(native_fd, FD_CONNECT); WSAEVENT hEvent = aWSAEventWrapper.getEventHandle (); - if (::connect (fnum, ptr, len) == SOCKET_ERROR) + if (::connect (native_fd, ptr, len) == SOCKET_ERROR) { if (WSAGetLastError () != WSAEWOULDBLOCK) throwConnectException (); @@ -189,7 +189,7 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, // connect() succeeded. Use any socket-specific error code // instead of the thread-based one. int nErrCode; int nErrLen=sizeof(nErrCode); - if (::getsockopt(fnum, SOL_SOCKET, SO_ERROR, (char*) &nErrCode, + if (::getsockopt(native_fd, SOL_SOCKET, SO_ERROR, (char*) &nErrCode, &nErrLen) == SOCKET_ERROR) { throwConnectException (); @@ -203,7 +203,7 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, } else { - if (::connect (fnum, ptr, len) == SOCKET_ERROR) + if (::connect (native_fd, ptr, len) == SOCKET_ERROR) throwConnectException(); } @@ -213,7 +213,7 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, // A bind may not have been done on this socket; if so, set localport now. if (localport == 0) { - if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != SOCKET_ERROR) + if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) != SOCKET_ERROR) localport = ntohs (u.address.sin_port); else throwConnectException(); @@ -223,7 +223,7 @@ gnu::java::net::PlainSocketImpl::connect (::java::net::SocketAddress *addr, void gnu::java::net::PlainSocketImpl::listen (jint backlog) { - if (::listen (fnum, backlog) == SOCKET_ERROR) + if (::listen (native_fd, backlog) == SOCKET_ERROR) { _Jv_ThrowIOException (); } @@ -239,15 +239,15 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s) if (timeout > 0) { // FIXME: we're creating a fresh WSAEVENT for each accept(). - // One possible alternative would be that fnum really points + // One possible alternative would be that native_fd really points // to an extended structure consisting of the SOCKET, its // associated WSAEVENT, etc. - WSAEventWrapper aWSAEventWrapper(fnum, FD_ACCEPT); + WSAEventWrapper aWSAEventWrapper(native_fd, FD_ACCEPT); WSAEVENT hEvent = aWSAEventWrapper.getEventHandle (); for (;;) { - new_socket = ::accept (fnum, (sockaddr*) &u, &addrlen); + new_socket = ::accept (native_fd, (sockaddr*) &u, &addrlen); if (new_socket != int(INVALID_SOCKET)) { @@ -285,7 +285,7 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s) } else { - new_socket = ::accept (fnum, (sockaddr*) &u, &addrlen); + new_socket = ::accept (native_fd, (sockaddr*) &u, &addrlen); } if (new_socket == int(INVALID_SOCKET)) @@ -312,7 +312,7 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s) else throw new ::java::net::SocketException (JvNewStringUTF ("invalid family")); - s->fnum = new_socket; + s->native_fd = new_socket; s->localport = localport; s->address = new ::java::net::InetAddress (raddr, NULL); s->port = rport; @@ -330,7 +330,7 @@ gnu::java::net::PlainSocketImpl::close() JvSynchronize sync (this); // should we use shutdown here? how would that effect so_linger? - int res = ::closesocket (fnum); + int res = ::closesocket (native_fd); if (res == -1) { @@ -342,7 +342,7 @@ gnu::java::net::PlainSocketImpl::close() _Jv_ThrowIOException (); } // Safe place to reset the file pointer. - fnum = -1; + native_fd = -1; timeout = 0; } @@ -355,7 +355,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jint b) while (r != 1) { - r = ::send (this$0->fnum, (char*) &d, 1, 0); + r = ::send (this$0->native_fd, (char*) &d, 1, 0); if (r == -1) { DWORD dwErr = WSAGetLastError(); @@ -390,7 +390,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, int written = 0; while (len > 0) { - int r = ::send (this$0->fnum, (char*) bytes, len, 0); + int r = ::send (this$0->native_fd, (char*) bytes, len, 0); if (r == -1) { @@ -425,7 +425,7 @@ gnu::java::net::PlainSocketImpl::sendUrgentData (jint) // read() helper static jint -doRead(int fnum, void* buf, int count, int timeout) +doRead(int native_fd, void* buf, int count, int timeout) { int r = 0; DWORD dwErrorCode = 0; @@ -438,7 +438,7 @@ doRead(int fnum, void* buf, int count, int timeout) // gone from a non-zero to zero timeout. What we'd // really need is a member state variable in addition // to timeout - int nRet= ::setsockopt(fnum, SOL_SOCKET, SO_RCVTIMEO, + int nRet= ::setsockopt(native_fd, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)); if (nRet != NO_ERROR) { @@ -446,7 +446,7 @@ doRead(int fnum, void* buf, int count, int timeout) goto error; } - r = ::recv (fnum, (char*) buf, count, 0); + r = ::recv (native_fd, (char*) buf, count, 0); if (r == 0) return -1; @@ -485,7 +485,7 @@ jint gnu::java::net::PlainSocketImpl$SocketInputStream::read(void) { jbyte b; - doRead(this$0->fnum, &b, 1, this$0->timeout); + doRead(this$0->native_fd, &b, 1, this$0->timeout); return b & 0xFF; } @@ -505,7 +505,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jbyte *bytes = elements (buffer) + offset; // Read the socket. - return doRead(this$0->fnum, bytes, count, this$0->timeout); + return doRead(this$0->native_fd, bytes, count, this$0->timeout); } // How many bytes are available? @@ -514,7 +514,7 @@ gnu::java::net::PlainSocketImpl::available(void) { unsigned long num = 0; - if (::ioctlsocket (fnum, FIONREAD, &num) == SOCKET_ERROR) + if (::ioctlsocket (native_fd, FIONREAD, &num) == SOCKET_ERROR) _Jv_ThrowIOException (); return (jint) num; @@ -526,7 +526,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va int val; socklen_t val_len = sizeof (val); - if (fnum < 0) + if (native_fd < 0) throw new ::java::net::SocketException (JvNewStringUTF ("Socket closed")); if (_Jv_IsInstanceOf (value, &::java::lang::Boolean::class$)) @@ -558,13 +558,13 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va switch (optID) { case _Jv_TCP_NODELAY_ : - if (::setsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val, + if (::setsockopt (native_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &val, val_len) == SOCKET_ERROR) goto error; return; case _Jv_SO_KEEPALIVE_ : - if (::setsockopt (fnum, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, val_len) == SOCKET_ERROR) goto error; break; @@ -575,7 +575,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va break; case _Jv_SO_OOBINLINE_ : - if (::setsockopt (fnum, SOL_SOCKET, SO_OOBINLINE, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_OOBINLINE, (char *) &val, val_len) == SOCKET_ERROR) goto error; break; @@ -585,7 +585,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va l_val.l_onoff = (val != -1); l_val.l_linger = val; - if (::setsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val, + if (::setsockopt (native_fd, SOL_SOCKET, SO_LINGER, (char *) &l_val, sizeof(l_val)) == SOCKET_ERROR) goto error; return; @@ -594,7 +594,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va case _Jv_SO_RCVBUF_ : int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, val_len) == SOCKET_ERROR) goto error; return; @@ -620,7 +620,7 @@ gnu::java::net::PlainSocketImpl::setOption (jint optID, ::java::lang::Object *va break; case _Jv_IP_TOS_ : - if (::setsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::setsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, val_len) == SOCKET_ERROR) goto error; break; @@ -655,7 +655,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) switch (optID) { case _Jv_TCP_NODELAY_ : - if (::getsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val, + if (::getsockopt (native_fd, IPPROTO_TCP, TCP_NODELAY, (char *) &val, &val_len) == SOCKET_ERROR) goto error; else @@ -663,7 +663,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) break; case _Jv_SO_LINGER_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_LINGER, (char *) &l_val, &l_val_len) == SOCKET_ERROR) goto error; @@ -674,20 +674,20 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) break; case _Jv_SO_KEEPALIVE_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &val, &val_len) == SOCKET_ERROR) goto error; else return new ::java::lang::Boolean (val != 0); case _Jv_SO_BROADCAST_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_BROADCAST, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_BROADCAST, (char *) &val, &val_len) == SOCKET_ERROR) goto error; return new ::java::lang::Boolean ((jboolean)val); case _Jv_SO_OOBINLINE_ : - if (::getsockopt (fnum, SOL_SOCKET, SO_OOBINLINE, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, SO_OOBINLINE, (char *) &val, &val_len) == SOCKET_ERROR) goto error; return new ::java::lang::Boolean ((jboolean)val); @@ -696,7 +696,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) case _Jv_SO_SNDBUF_ : int opt; optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF; - if (::getsockopt (fnum, SOL_SOCKET, opt, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, opt, (char *) &val, &val_len) == SOCKET_ERROR) goto error; else @@ -708,7 +708,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) { jbyteArray laddr; - if (::getsockname (fnum, (sockaddr*) &u, + if (::getsockname (native_fd, (sockaddr*) &u, &addrlen) == SOCKET_ERROR) goto error; @@ -748,7 +748,7 @@ gnu::java::net::PlainSocketImpl::getOption (jint optID) break; case _Jv_IP_TOS_ : - if (::getsockopt (fnum, SOL_SOCKET, IP_TOS, (char *) &val, + if (::getsockopt (native_fd, SOL_SOCKET, IP_TOS, (char *) &val, &val_len) == SOCKET_ERROR) goto error; return new ::java::lang::Integer (val); @@ -776,13 +776,13 @@ error: void gnu::java::net::PlainSocketImpl::shutdownInput (void) { - if (::shutdown (fnum, 0)) + if (::shutdown (native_fd, 0)) _Jv_ThrowSocketException (); } void gnu::java::net::PlainSocketImpl::shutdownOutput (void) { - if (::shutdown (fnum, 1)) + if (::shutdown (native_fd, 1)) _Jv_ThrowSocketException (); } diff --git a/libjava/gnu/java/net/protocol/file/Connection.java b/libjava/gnu/java/net/protocol/file/Connection.java index 3bddd0ffe13..1df5c487c88 100644 --- a/libjava/gnu/java/net/protocol/file/Connection.java +++ b/libjava/gnu/java/net/protocol/file/Connection.java @@ -1,15 +1,45 @@ -// Connection.java - Implementation of URLConnection for file protocol. - -/* Copyright (C) 1999 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ - +/* + FileURLConnection.java -- URLConnection class for "file" protocol + Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + + GNU Classpath is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GNU Classpath is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Classpath; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. +*/ package gnu.java.net.protocol.file; +import java.net.URL; +import java.net.URLConnection; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; @@ -19,8 +49,6 @@ import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.ProtocolException; -import java.net.URL; -import java.net.URLConnection; import java.util.Map; import java.util.Vector; import java.util.Hashtable; @@ -30,14 +58,7 @@ import java.util.Enumeration; * @author Warren Levy <warrenl@cygnus.com> * @date April 13, 1999. */ - -/** - * Written using on-line Java Platform 1.2 API Specification, as well - * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). - * Status: Minimal subset of functionality. - */ - -class Connection extends URLConnection +public class Connection extends URLConnection { private Hashtable hdrHash = new Hashtable(); private Vector hdrVec = new Vector(); @@ -48,16 +69,18 @@ class Connection extends URLConnection public Connection(URL url) { - super(url); + super (url); } - - // Implementation of abstract method. + + /** + * "Connects" to the file by opening it. + */ public void connect() throws IOException { // Call is ignored if already connected. if (connected) return; - + // If not connected, then file needs to be openned. String fname = url.getFile(); fileIn = new File(fname); @@ -65,21 +88,37 @@ class Connection extends URLConnection inputStream = new BufferedInputStream(new FileInputStream(fileIn)); if (doOutput) outputStream = new BufferedOutputStream(new FileOutputStream(fileIn)); + connected = true; } - - public InputStream getInputStream() throws IOException + + /** + * Opens the file for reading and returns a stream for it. + * + * @return An InputStream for this connection. + * + * @exception IOException If an error occurs + */ + public InputStream getInputStream() + throws IOException { if (! doInput) throw new ProtocolException("Can't open InputStream if doInput is false"); if (!connected) connect(); - + return inputStream; } - // Override default method in URLConnection. - public OutputStream getOutputStream() throws IOException + /** + * Opens the file for writing and returns a stream for it. + * + * @return An OutputStream for this connection. + * + * @exception IOException If an error occurs. + */ + public OutputStream getOutputStream() + throws IOException { if (! doOutput) throw new @@ -87,7 +126,7 @@ class Connection extends URLConnection if (!connected) connect(); - + return outputStream; } @@ -98,7 +137,7 @@ class Connection extends URLConnection { getHeaders(); } - catch (IOException x) + catch (IOException e) { return null; } @@ -112,7 +151,7 @@ class Connection extends URLConnection { getHeaders(); } - catch (IOException x) + catch (IOException e) { return null; } @@ -198,4 +237,5 @@ class Connection extends URLConnection String key = getKey(line); hdrHash.put(key.toLowerCase(), Long.toString(len)); } -} + +} // class FileURLConnection diff --git a/libjava/gnu/java/net/protocol/file/Handler.java b/libjava/gnu/java/net/protocol/file/Handler.java index f85db447b59..7470d17f20a 100644 --- a/libjava/gnu/java/net/protocol/file/Handler.java +++ b/libjava/gnu/java/net/protocol/file/Handler.java @@ -1,12 +1,39 @@ -// Handler.java - URLStreamHandler for file protocol. +/* Handler.java -- "file" protocol handler for java.net + Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. -/* Copyright (C) 1999, 2000 Free Software Foundation +This file is part of GNU Classpath. - This file is part of libgcj. +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.net.protocol.file; @@ -16,16 +43,14 @@ import java.net.URLConnection; import java.net.URLStreamHandler; /** + * This is the protocol handler for the "file" protocol. + * It implements the abstract openConnection() method from + * URLStreamHandler by returning a new FileURLConnection object (from + * this package). All other methods are inherited + * + * @author Aaron M. Renn (arenn@urbanophile.com) * @author Warren Levy <warrenl@cygnus.com> - * @date April 13, 1999. */ - -/** - * Written using on-line Java Platform 1.2 API Specification, as well - * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). - * Status: Minimal functionality. - */ - public class Handler extends URLStreamHandler { protected URLConnection openConnection(URL url) throws IOException @@ -50,4 +75,4 @@ public class Handler extends URLStreamHandler return new Connection(url); } -} +} // class Handler diff --git a/libjava/gnu/java/net/protocol/http/Connection.java b/libjava/gnu/java/net/protocol/http/Connection.java index 85c7910a42c..7794bc7f2f7 100644 --- a/libjava/gnu/java/net/protocol/http/Connection.java +++ b/libjava/gnu/java/net/protocol/http/Connection.java @@ -1,12 +1,40 @@ -// Connection.java - Implementation of HttpURLConnection for http protocol. +/* HttpURLConnection.java -- URLConnection class for HTTP protocol + Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ -/* Copyright (C) 1999, 2000, 2003 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ package gnu.java.net.protocol.http; diff --git a/libjava/gnu/java/net/protocol/http/Handler.java b/libjava/gnu/java/net/protocol/http/Handler.java index e1184bbc4af..6f2ebb125d8 100644 --- a/libjava/gnu/java/net/protocol/http/Handler.java +++ b/libjava/gnu/java/net/protocol/http/Handler.java @@ -1,12 +1,39 @@ -// Handler.java - URLStreamHandler for http protocol. +/* Handler.java -- HTTP protocol handler for java.net + Copyright (c) 1998, 1999, 2003 Free Software Foundation, Inc. -/* Copyright (C) 1999, 2003 Free Software Foundation +This file is part of GNU Classpath. - This file is part of libgcj. +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.net.protocol.http; @@ -16,25 +43,44 @@ import java.net.URLConnection; import java.net.URLStreamHandler; /** - * Written using on-line Java Platform 1.2 API Specification, as well - * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). - * Status: Minimal functionality. - */ - -/** + * This is the protocol handler for the HTTP protocol. It implements + * the abstract openConnection() method from URLStreamHandler by returning + * a new HttpURLConnection object (from this package). All other + * methods are inherited + * + * @author Aaron M. Renn (arenn@urbanophile.com) * @author Warren Levy * @author Anthony Green <green@redhat.com> - * @date March 26, 1999. */ public class Handler extends URLStreamHandler { + /** + * A do nothing constructor + */ + public Handler() + { + } + + /** + * This method returs a new HttpURLConnection for the specified URL + * + * @param url The URL to return a connection for + * + * @return The URLConnection + * + * @exception IOException If an error occurs + */ protected URLConnection openConnection (URL url) throws IOException { return new Connection (url); } + /** + * Returns the default port for a URL parsed by this handler. + */ protected int getDefaultPort() { return 80; } -} + +} // class Handler diff --git a/libjava/gnu/java/net/protocol/jar/Connection.java b/libjava/gnu/java/net/protocol/jar/Connection.java index 19e8ab719c4..7d9d7cb48b2 100644 --- a/libjava/gnu/java/net/protocol/jar/Connection.java +++ b/libjava/gnu/java/net/protocol/jar/Connection.java @@ -1,17 +1,47 @@ -/* Copyright (C) 1999, 2002 Free Software Foundation +/* Connection - jar url connection for java.net + Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. - This file is part of libgcj. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ package gnu.java.net.protocol.jar; -import java.io.InputStream; -import java.io.IOException; import java.io.File; import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.IOException; import java.net.JarURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; @@ -28,7 +58,7 @@ import java.util.zip.ZipFile; * @author Kresten Krab Thorup <krab@gnu.org> * @date Aug 10, 1999. */ -public class Connection extends JarURLConnection +public class Connection extends JarURLConnection { static Hashtable file_cache = new Hashtable(); private JarFile jarfile; diff --git a/libjava/gnu/java/net/protocol/jar/Handler.java b/libjava/gnu/java/net/protocol/jar/Handler.java index e19a5cfc954..7bde053e20e 100644 --- a/libjava/gnu/java/net/protocol/jar/Handler.java +++ b/libjava/gnu/java/net/protocol/jar/Handler.java @@ -1,12 +1,40 @@ -// Handler.java - URLStreamHandler for file protocol. +/* gnu.java.net.protocol.jar.Handler - jar protocol handler for java.net + Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. -/* Copyright (C) 1999 Free Software Foundation +This file is part of GNU Classpath. - This file is part of libgcj. +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ package gnu.java.net.protocol.jar; diff --git a/libjava/gnu/java/nio/natPipeImpl.cc b/libjava/gnu/java/nio/natPipeImpl.cc index 522c24cc807..caae89cdd1a 100644 --- a/libjava/gnu/java/nio/natPipeImpl.cc +++ b/libjava/gnu/java/nio/natPipeImpl.cc @@ -26,7 +26,7 @@ gnu::java::nio::PipeImpl::nativeInit (::java::nio::channels::spi::SelectorProvid { int filedes [2]; - if (::pipe (filedes) < 0) + if (_Jv_pipe (filedes) < 0) throw new ::java::io::IOException (JvNewStringUTF (strerror (errno))); /* FIXME diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in index 70902622733..1934e6ac35b 100644 --- a/libjava/include/Makefile.in +++ b/libjava/include/Makefile.in @@ -76,6 +76,7 @@ DIVIDESPEC = @DIVIDESPEC@ DLLTOOL = @DLLTOOL@ EXCEPTIONSPEC = @EXCEPTIONSPEC@ EXEEXT = @EXEEXT@ +EXTRA_CC_FILES = @EXTRA_CC_FILES@ GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@ GCDEPS = @GCDEPS@ GCINCS = @GCINCS@ diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in index 148fcad95ca..d05af6b6cdc 100644 --- a/libjava/include/config.h.in +++ b/libjava/include/config.h.in @@ -353,6 +353,9 @@ /* Define if you have the 'localtime_r' function. */ #undef HAVE_LOCALTIME_R +/* Define if usleep is declared in <unistd.h>. */ +#undef HAVE_USLEEP_DECL + /* Define if using POSIX threads that have the mutexattr functions. */ #undef HAVE_PTHREAD_MUTEXATTR_INIT @@ -365,6 +368,9 @@ /* Define if your platform has a working backtrace() function. */ #undef HAVE_BACKTRACE +/* Define if your platform has a working backtrace() function. */ +#undef HAVE_BACKTRACE + /* Define if you have dladdr() */ #undef HAVE_DLADDR diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h index c801274f4cb..94acfae281f 100644 --- a/libjava/include/java-interp.h +++ b/libjava/include/java-interp.h @@ -88,6 +88,12 @@ protected: // Size of raw arguments. _Jv_ushort args_raw_size; + // Chain of addresses to fill in. See _Jv_Defer_Resolution. + void *deferred; + + friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **); + friend void _Jv_PrepareClass(jclass); + public: _Jv_Method *get_method () { @@ -167,8 +173,33 @@ class _Jv_InterpClass : public java::lang::Class #endif friend _Jv_MethodBase ** _Jv_GetFirstMethod (_Jv_InterpClass *klass); + friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **); }; +// We have an interpreted class CL and we're trying to find the +// address of the ncode of a method METH. That interpreted class +// hasn't yet been prepared, so we defer fixups until they are ready. +// To do this, we create a chain of fixups that will be resolved by +// _Jv_PrepareClass. +extern inline void +_Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **address) +{ + int i; + _Jv_InterpClass *self = (_Jv_InterpClass *)cl; + for (i = 0; i < self->method_count; i++) + { + _Jv_Method *m = &self->methods[i]; + if (m == meth) + { + _Jv_MethodBase *imeth = self->interpreted_methods[i]; + *address = imeth->deferred; + imeth->deferred = address; + return; + } + } + return; +} + extern inline _Jv_MethodBase ** _Jv_GetFirstMethod (_Jv_InterpClass *klass) { diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index b28f61a0e97..e1a5c33bbc6 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -335,6 +335,14 @@ _Jv_VTable::new_vtable (int count) return (_Jv_VTable *) _Jv_AllocBytes (size); } +// Determine if METH gets an entry in a VTable. +static inline jboolean _Jv_isVirtualMethod (_Jv_Method *meth) +{ + using namespace java::lang::reflect; + return (((meth->accflags & (Modifier::STATIC | Modifier::PRIVATE)) == 0) + && meth->name->data[0] != '<'); +} + // This function is used to determine the hash code of an object. inline jint _Jv_HashCode (jobject obj) @@ -418,6 +426,7 @@ extern void _Jv_CallAnyMethodA (jobject obj, jclass return_type, jmethodID meth, jboolean is_constructor, + jboolean is_virtual_call, JArray<jclass> *parameter_types, jvalue *args, jvalue *result, diff --git a/libjava/include/no-threads.h b/libjava/include/no-threads.h index 1cd2471b8cf..793cfadbf1b 100644 --- a/libjava/include/no-threads.h +++ b/libjava/include/no-threads.h @@ -75,6 +75,11 @@ _Jv_CondNotifyAll (_Jv_ConditionVariable_t *, _Jv_Mutex_t *) // Mutexes. // +inline int _Jv_MutexCheckMonitor (_Jv_Mutex_t *mu) +{ + return 0; +} + inline void _Jv_MutexInit (_Jv_Mutex_t *) { diff --git a/libjava/include/posix-threads.h b/libjava/include/posix-threads.h index 6c8dcec933c..01606df021f 100644 --- a/libjava/include/posix-threads.h +++ b/libjava/include/posix-threads.h @@ -77,12 +77,9 @@ typedef struct // this out. Returns 0 if the lock is held by the current thread, and // 1 otherwise. inline int -_Jv_PthreadCheckMonitor (_Jv_Mutex_t *mu) +_Jv_MutexCheckMonitor (_Jv_Mutex_t *mu) { - pthread_t self = pthread_self(); - if (mu->owner == self) - return 0; - else return 1; + return (mu->owner != pthread_self()); } // @@ -155,7 +152,7 @@ _Jv_MutexLock (_Jv_Mutex_t *mu) inline int _Jv_MutexUnlock (_Jv_Mutex_t *mu) { - if (_Jv_PthreadCheckMonitor (mu)) + if (_Jv_MutexCheckMonitor (mu)) { # ifdef LOCK_DEBUG fprintf(stderr, "_Jv_MutexUnlock: Not owner\n"); diff --git a/libjava/include/posix.h b/libjava/include/posix.h index 2c6054ec93c..c8cd5e25e28 100644 --- a/libjava/include/posix.h +++ b/libjava/include/posix.h @@ -178,4 +178,11 @@ _Jv_read(int s, void *buf, int len) #endif /* DISABLE_JAVA_NET */ +// Wraps ::pipe +static inline int +_Jv_pipe (int filedes[2]) +{ + return ::pipe (filedes); +} + #endif /* __JV_POSIX_H__ */ diff --git a/libjava/include/win32-threads.h b/libjava/include/win32-threads.h index ed5eb0047e0..fdd21c541b4 100644 --- a/libjava/include/win32-threads.h +++ b/libjava/include/win32-threads.h @@ -86,6 +86,12 @@ int _Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *); // We use CRITICAL_SECTIONs instead of CreateMutex() for better performance // +// Returns 0 if the mutex lock is held by the current thread, and 1 otherwise. +inline int _Jv_MutexCheckMonitor (_Jv_Mutex_t *mu) +{ + return (mu->owner != GetCurrentThreadId ( )); +} + inline void _Jv_MutexInit (_Jv_Mutex_t *mu) { mu->owner = 0UL; diff --git a/libjava/include/win32.h b/libjava/include/win32.h index 6da0eafaa9a..e169adf9b28 100644 --- a/libjava/include/win32.h +++ b/libjava/include/win32.h @@ -95,6 +95,7 @@ extern void _Jv_platform_initialize (void); extern void _Jv_platform_initProperties (java::util::Properties*); extern jlong _Jv_platform_gettimeofday (); extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int _Jv_pipe (int filedes[2]); inline void _Jv_platform_close_on_exec (jint) diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java index ad4aec70649..70d452bf2f7 100644 --- a/libjava/java/awt/Window.java +++ b/libjava/java/awt/Window.java @@ -144,13 +144,12 @@ public class Window extends Container implements Accessible { this (); - if (owner == null) - throw new IllegalArgumentException ("owner must not be null"); - - parent = owner; - - synchronized (owner.ownedWindows) + synchronized (getTreeLock()) { + if (owner == null) + throw new IllegalArgumentException ("owner must not be null"); + + parent = owner; owner.ownedWindows.add(new WeakReference(this)); } @@ -220,7 +219,7 @@ public class Window extends Container implements Accessible addNotify(); // Show visible owned windows. - synchronized (ownedWindows) + synchronized (getTreeLock()) { Iterator e = ownedWindows.iterator(); while(e.hasNext()) @@ -247,7 +246,7 @@ public class Window extends Container implements Accessible public void hide() { // Hide visible owned windows. - synchronized (ownedWindows) + synchronized (getTreeLock ()) { Iterator e = ownedWindows.iterator(); while(e.hasNext()) @@ -280,7 +279,7 @@ public class Window extends Container implements Accessible { hide(); - synchronized (ownedWindows) + synchronized (getTreeLock ()) { Iterator e = ownedWindows.iterator(); while(e.hasNext()) @@ -292,11 +291,15 @@ public class Window extends Container implements Accessible // Remove null weak reference from ownedWindows. e.remove(); } - } - for (int i = 0; i < ncomponents; ++i) - component[i].removeNotify(); - this.removeNotify(); + for (int i = 0; i < ncomponents; ++i) + component[i].removeNotify(); + this.removeNotify(); + + // Post a WINDOW_CLOSED event. + WindowEvent we = new WindowEvent(this, WindowEvent.WINDOW_CLOSED); + getToolkit().getSystemEventQueue().postEvent(we); + } } /** @@ -386,7 +389,7 @@ public class Window extends Container implements Accessible public Window[] getOwnedWindows() { Window [] trimmedList; - synchronized (ownedWindows) + synchronized (getTreeLock ()) { // Windows with non-null weak references in ownedWindows. Window [] validList = new Window [ownedWindows.size()]; @@ -479,7 +482,7 @@ public class Window extends Container implements Accessible */ public void addWindowFocusListener (WindowFocusListener wfl) { - AWTEventMulticaster.add (windowFocusListener, wfl); + windowFocusListener = AWTEventMulticaster.add (windowFocusListener, wfl); } /** @@ -489,7 +492,7 @@ public class Window extends Container implements Accessible */ public void addWindowStateListener (WindowStateListener wsl) { - AWTEventMulticaster.add (windowStateListener, wsl); + windowStateListener = AWTEventMulticaster.add (windowStateListener, wsl); } /** @@ -497,7 +500,7 @@ public class Window extends Container implements Accessible */ public void removeWindowFocusListener (WindowFocusListener wfl) { - AWTEventMulticaster.remove (windowFocusListener, wfl); + windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl); } /** @@ -507,7 +510,7 @@ public class Window extends Container implements Accessible */ public void removeWindowStateListener (WindowStateListener wsl) { - AWTEventMulticaster.remove (windowStateListener, wsl); + windowStateListener = AWTEventMulticaster.remove (windowStateListener, wsl); } /** @@ -532,7 +535,9 @@ public class Window extends Container implements Accessible // Make use of event id's in order to avoid multiple instanceof tests. if (e.id <= WindowEvent.WINDOW_LAST && e.id >= WindowEvent.WINDOW_FIRST - && (windowListener != null + && (windowListener != null + || windowFocusListener != null + || windowStateListener != null || (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0)) processEvent(e); else @@ -565,39 +570,51 @@ public class Window extends Container implements Accessible */ protected void processWindowEvent(WindowEvent evt) { - if (windowListener != null) + int id = evt.getID(); + + if (id == WindowEvent.WINDOW_GAINED_FOCUS + || id == WindowEvent.WINDOW_LOST_FOCUS) + processWindowFocusEvent (evt); + else if (id == WindowEvent.WINDOW_STATE_CHANGED) + processWindowStateEvent (evt); + else { - switch (evt.getID()) - { - case WindowEvent.WINDOW_ACTIVATED: - windowListener.windowActivated(evt); - break; - case WindowEvent.WINDOW_CLOSED: - windowListener.windowClosed(evt); - break; - case WindowEvent.WINDOW_CLOSING: - windowListener.windowClosing(evt); - break; - case WindowEvent.WINDOW_DEACTIVATED: - windowListener.windowDeactivated(evt); - break; - case WindowEvent.WINDOW_DEICONIFIED: - windowListener.windowDeiconified(evt); - break; - case WindowEvent.WINDOW_ICONIFIED: - windowListener.windowIconified(evt); - break; - case WindowEvent.WINDOW_OPENED: - windowListener.windowOpened(evt); - break; - case WindowEvent.WINDOW_GAINED_FOCUS: - case WindowEvent.WINDOW_LOST_FOCUS: - processWindowFocusEvent (evt); - break; - case WindowEvent.WINDOW_STATE_CHANGED: - processWindowStateEvent (evt); - break; - } + if (windowListener != null) + { + switch (evt.getID()) + { + case WindowEvent.WINDOW_ACTIVATED: + windowListener.windowActivated(evt); + break; + + case WindowEvent.WINDOW_CLOSED: + windowListener.windowClosed(evt); + break; + + case WindowEvent.WINDOW_CLOSING: + windowListener.windowClosing(evt); + break; + + case WindowEvent.WINDOW_DEACTIVATED: + windowListener.windowDeactivated(evt); + break; + + case WindowEvent.WINDOW_DEICONIFIED: + windowListener.windowDeiconified(evt); + break; + + case WindowEvent.WINDOW_ICONIFIED: + windowListener.windowIconified(evt); + break; + + case WindowEvent.WINDOW_OPENED: + windowListener.windowOpened(evt); + break; + + default: + break; + } + } } } diff --git a/libjava/java/awt/geom/GeneralPath.java b/libjava/java/awt/geom/GeneralPath.java index 6c1b578fc19..05d98c76238 100644 --- a/libjava/java/awt/geom/GeneralPath.java +++ b/libjava/java/awt/geom/GeneralPath.java @@ -1,5 +1,5 @@ /* GeneralPath.java -- represents a shape built from subpaths - Copyright (C) 2002 Free Software Foundation + Copyright (C) 2002, 2003 Free Software Foundation This file is part of GNU Classpath. @@ -128,7 +128,7 @@ public final class GeneralPath implements Shape, Cloneable float x3, float y3) { ensureSize(index + 6); - types[index >> 1] = PathIterator.SEG_QUADTO; + types[index >> 1] = PathIterator.SEG_CUBICTO; points[index++] = x1; points[index++] = y1; points[index++] = x2; @@ -148,40 +148,69 @@ public final class GeneralPath implements Shape, Cloneable { append(s.getPathIterator(null), connect); } - public void append(PathIterator i, boolean connect) + + + /** + * Appends the segments of a PathIterator to this GeneralPath. + * Optionally, the initial {@link PathIterator#SEG_MOVETO} segment + * of the appended path is changed into a {@link + * PathIterator#SEG_LINETO} segment. + * + * @param iter the PathIterator specifying which segments shall be + * appended. + * + * @param connect <code>true</code> for substituting the initial + * {@link PathIterator#SEG_MOVETO} segment by a {@link + * PathIterator#SEG_LINETO}, or <code>false</code> for not + * performing any substitution. If this GeneralPath is currently + * empty, <code>connect</code> is assumed to be <code>false</code>, + * thus leaving the initial {@link PathIterator#SEG_MOVETO} + * unchanged. + */ + public void append(PathIterator iter, boolean connect) { + // A bad implementation of this method had caused Classpath bug #6076. float[] f = new float[6]; - while (! i.isDone()) + while (!iter.isDone()) + { + switch (iter.currentSegment(f)) { - int result = i.currentSegment(f); - switch (result) - { - case PathIterator.SEG_MOVETO: - if (! connect) - { - moveTo(f[0], f[1]); - break; - } - if (subpath >= 0 && f[0] == points[subpath] - && f[1] == points[subpath + 1]) - break; - // Fallthrough. - case PathIterator.SEG_LINETO: - lineTo(f[0], f[1]); - break; - case PathIterator.SEG_QUADTO: - quadTo(f[0], f[1], f[2], f[3]); - break; - case PathIterator.SEG_CUBICTO: - curveTo(f[0], f[1], f[2], f[3], f[4], f[5]); - break; - default: - closePath(); - } - connect = false; + case PathIterator.SEG_MOVETO: + if (!connect || (index == 0)) + { + moveTo(f[0], f[1]); + break; + } + + if ((index >= 2) && (types[(index - 2) >> 2] == PathIterator.SEG_CLOSE) + && (f[0] == points[index - 2]) && (f[1] == points[index - 1])) + break; + + // Fall through. + + case PathIterator.SEG_LINETO: + lineTo(f[0], f[1]); + break; + + case PathIterator.SEG_QUADTO: + quadTo(f[0], f[1], f[2], f[3]); + break; + + case PathIterator.SEG_CUBICTO: + curveTo(f[0], f[1], f[2], f[3], f[4], f[5]); + break; + + case PathIterator.SEG_CLOSE: + closePath(); + break; } + + connect = false; + iter.next(); + } } + public int getWindingRule() { return rule; @@ -197,7 +226,7 @@ public final class GeneralPath implements Shape, Cloneable { if (subpath < 0) return null; - return new Point2D.Float(points[subpath], points[subpath + 1]); + return new Point2D.Float(points[index - 2], points[index - 1]); } public void reset() { @@ -254,80 +283,163 @@ public final class GeneralPath implements Shape, Cloneable { return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight()); } - public PathIterator getPathIterator(final AffineTransform at) + + + /** + * A PathIterator that iterates over the segments of a GeneralPath. + * + * @author Sascha Brawer (brawer@dandelis.ch) + */ + private static class GeneralPathIterator + implements PathIterator { - return new PathIterator() + /** + * The number of coordinate values for each segment type. + */ + private static final int[] NUM_COORDS = { - int current = 0; + /* 0: SEG_MOVETO */ 2, + /* 1: SEG_LINETO */ 2, + /* 2: SEG_QUADTO */ 4, + /* 3: SEG_CUBICTO */ 6, + /* 4: SEG_CLOSE */ 0 + }; - public int getWindingRule() - { - return rule; - } - public boolean isDone() - { - return current >= index; - } + /** + * The GeneralPath whose segments are being iterated. + */ + private final GeneralPath path; - public void next() - { - current++; - } - public int currentSegment(float[] coords) + /** + * The affine transformation used to transform coordinates. + */ + private final AffineTransform transform; + + + /** + * The current position of the iterator. + */ + private int pos; + + + /** + * Constructs a new iterator for enumerating the segments of a + * GeneralPath. + * + * @param at an affine transformation for projecting the returned + * points, or <code>null</code> to return the original points + * without any mapping. + */ + GeneralPathIterator(GeneralPath path, AffineTransform transform) + { + this.path = path; + this.transform = transform; + } + + + /** + * Returns the current winding rule of the GeneralPath. + */ + public int getWindingRule() + { + return path.rule; + } + + + /** + * Determines whether the iterator has reached the last segment in + * the path. + */ + public boolean isDone() + { + return pos >= path.index; + } + + + /** + * Advances the iterator position by one segment. + */ + public void next() + { + int seg; + + /* Increment pos by the number of coordinate values. Note that + * we store two values even for a SEG_CLOSE segment, which is + * why we increment pos at least by 2. + */ + seg = path.types[pos >> 1]; + if (seg == SEG_CLOSE) + pos += 2; + else + pos += NUM_COORDS[seg]; + } + + + /** + * Returns the current segment in float coordinates. + */ + public int currentSegment(float[] coords) + { + int seg, numCoords; + + seg = path.types[pos >> 1]; + numCoords = NUM_COORDS[seg]; + if (numCoords > 0) { - if (current >= index) - return SEG_CLOSE; - int result = types[current >> 1]; - int i = 0; - if (result == 3) - { - coords[i++] = points[current++]; - coords[i++] = points[current++]; - } - if (result == 2) - { - coords[i++] = points[current++]; - coords[i++] = points[current++]; - } - if (result < 2) - { - coords[i++] = points[current++]; - coords[i++] = points[current++]; - if (at != null) - at.transform(coords, 0, coords, 0, result == 0 ? 1 : result); - } - return result; + if (transform == null) + System.arraycopy(path.points, pos, coords, 0, numCoords); + else + transform.transform(/* src */ path.points, /* srcOffset */ pos, + /* dest */ coords, /* destOffset */ 0, + /* numPoints */ numCoords >> 1); } + return seg; + } + + + /** + * Returns the current segment in double coordinates. + */ + public int currentSegment(double[] coords) + { + int seg, numCoords; - public int currentSegment(double[] coords) + seg = path.types[pos >> 1]; + numCoords = NUM_COORDS[seg]; + if (numCoords > 0) { - if (current >= index) - return SEG_CLOSE; - int result = types[current >> 1]; - int i = 0; - if (result == 3) - { - coords[i++] = points[current++]; - coords[i++] = points[current++]; - } - if (result == 2) - { - coords[i++] = points[current++]; - coords[i++] = points[current++]; - } - if (result < 2) - { - coords[i++] = points[current++]; - coords[i++] = points[current++]; - if (at != null) - at.transform(coords, 0, coords, 0, result == 0 ? 1 : result); - } - return result; + if (transform == null) + { + // System.arraycopy throws an exception if the source and destination + // array are not of the same primitive type. + for (int i = 0; i < numCoords; i++) + coords[i] = (double) path.points[pos + i]; + } + else + transform.transform(/* src */ path.points, /* srcOffset */ pos, + /* dest */ coords, /* destOffset */ 0, + /* numPoints */ numCoords >> 1); } - }; + return seg; + } + } + + + /** + * Creates a PathIterator for iterating along the segments of this path. + * + * @param at an affine transformation for projecting the returned + * points, or <code>null</code> to let the created iterator return + * the original points without any mapping. + */ + public PathIterator getPathIterator(AffineTransform at) + { + return new GeneralPathIterator(this, at); } + + public PathIterator getPathIterator(AffineTransform at, double flatness) { return new FlatteningPathIterator(getPathIterator(at), flatness); diff --git a/libjava/java/awt/geom/QuadCurve2D.java b/libjava/java/awt/geom/QuadCurve2D.java index 6aed0590756..e737ec1a470 100644 --- a/libjava/java/awt/geom/QuadCurve2D.java +++ b/libjava/java/awt/geom/QuadCurve2D.java @@ -1,5 +1,5 @@ /* QuadCurve2D.java -- represents a parameterized quadratic curve in 2-D space - Copyright (C) 2002 Free Software Foundation + Copyright (C) 2002, 2003 Free Software Foundation This file is part of GNU Classpath. @@ -42,124 +42,361 @@ import java.awt.Rectangle; import java.awt.Shape; import java.util.NoSuchElementException; + /** - * STUBS ONLY - * XXX Implement and document. + * A two-dimensional curve that is parameterized with a quadratic + * function. + * + * <p><img src="doc-files/QuadCurve2D-1.png" width="350" height="180" + * alt="A drawing of a QuadCurve2D" /> + * + * @author Eric Blake (ebb9@email.byu.edu) + * @author Sascha Brawer (brawer@dandelis.ch) + * + * @since 1.2 */ -public abstract class QuadCurve2D implements Shape, Cloneable +public abstract class QuadCurve2D + implements Shape, Cloneable { + /** + * Constructs a new QuadCurve2D. Typical users will want to + * construct instances of a subclass, such as {@link + * QuadCurve2D.Float} or {@link QuadCurve2D.Double}. + */ protected QuadCurve2D() { } + + /** + * Returns the <i>x</i> coordinate of the curve’s start + * point. + */ public abstract double getX1(); + + + /** + * Returns the <i>y</i> coordinate of the curve’s start + * point. + */ public abstract double getY1(); + + + /** + * Returns the curve’s start point. + */ public abstract Point2D getP1(); + + + /** + * Returns the <i>x</i> coordinate of the curve’s control + * point. + */ public abstract double getCtrlX(); + + + /** + * Returns the <i>y</i> coordinate of the curve’s control + * point. + */ public abstract double getCtrlY(); + + + /** + * Returns the curve’s control point. + */ public abstract Point2D getCtrlPt(); + + + /** + * Returns the <i>x</i> coordinate of the curve’s end + * point. + */ public abstract double getX2(); + + + /** + * Returns the <i>y</i> coordinate of the curve’s end + * point. + */ public abstract double getY2(); + + + /** + * Returns the curve’s end point. + */ public abstract Point2D getP2(); + + /** + * Changes the geometry of the curve. + * + * @param x1 the <i>x</i> coordinate of the curve’s new start + * point. + * + * @param y1 the <i>y</i> coordinate of the curve’s new start + * point. + * + * @param cx the <i>x</i> coordinate of the curve’s new + * control point. + * + * @param cy the <i>y</i> coordinate of the curve’s new + * control point. + * + * @param x2 the <i>x</i> coordinate of the curve’s new end + * point. + * + * @param y2 the <i>y</i> coordinate of the curve’s new end + * point. + */ public abstract void setCurve(double x1, double y1, double cx, double cy, double x2, double y2); + + public void setCurve(double[] coords, int offset) { setCurve(coords[offset++], coords[offset++], coords[offset++], coords[offset++], coords[offset++], coords[offset++]); } + + public void setCurve(Point2D p1, Point2D c, Point2D p2) { setCurve(p1.getX(), p1.getY(), c.getX(), c.getY(), p2.getX(), p2.getY()); } + + public void setCurve(Point2D[] pts, int offset) { setCurve(pts[offset].getX(), pts[offset++].getY(), pts[offset].getX(), pts[offset++].getY(), pts[offset].getX(), pts[offset++].getY()); } + + + /** + * Changes the geometry of the curve to that of another curve. + * + * @param c the curve whose coordinates will be copied. + */ public void setCurve(QuadCurve2D c) { setCurve(c.getX1(), c.getY1(), c.getCtrlX(), c.getCtrlY(), c.getX2(), c.getY2()); } + + public static double getFlatnessSq(double x1, double y1, double cx, double cy, double x2, double y2) { - // XXX Implement. - throw new Error("not implemented"); + return Line2D.ptSegDistSq(x1, y1, x2, y2, cx, cy); } + + public static double getFlatness(double x1, double y1, double cx, double cy, double x2, double y2) { - return Math.sqrt(getFlatnessSq(x1, y1, cx, cy, x2, y2)); + return Line2D.ptSegDist(x1, y1, x2, y2, cx, cy); } + + public static double getFlatnessSq(double[] coords, int offset) { - return getFlatnessSq(coords[offset++], coords[offset++], - coords[offset++], coords[offset++], - coords[offset++], coords[offset++]); + return Line2D.ptSegDistSq(coords[offset], coords[offset + 1], + coords[offset + 4], coords[offset + 5], + coords[offset + 2], coords[offset + 3]); } + + public static double getFlatness(double[] coords, int offset) { - return Math.sqrt(getFlatnessSq(coords[offset++], coords[offset++], - coords[offset++], coords[offset++], - coords[offset++], coords[offset++])); + return Line2D.ptSegDist(coords[offset], coords[offset + 1], + coords[offset + 4], coords[offset + 5], + coords[offset + 2], coords[offset + 3]); } + + public double getFlatnessSq() { - return getFlatnessSq(getX1(), getY1(), getCtrlX(), getCtrlY(), - getX2(), getY2()); + return Line2D.ptSegDistSq(getX1(), getY1(), + getX2(), getY2(), + getCtrlX(), getCtrlY()); } + + public double getFlatness() { - return Math.sqrt(getFlatnessSq(getX1(), getY1(), getCtrlX(), getCtrlY(), - getX2(), getY2())); + return Line2D.ptSegDist(getX1(), getY1(), + getX2(), getY2(), + getCtrlX(), getCtrlY()); } - public void subdivide(QuadCurve2D l, QuadCurve2D r) + + /** + * Subdivides this curve into two halves. + * + * <p><img src="doc-files/QuadCurve2D-3.png" width="700" + * height="180" alt="A drawing that illustrates the effects of + * subdividing a QuadCurve2D" /> + * + * @param left a curve whose geometry will be set to the left half + * of this curve, or <code>null</code> if the caller is not + * interested in the left half. + * + * @param right a curve whose geometry will be set to the right half + * of this curve, or <code>null</code> if the caller is not + * interested in the right half. + */ + public void subdivide(QuadCurve2D left, QuadCurve2D right) { - if (l == null) - l = new QuadCurve2D.Double(); - if (r == null) - r = new QuadCurve2D.Double(); // Use empty slots at end to share single array. double[] d = new double[] { getX1(), getY1(), getCtrlX(), getCtrlY(), getX2(), getY2(), 0, 0, 0, 0 }; subdivide(d, 0, d, 0, d, 4); - l.setCurve(d, 0); - r.setCurve(d, 4); + if (left != null) + left.setCurve(d, 0); + if (right != null) + right.setCurve(d, 4); } - public static void subdivide(QuadCurve2D src, QuadCurve2D l, QuadCurve2D r) + + + /** + * Subdivides a quadratic curve into two halves. + * + * <p><img src="doc-files/QuadCurve2D-3.png" width="700" + * height="180" alt="A drawing that illustrates the effects of + * subdividing a QuadCurve2D" /> + * + * @param src the curve to be subdivided. + * + * @param left a curve whose geometry will be set to the left half + * of <code>src</code>, or <code>null</code> if the caller is not + * interested in the left half. + * + * @param right a curve whose geometry will be set to the right half + * of <code>src</code>, or <code>null</code> if the caller is not + * interested in the right half. + */ + public static void subdivide(QuadCurve2D src, QuadCurve2D left, + QuadCurve2D right) { - src.subdivide(l, r); + src.subdivide(left, right); } + + + /** + * Subdivides a quadratic curve into two halves, passing all + * coordinates in an array. + * + * <p><img src="doc-files/QuadCurve2D-3.png" width="700" + * height="180" alt="A drawing that illustrates the effects of + * subdividing a QuadCurve2D" /> + * + * <p>The left end point and the right start point will always be + * identical. Memory-concious programmers thus may want to pass the + * same array for both <code>left</code> and <code>right</code>, and + * set <code>rightOff</code> to <code>leftOff + 4</code>. + * + * @param src an array containing the coordinates of the curve to be + * subdivided. The <i>x</i> coordinate of the start point is + * located at <code>src[srcOff]</code>, its <i>y</i> at + * <code>src[srcOff + 1]</code>. The <i>x</i> coordinate of the + * control point is located at <code>src[srcOff + 2]</code>, its + * <i>y</i> at <code>src[srcOff + 3]</code>. The <i>x</i> + * coordinate of the end point is located at <code>src[srcOff + + * 4]</code>, its <i>y</i> at <code>src[srcOff + 5]</code>. + * + * @param srcOff an offset into <code>src</code>, specifying + * the index of the start point’s <i>x</i> coordinate. + * + * @param left an array that will receive the coordinates of the + * left half of <code>src</code>. It is acceptable to pass + * <code>src</code>. A caller who is not interested in the left half + * can pass <code>null</code>. + * + * @param leftOff an offset into <code>left</code>, specifying the + * index where the start point’s <i>x</i> coordinate will be + * stored. + * + * @param right an array that will receive the coordinates of the + * right half of <code>src</code>. It is acceptable to pass + * <code>src</code> or <code>left</code>. A caller who is not + * interested in the right half can pass <code>null</code>. + * + * @param rightOff an offset into <code>right</code>, specifying the + * index where the start point’s <i>x</i> coordinate will be + * stored. + */ public static void subdivide(double[] src, int srcOff, double[] left, int leftOff, double[] right, int rightOff) { - // XXX Implement. - throw new Error("not implemented"); + double x1, y1, xc, yc, x2, y2; + + x1 = src[srcOff]; + y1 = src[srcOff + 1]; + xc = src[srcOff + 2]; + yc = src[srcOff + 3]; + x2 = src[srcOff + 4]; + y2 = src[srcOff + 5]; + + if (left != null) + { + left[leftOff] = x1; + left[leftOff + 1] = y1; + } + + if (right != null) + { + right[rightOff + 4] = x2; + right[rightOff + 5] = y2; + } + + x1 = (x1 + xc) / 2; + x2 = (xc + x2) / 2; + xc = (x1 + x2) / 2; + y1 = (y1 + yc) / 2; + y2 = (y2 + yc) / 2; + yc = (y1 + y2) / 2; + + if (left != null) + { + left[leftOff + 2] = x1; + left[leftOff + 3] = y1; + left[leftOff + 4] = xc; + left[leftOff + 5] = yc; + } + + if (right != null) + { + right[rightOff] = xc; + right[rightOff + 1] = yc; + right[rightOff + 2] = x2; + right[rightOff + 3] = y2; + } } + + public static int solveQuadratic(double[] eqn) { return solveQuadratic(eqn, eqn); } + + public static int solveQuadratic(double[] eqn, double[] res) { double c = eqn[0]; double b = eqn[1]; double a = eqn[2]; if (a == 0) - { - if (b == 0) - return -1; - res[0] = -c / b; - return 1; - } + { + if (b == 0) + return -1; + res[0] = -c / b; + return 1; + } c /= a; b /= a * 2; double det = Math.sqrt(b * b - c); @@ -167,49 +404,74 @@ public abstract class QuadCurve2D implements Shape, Cloneable return 0; // For fewer rounding errors, we calculate the two roots differently. if (b > 0) - { - res[0] = -b - det; - res[1] = -c / (b + det); - } + { + res[0] = -b - det; + res[1] = -c / (b + det); + } else - { - res[0] = -c / (b - det); - res[1] = -b + det; - } + { + res[0] = -c / (b - det); + res[1] = -b + det; + } return 2; } + public boolean contains(double x, double y) { // XXX Implement. throw new Error("not implemented"); } + + public boolean contains(Point2D p) { return contains(p.getX(), p.getY()); } + + public boolean intersects(double x, double y, double w, double h) { // XXX Implement. throw new Error("not implemented"); } + + public boolean intersects(Rectangle2D r) { return intersects(r.getX(), r.getY(), r.getWidth(), r.getHeight()); } + + public boolean contains(double x, double y, double w, double h) { // XXX Implement. throw new Error("not implemented"); } + + public boolean contains(Rectangle2D r) { return contains(r.getX(), r.getY(), r.getWidth(), r.getHeight()); } + + + /** + * Determines the smallest rectangle that encloses the + * curve’s start, end and control point. As the illustration + * below shows, the invisible control point may cause the bounds to + * be much larger than the area that is actually covered by the + * curve. + * + * <p><img src="doc-files/QuadCurve2D-2.png" width="350" height="180" + * alt="An illustration of the bounds of a QuadCurve2D" /> + */ public Rectangle getBounds() { return getBounds2D().getBounds(); } + + public PathIterator getPathIterator(final AffineTransform at) { return new PathIterator() @@ -217,115 +479,190 @@ public abstract class QuadCurve2D implements Shape, Cloneable /** Current coordinate. */ private int current = 0; + public int getWindingRule() { return WIND_NON_ZERO; } + public boolean isDone() { return current >= 2; } + public void next() { current++; } + public int currentSegment(float[] coords) { int result; switch (current) - { - case 0: - coords[0] = (float) getX1(); - coords[1] = (float) getY1(); - result = SEG_MOVETO; - break; - case 1: - coords[0] = (float) getCtrlX(); - coords[1] = (float) getCtrlY(); - coords[2] = (float) getX2(); - coords[3] = (float) getY2(); - result = SEG_QUADTO; - break; - default: - throw new NoSuchElementException("quad iterator out of bounds"); - } + { + case 0: + coords[0] = (float) getX1(); + coords[1] = (float) getY1(); + result = SEG_MOVETO; + break; + + case 1: + coords[0] = (float) getCtrlX(); + coords[1] = (float) getCtrlY(); + coords[2] = (float) getX2(); + coords[3] = (float) getY2(); + result = SEG_QUADTO; + break; + + default: + throw new NoSuchElementException("quad iterator out of bounds"); + } if (at != null) at.transform(coords, 0, coords, 0, 2); return result; } + public int currentSegment(double[] coords) { int result; switch (current) - { - case 0: - coords[0] = getX1(); - coords[1] = getY1(); - result = SEG_MOVETO; - break; - case 1: - coords[0] = getCtrlX(); - coords[1] = getCtrlY(); - coords[2] = getX2(); - coords[3] = getY2(); - result = SEG_QUADTO; - break; - default: - throw new NoSuchElementException("quad iterator out of bounds"); - } + { + case 0: + coords[0] = getX1(); + coords[1] = getY1(); + result = SEG_MOVETO; + break; + + case 1: + coords[0] = getCtrlX(); + coords[1] = getCtrlY(); + coords[2] = getX2(); + coords[3] = getY2(); + result = SEG_QUADTO; + break; + + default: + throw new NoSuchElementException("quad iterator out of bounds"); + } if (at != null) at.transform(coords, 0, coords, 0, 2); return result; } }; } + + public PathIterator getPathIterator(AffineTransform at, double flatness) { return new FlatteningPathIterator(getPathIterator(at), flatness); } + /** - * Create a new curve of the same run-time type with the same contents as + * Creates a new curve with the same contents as * this one. * - * @return the clone - * - * @exception OutOfMemoryError If there is not enough memory available. - * - * @since 1.2 + * @return the clone. */ public Object clone() { try - { - return super.clone(); - } + { + return super.clone(); + } catch (CloneNotSupportedException e) - { - throw (Error) new InternalError().initCause(e); // Impossible - } + { + throw (Error) new InternalError().initCause(e); // Impossible + } } + /** - * STUBS ONLY + * A two-dimensional curve that is parameterized with a quadratic + * function and stores coordinate values in double-precision + * floating-point format. + * + * @see QuadCurve2D.Float + * + * @author Eric Blake (ebb9@email.byu.edu) + * @author Sascha Brawer (brawer@dandelis.ch) */ - public static class Double extends QuadCurve2D + public static class Double + extends QuadCurve2D { + /** + * The <i>x</i> coordinate of the curve’s start point. + */ public double x1; + + + /** + * The <i>y</i> coordinate of the curve’s start point. + */ public double y1; + + + /** + * The <i>x</i> coordinate of the curve’s control point. + */ public double ctrlx; + + + /** + * The <i>y</i> coordinate of the curve’s control point. + */ public double ctrly; + + + /** + * The <i>x</i> coordinate of the curve’s end point. + */ public double x2; + + + /** + * The <i>y</i> coordinate of the curve’s end point. + */ public double y2; + + /** + * Constructs a new QuadCurve2D that stores its coordinate values + * in double-precision floating-point format. All points are + * initially at position (0, 0). + */ public Double() { } + + /** + * Constructs a new QuadCurve2D that stores its coordinate values + * in double-precision floating-point format, specifying the + * initial position of each point. + * + * @param x1 the <i>x</i> coordinate of the curve’s start + * point. + * + * @param y1 the <i>y</i> coordinate of the curve’s start + * point. + * + * @param cx the <i>x</i> coordinate of the curve’s control + * point. + * + * @param cy the <i>y</i> coordinate of the curve’s control + * point. + * + * @param x2 the <i>x</i> coordinate of the curve’s end + * point. + * + * @param y2 the <i>y</i> coordinate of the curve’s end + * point. + */ public Double(double x1, double y1, double cx, double cy, double x2, double y2) { @@ -337,45 +674,115 @@ public abstract class QuadCurve2D implements Shape, Cloneable this.y2 = y2; } + + /** + * Returns the <i>x</i> coordinate of the curve’s start + * point. + */ public double getX1() { return x1; } + + + /** + * Returns the <i>y</i> coordinate of the curve’s start + * point. + */ public double getY1() { return y1; } + + + /** + * Returns the curve’s start point. + */ public Point2D getP1() { return new Point2D.Double(x1, y1); } + + /** + * Returns the <i>x</i> coordinate of the curve’s control + * point. + */ public double getCtrlX() { return ctrlx; } + + + /** + * Returns the <i>y</i> coordinate of the curve’s control + * point. + */ public double getCtrlY() { return ctrly; } + + + /** + * Returns the curve’s control point. + */ public Point2D getCtrlPt() { return new Point2D.Double(ctrlx, ctrly); } + + /** + * Returns the <i>x</i> coordinate of the curve’s end + * point. + */ public double getX2() { return x2; } + + + /** + * Returns the <i>y</i> coordinate of the curve’s end + * point. + */ public double getY2() { return y2; } + + + /** + * Returns the curve’s end point. + */ public Point2D getP2() { return new Point2D.Double(x2, y2); } + + /** + * Changes the geometry of the curve. + * + * @param x1 the <i>x</i> coordinate of the curve’s new + * start point. + * + * @param y1 the <i>y</i> coordinate of the curve’s new + * start point. + * + * @param cx the <i>x</i> coordinate of the curve’s new + * control point. + * + * @param cy the <i>y</i> coordinate of the curve’s new + * control point. + * + * @param x2 the <i>x</i> coordinate of the curve’s new + * end point. + * + * @param y2 the <i>y</i> coordinate of the curve’s new + * end point. + */ public void setCurve(double x1, double y1, double cx, double cy, double x2, double y2) { @@ -386,6 +793,18 @@ public abstract class QuadCurve2D implements Shape, Cloneable this.x2 = x2; this.y2 = y2; } + + + /** + * Determines the smallest rectangle that encloses the + * curve’s start, end and control point. As the + * illustration below shows, the invisible control point may cause + * the bounds to be much larger than the area that is actually + * covered by the curve. + * + * <p><img src="doc-files/QuadCurve2D-2.png" width="350" height="180" + * alt="An illustration of the bounds of a QuadCurve2D" /> + */ public Rectangle2D getBounds2D() { double nx1 = Math.min(Math.min(x1, ctrlx), x2); @@ -394,24 +813,91 @@ public abstract class QuadCurve2D implements Shape, Cloneable double ny2 = Math.max(Math.max(y1, ctrly), y2); return new Rectangle2D.Double(nx1, ny1, nx2 - nx1, ny2 - ny1); } - } // class Double + } + /** - * STUBS ONLY + * A two-dimensional curve that is parameterized with a quadratic + * function and stores coordinate values in single-precision + * floating-point format. + * + * @see QuadCurve2D.Double + * + * @author Eric Blake (ebb9@email.byu.edu) + * @author Sascha Brawer (brawer@dandelis.ch) */ - public static class Float extends QuadCurve2D + public static class Float + extends QuadCurve2D { + /** + * The <i>x</i> coordinate of the curve’s start point. + */ public float x1; + + + /** + * The <i>y</i> coordinate of the curve’s start point. + */ public float y1; + + + /** + * The <i>x</i> coordinate of the curve’s control point. + */ public float ctrlx; + + + /** + * The <i>y</i> coordinate of the curve’s control point. + */ public float ctrly; + + + /** + * The <i>x</i> coordinate of the curve’s end point. + */ public float x2; + + + /** + * The <i>y</i> coordinate of the curve’s end point. + */ public float y2; + + /** + * Constructs a new QuadCurve2D that stores its coordinate values + * in single-precision floating-point format. All points are + * initially at position (0, 0). + */ public Float() { } + + /** + * Constructs a new QuadCurve2D that stores its coordinate values + * in single-precision floating-point format, specifying the + * initial position of each point. + * + * @param x1 the <i>x</i> coordinate of the curve’s start + * point. + * + * @param y1 the <i>y</i> coordinate of the curve’s start + * point. + * + * @param cx the <i>x</i> coordinate of the curve’s control + * point. + * + * @param cy the <i>y</i> coordinate of the curve’s control + * point. + * + * @param x2 the <i>x</i> coordinate of the curve’s end + * point. + * + * @param y2 the <i>y</i> coordinate of the curve’s end + * point. + */ public Float(float x1, float y1, float cx, float cy, float x2, float y2) { @@ -423,45 +909,116 @@ public abstract class QuadCurve2D implements Shape, Cloneable this.y2 = y2; } + + /** + * Returns the <i>x</i> coordinate of the curve’s start + * point. + */ public double getX1() { return x1; } + + + /** + * Returns the <i>y</i> coordinate of the curve’s start + * point. + */ public double getY1() { return y1; } + + + /** + * Returns the curve’s start point. + */ public Point2D getP1() { return new Point2D.Float(x1, y1); } + + /** + * Returns the <i>x</i> coordinate of the curve’s control + * point. + */ public double getCtrlX() { return ctrlx; } + + + /** + * Returns the <i>y</i> coordinate of the curve’s control + * point. + */ public double getCtrlY() { return ctrly; } + + + /** + * Returns the curve’s control point. + */ public Point2D getCtrlPt() { return new Point2D.Float(ctrlx, ctrly); } + + /** + * Returns the <i>x</i> coordinate of the curve’s end + * point. + */ public double getX2() { return x2; } + + + /** + * Returns the <i>y</i> coordinate of the curve’s end + * point. + */ public double getY2() { return y2; } + + + /** + * Returns the curve’s end point. + */ public Point2D getP2() { return new Point2D.Float(x2, y2); } + + /** + * Changes the geometry of the curve, specifying coordinate values + * as double-precision floating-point numbers. + * + * @param x1 the <i>x</i> coordinate of the curve’s new + * start point. + * + * @param y1 the <i>y</i> coordinate of the curve’s new + * start point. + * + * @param cx the <i>x</i> coordinate of the curve’s new + * control point. + * + * @param cy the <i>y</i> coordinate of the curve’s new + * control point. + * + * @param x2 the <i>x</i> coordinate of the curve’s new + * end point. + * + * @param y2 the <i>y</i> coordinate of the curve’s new + * end point. + */ public void setCurve(double x1, double y1, double cx, double cy, double x2, double y2) { @@ -472,6 +1029,30 @@ public abstract class QuadCurve2D implements Shape, Cloneable this.x2 = (float) x2; this.y2 = (float) y2; } + + + /** + * Changes the geometry of the curve, specifying coordinate values + * as single-precision floating-point numbers. + * + * @param x1 the <i>x</i> coordinate of the curve’s new + * start point. + * + * @param y1 the <i>y</i> coordinate of the curve’s new + * start point. + * + * @param cx the <i>x</i> coordinate of the curve’s new + * control point. + * + * @param cy the <i>y</i> coordinate of the curve’s new + * control point. + * + * @param x2 the <i>x</i> coordinate of the curve’s new + * end point. + * + * @param y2 the <i>y</i> coordinate of the curve’s new + * end point. + */ public void setCurve(float x1, float y1, float cx, float cy, float x2, float y2) { @@ -482,6 +1063,18 @@ public abstract class QuadCurve2D implements Shape, Cloneable this.x2 = x2; this.y2 = y2; } + + + /** + * Determines the smallest rectangle that encloses the + * curve’s start, end and control point. As the + * illustration below shows, the invisible control point may cause + * the bounds to be much larger than the area that is actually + * covered by the curve. + * + * <p><img src="doc-files/QuadCurve2D-2.png" width="350" height="180" + * alt="An illustration of the bounds of a QuadCurve2D" /> + */ public Rectangle2D getBounds2D() { float nx1 = (float) Math.min(Math.min(x1, ctrlx), x2); @@ -490,5 +1083,5 @@ public abstract class QuadCurve2D implements Shape, Cloneable float ny2 = (float) Math.max(Math.max(y1, ctrly), y2); return new Rectangle2D.Float(nx1, ny1, nx2 - nx1, ny2 - ny1); } - } // class Float -} // class CubicCurve2D + } +} diff --git a/libjava/java/beans/IndexedPropertyDescriptor.java b/libjava/java/beans/IndexedPropertyDescriptor.java index 965a9942cde..42c9a248d55 100644 --- a/libjava/java/beans/IndexedPropertyDescriptor.java +++ b/libjava/java/beans/IndexedPropertyDescriptor.java @@ -1,5 +1,5 @@ /* java.beans.IndexedPropertyDescriptor - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -216,7 +216,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { this.getMethod = getMethod; this.setMethod = setMethod; this.getIndex = getIndex; - this.setIndex = getIndex; + this.setIndex = setIndex; this.indexedPropertyType = getIndex != null ? getIndex.getReturnType() : setIndex.getParameterTypes()[1]; this.propertyType = getMethod != null ? getMethod.getReturnType() : (setMethod != null ? setMethod.getParameterTypes()[0] : Array.newInstance(this.indexedPropertyType,0).getClass()); } diff --git a/libjava/java/beans/Introspector.java b/libjava/java/beans/Introspector.java index ac9e36721e4..b930b7469f5 100644 --- a/libjava/java/beans/Introspector.java +++ b/libjava/java/beans/Introspector.java @@ -1,5 +1,5 @@ /* java.beans.Introspector - Copyright (C) 1998, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -518,40 +518,54 @@ class ExplicitInfo static BeanInfo reallyFindExplicitBeanInfo(Class beanClass) { - try + ClassLoader beanClassLoader = beanClass.getClassLoader(); + BeanInfo beanInfo; + + beanInfo = getBeanInfo(beanClassLoader, beanClass.getName() + "BeanInfo"); + if (beanInfo == null) { - try - { - return (BeanInfo)Class.forName(beanClass.getName()+"BeanInfo").newInstance(); - } - catch(ClassNotFoundException E) - { - } - String newName = ClassHelper.getTruncatedClassName(beanClass) + "BeanInfo"; - for(int i=0;i<Introspector.beanInfoSearchPath.length;i++) - { - try - { - if(Introspector.beanInfoSearchPath[i].equals("")) - { - return (BeanInfo)Class.forName(newName).newInstance(); - } - else - { - return (BeanInfo)Class.forName(Introspector.beanInfoSearchPath[i] + "." + newName).newInstance(); - } - } - catch(ClassNotFoundException E) - { - } - } - } - catch(IllegalAccessException E) + String newName; + newName = ClassHelper.getTruncatedClassName(beanClass) + "BeanInfo"; + + for(int i = 0; i < Introspector.beanInfoSearchPath.length; i++) + { + if (Introspector.beanInfoSearchPath[i].equals("")) + beanInfo = getBeanInfo(beanClassLoader, newName); + else + beanInfo = getBeanInfo(beanClassLoader, + Introspector.beanInfoSearchPath[i] + "." + + newName); + + if (beanInfo != null) + return beanInfo; + } + } + + return beanInfo; + } + + /** + * Returns an instance of the given class name when it can be loaded + * through the given class loader, or null otherwise. + */ + private static BeanInfo getBeanInfo(ClassLoader cl, String infoName) + { + try { - } - catch(InstantiationException E) + return (BeanInfo) Class.forName(infoName, true, cl).newInstance(); + } + catch (ClassNotFoundException cnfe) { + return null; + } + catch (IllegalAccessException iae) + { + return null; + } + catch (InstantiationException ie) + { + return null; } - return null; } + } diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java index 4800ba15c18..b4951ecc806 100644 --- a/libjava/java/io/File.java +++ b/libjava/java/io/File.java @@ -111,7 +111,7 @@ public class File implements Serializable, Comparable * is taken from the <code>path.separator</code> system property. */ public static final char pathSeparatorChar = pathSeparator.charAt(0); - + static final String tmpdir = System.getProperty("java.io.tmpdir"); static int maxPathLen; static boolean caseSensitive; @@ -246,9 +246,6 @@ public class File implements Serializable, Comparable */ public boolean equals (Object obj) { - if (obj == null) - return false; - if (! (obj instanceof File)) return false; @@ -1006,10 +1003,11 @@ public class File implements Serializable, Comparable + " is not really a directory."); } - // Now process the prefix and suffix. + // Check if prefix is at least 3 characters long if (prefix.length() < 3) throw new IllegalArgumentException ("Prefix too short: " + prefix); + // Set default value of suffix if (suffix == null) suffix = ".tmp"; diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index 5cf6e2c0ce3..01761af5cec 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -131,6 +131,12 @@ struct _Jv_AddressTable void *addresses[]; }; +struct _Jv_CatchClass +{ + java::lang::Class **address; + _Jv_Utf8Const *classname; +}; + #define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1) #define JV_CLASS(Obj) ((jclass) (*(_Jv_VTable **) Obj)->clas) @@ -157,7 +163,8 @@ public: java::lang::reflect::Constructor *getDeclaredConstructor (JArray<jclass> *); JArray<java::lang::reflect::Constructor *> *getDeclaredConstructors (void); java::lang::reflect::Field *getDeclaredField (jstring); - JArray<java::lang::reflect::Field *> *getDeclaredFields (void); + JArray<java::lang::reflect::Field *> *getDeclaredFields (); + JArray<java::lang::reflect::Field *> *getDeclaredFields (jboolean); java::lang::reflect::Method *getDeclaredMethod (jstring, JArray<jclass> *); JArray<java::lang::reflect::Method *> *getDeclaredMethods (void); @@ -166,7 +173,7 @@ public: java::lang::reflect::Field *getField (jstring); private: - jint _getFields (JArray<java::lang::reflect::Field *> *result, jint offset); + JArray<java::lang::reflect::Field *> internalGetFields (); JArray<java::lang::reflect::Constructor *> *_getConstructors (jboolean); java::lang::reflect::Field *getField (jstring, jint); jint _getMethods (JArray<java::lang::reflect::Method *> *result, @@ -335,6 +342,7 @@ private: friend void _Jv_LayoutVTableMethods (jclass klass); friend void _Jv_SetVTableEntries (jclass, _Jv_VTable *, jboolean *); friend void _Jv_MakeVTable (jclass); + friend void _Jv_linkExceptionClassTable (jclass); friend jboolean _Jv_CheckAccess (jclass self_klass, jclass other_klass, jint flags); @@ -364,6 +372,8 @@ private: friend void _Jv_PrepareClass (jclass); friend void _Jv_PrepareMissingMethods (jclass base, jclass iface_class); + friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **); + friend class _Jv_ClassReader; friend class _Jv_InterpClass; friend class _Jv_InterpMethod; @@ -413,6 +423,7 @@ private: _Jv_MethodSymbol *otable_syms; _Jv_AddressTable *atable; _Jv_MethodSymbol *atable_syms; + _Jv_CatchClass *catch_classes; // Interfaces implemented by this class. jclass *interfaces; // The class loader for this class. diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java index 6fd4ff07d48..8943da45aa7 100644 --- a/libjava/java/lang/Class.java +++ b/libjava/java/lang/Class.java @@ -13,6 +13,8 @@ import java.io.Serializable; import java.io.InputStream; import java.lang.reflect.*; import java.security.*; +import java.util.Arrays; +import java.util.HashSet; /** * @author Tom Tromey <tromey@cygnus.com> @@ -64,7 +66,26 @@ public final class Class implements Serializable public native Field getDeclaredField (String fieldName) throws NoSuchFieldException, SecurityException; - public native Field[] getDeclaredFields () throws SecurityException; + + /** + * Get all the declared fields in this class, but not those inherited from + * superclasses. This returns an array of length 0 if there are no fields, + * including for primitive types. This does not return the implicit length + * field of arrays. A security check may be performed, with + * <code>checkMemberAccess(this, Member.DECLARED)</code> as well as + * <code>checkPackageAccess</code> both having to succeed. + * + * @return all declared fields in this class + * @throws SecurityException if the security check fails + * @since 1.1 + */ + public Field[] getDeclaredFields() + { + memberAccessCheck(Member.DECLARED); + return getDeclaredFields(false); + } + + native Field[] getDeclaredFields (boolean publicOnly); private native Method _getDeclaredMethod (String methodName, Class[] parameterTypes); @@ -101,8 +122,39 @@ public final class Class implements Serializable return fld; } - private native Field[] _getFields (Field[] result, int offset); - public native Field[] getFields () throws SecurityException; + /** + * Get all the public fields declared in this class or inherited from + * superclasses. This returns an array of length 0 if there are no fields, + * including for primitive types. This does not return the implicit length + * field of arrays. A security check may be performed, with + * <code>checkMemberAccess(this, Member.PUBLIC)</code> as well as + * <code>checkPackageAccess</code> both having to succeed. + * + * @return all public fields in this class + * @throws SecurityException if the security check fails + * @since 1.1 + */ + public Field[] getFields() + { + memberAccessCheck(Member.PUBLIC); + return internalGetFields(); + } + + /** + * Like <code>getFields()</code> but without the security checks. + */ + private Field[] internalGetFields() + { + HashSet set = new HashSet(); + set.addAll(Arrays.asList(getDeclaredFields(true))); + Class[] interfaces = getInterfaces(); + for (int i = 0; i < interfaces.length; i++) + set.addAll(Arrays.asList(interfaces[i].internalGetFields())); + Class superClass = getSuperclass(); + if (superClass != null) + set.addAll(Arrays.asList(superClass.internalGetFields())); + return (Field[])set.toArray(new Field[set.size()]); + } /** * Returns the <code>Package</code> in which this class is defined diff --git a/libjava/java/lang/Object.h b/libjava/java/lang/Object.h index b0d82707c11..78ddbc40bef 100644 --- a/libjava/java/lang/Object.h +++ b/libjava/java/lang/Object.h @@ -49,6 +49,7 @@ public: friend void _Jv_MonitorExit (jobject obj); friend void _Jv_InitializeSyncMutex (void); friend void _Jv_FinalizeObject (jobject obj); + friend bool _Jv_ObjectCheckMonitor (jobject obj); #ifdef JV_MARKOBJ_DECL friend JV_MARKOBJ_DECL; diff --git a/libjava/java/lang/Thread.java b/libjava/java/lang/Thread.java index 64498b23ba4..d537220ab02 100644 --- a/libjava/java/lang/Thread.java +++ b/libjava/java/lang/Thread.java @@ -182,6 +182,15 @@ 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. + * @throws NullPointerException if obj is null. + * @since 1.4 + */ + public static native boolean holdsLock (Object obj); + + /** * Interrupt this Thread. First, there is a security check, * <code>checkAccess</code>. Then, depending on the current state of the * thread, various actions take place: diff --git a/libjava/java/lang/natClass.cc b/libjava/java/lang/natClass.cc index 4c71ed1cea0..ffac2c1ff53 100644 --- a/libjava/java/lang/natClass.cc +++ b/libjava/java/lang/natClass.cc @@ -12,6 +12,7 @@ details. */ #include <limits.h> #include <string.h> +#include <stddef.h> #pragma implementation "Class.h" @@ -56,7 +57,7 @@ details. */ #include <gnu/gcj/RawData.h> #include <java-cpool.h> - +#include <java-interp.h> using namespace gcj; @@ -295,16 +296,32 @@ java::lang::Class::getDeclaredField (jstring name) } JArray<java::lang::reflect::Field *> * -java::lang::Class::getDeclaredFields (void) +java::lang::Class::getDeclaredFields (jboolean public_only) { - memberAccessCheck(java::lang::reflect::Member::DECLARED); + int size; + if (public_only) + { + size = 0; + for (int i = 0; i < field_count; ++i) + { + _Jv_Field *field = &fields[i]; + if ((field->flags & java::lang::reflect::Modifier::PUBLIC)) + ++size; + } + } + else + size = field_count; + JArray<java::lang::reflect::Field *> *result = (JArray<java::lang::reflect::Field *> *) - JvNewObjectArray (field_count, &java::lang::reflect::Field::class$, NULL); + JvNewObjectArray (size, &java::lang::reflect::Field::class$, NULL); java::lang::reflect::Field** fptr = elements (result); for (int i = 0; i < field_count; i++) { _Jv_Field *field = &fields[i]; + if (public_only + && ! (field->flags & java::lang::reflect::Modifier::PUBLIC)) + continue; java::lang::reflect::Field* rfield = new java::lang::reflect::Field (); rfield->offset = (char*) field - (char*) fields; rfield->declaringClass = this; @@ -461,60 +478,6 @@ java::lang::Class::getDeclaringClass (void) return NULL; } -jint -java::lang::Class::_getFields (JArray<java::lang::reflect::Field *> *result, - jint offset) -{ - int count = 0; - for (int i = 0; i < field_count; i++) - { - _Jv_Field *field = &fields[i]; - if (! (field->getModifiers() & java::lang::reflect::Modifier::PUBLIC)) - continue; - ++count; - - if (result != NULL) - { - java::lang::reflect::Field *rfield - = new java::lang::reflect::Field (); - rfield->offset = (char *) field - (char *) fields; - rfield->declaringClass = this; - rfield->name = _Jv_NewStringUtf8Const (field->name); - (elements (result))[offset++] = rfield; - } - } - jclass superclass = getSuperclass(); - if (superclass != NULL) - { - int s_count = superclass->_getFields (result, offset); - count += s_count; - offset += s_count; - } - for (int i = 0; i < interface_count; ++i) - { - int f_count = interfaces[i]->_getFields (result, offset); - count += f_count; - offset += f_count; - } - return count; -} - -JArray<java::lang::reflect::Field *> * -java::lang::Class::getFields (void) -{ - memberAccessCheck(java::lang::reflect::Member::PUBLIC); - - int count = _getFields (NULL, 0); - - JArray<java::lang::reflect::Field *> *result - = ((JArray<java::lang::reflect::Field *> *) - JvNewObjectArray (count, &java::lang::reflect::Field::class$, NULL)); - - _getFields (result, 0); - - return result; -} - JArray<jclass> * java::lang::Class::getInterfaces (void) { @@ -834,6 +797,8 @@ java::lang::Class::initializeClass (void) if (otable || atable) _Jv_LinkSymbolTable(this); + _Jv_linkExceptionClassTable (this); + // Steps 8, 9, 10, 11. try { @@ -1579,14 +1544,18 @@ _Jv_LinkSymbolTable(jclass klass) for (index = 0; sym = klass->otable_syms[index], sym.name != NULL; index++) { + // FIXME: Why are we passing NULL as the class loader? jclass target_class = _Jv_FindClass (sym.class_name, NULL); _Jv_Method *meth = NULL; const _Jv_Utf8Const *signature = sym.signature; - // FIXME: This should be special index for ThrowNoSuchMethod(). - klass->otable->offsets[index] = -1; - + { + static char *bounce = (char *)_Jv_ThrowNoSuchMethodError; + ptrdiff_t offset = (char *)(klass->vtable) - bounce; + klass->otable->offsets[index] = offset; + } + if (target_class == NULL) continue; @@ -1696,6 +1665,7 @@ _Jv_LinkSymbolTable(jclass klass) for (index = 0; sym = klass->atable_syms[index], sym.name != NULL; index++) { + // FIXME: Why are we passing NULL as the class loader? jclass target_class = _Jv_FindClass (sym.class_name, NULL); _Jv_Method *meth = NULL; const _Jv_Utf8Const *signature = sym.signature; @@ -1725,7 +1695,15 @@ _Jv_LinkSymbolTable(jclass klass) sym.signature); if (meth != NULL) - klass->atable->addresses[index] = meth->ncode; + { + if (meth->ncode) // Maybe abstract? + klass->atable->addresses[index] = meth->ncode; +#ifdef INTERPRETER + else if (_Jv_IsInterpretedClass (target_class)) + _Jv_Defer_Resolution (target_class, meth, + &klass->atable->addresses[index]); +#endif + } else klass->atable->addresses[index] = (void *)_Jv_ThrowNoSuchMethodError; @@ -1781,15 +1759,26 @@ _Jv_LinkSymbolTable(jclass klass) } } -// Returns true if METH should get an entry in a VTable. -static jboolean -isVirtualMethod (_Jv_Method *meth) + +// For each catch_record in the list of caught classes, fill in the +// address field. +void +_Jv_linkExceptionClassTable (jclass self) { - using namespace java::lang::reflect; - return (((meth->accflags & (Modifier::STATIC | Modifier::PRIVATE)) == 0) - && meth->name->data[0] != '<'); + struct _Jv_CatchClass *catch_record = self->catch_classes; + if (!catch_record || catch_record->classname) + return; + catch_record++; + while (catch_record->classname) + { + jclass target_class = _Jv_FindClass (catch_record->classname, + self->getClassLoaderInternal ()); + *catch_record->address = target_class; + catch_record++; + } + self->catch_classes->classname = (_Jv_Utf8Const *)-1; } - + // This is put in empty vtable slots. static void _Jv_abstractMethodError (void) @@ -1810,6 +1799,26 @@ _Jv_LayoutVTableMethods (jclass klass) jclass superclass = klass->superclass; + typedef unsigned int uaddr __attribute__ ((mode (pointer))); + + // If superclass looks like a constant pool entry, + // resolve it now. + if ((uaddr)superclass < (uaddr)klass->constants.size) + { + if (klass->state < JV_STATE_LINKED) + { + _Jv_Utf8Const *name = klass->constants.data[(int)superclass].utf8; + superclass = _Jv_FindClass (name, klass->loader); + if (! superclass) + { + jstring str = _Jv_NewStringUTF (name->data); + throw new java::lang::NoClassDefFoundError (str); + } + } + else + superclass = klass->constants.data[(int)superclass].clazz; + } + if (superclass != NULL && superclass->vtable_method_count == -1) { JvSynchronize sync (superclass); @@ -1823,7 +1832,7 @@ _Jv_LayoutVTableMethods (jclass klass) _Jv_Method *meth = &klass->methods[i]; _Jv_Method *super_meth = NULL; - if (! isVirtualMethod (meth)) + if (! _Jv_isVirtualMethod (meth)) continue; if (superclass != NULL) diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc index 24faf29e51e..8618bf2c7a3 100644 --- a/libjava/java/lang/natObject.cc +++ b/libjava/java/lang/natObject.cc @@ -264,6 +264,13 @@ _Jv_MonitorExit (jobject obj) throw new java::lang::IllegalMonitorStateException; } +bool +_Jv_ObjectCheckMonitor (jobject obj) +{ + _Jv_SyncInfo *si = (_Jv_SyncInfo *) obj->sync_info; + return _Jv_MutexCheckMonitor (&si->mutex); +} + #else /* JV_HASH_SYNCHRONIZATION */ // FIXME: We shouldn't be calling GC_register_finalizer directly. @@ -1087,6 +1094,46 @@ retry: keep_live(addr); } +// Return false if obj's monitor is held by the current thread +bool +_Jv_ObjectCheckMonitor (jobject obj) +{ +#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS + obj_addr_t addr = (obj_addr_t)obj & ~((obj_addr_t)FLAGS); +#else + obj_addr_t addr = (obj_addr_t)obj; +#endif + obj_addr_t address; + unsigned hash = JV_SYNC_HASH(addr); + hash_entry * he = light_locks + hash; + _Jv_ThreadId_t self = _Jv_ThreadSelf(); + + JvAssert(!(addr & FLAGS)); +retry: + // Acquire the hash table entry lock + address = ((he -> address) & ~LOCKED); + if (!compare_and_swap(&(he -> address), address, address | LOCKED)) + { + wait_unlocked(he); + goto retry; + } + + bool not_mine; + + if (!(address & ~FLAGS)) + not_mine = true; + else if ((address & ~FLAGS) == addr) + not_mine = (he -> light_thr_id != self); + else + { + heavy_lock* hl = find_heavy(addr, he); + not_mine = hl ? _Jv_MutexCheckMonitor(&hl->si.mutex) : true; + } + + release_set(&(he -> address), address); // unlock hash entry + return not_mine; +} + // The rest of these are moderately thin veneers on _Jv_Cond ops. // The current version of Notify might be able to make the pthread // call AFTER releasing the lock, thus saving some context switches?? diff --git a/libjava/java/lang/natThread.cc b/libjava/java/lang/natThread.cc index 7fe8fb0db46..235f950c2c1 100644 --- a/libjava/java/lang/natThread.cc +++ b/libjava/java/lang/natThread.cc @@ -107,6 +107,14 @@ java::lang::Thread::destroy (void) (JvNewStringLatin1 ("Thread.destroy unimplemented")); } +jboolean +java::lang::Thread::holdsLock (jobject obj) +{ + if (!obj) + throw new NullPointerException; + return !_Jv_ObjectCheckMonitor (obj); +} + void java::lang::Thread::interrupt (void) { diff --git a/libjava/java/lang/reflect/AccessibleObject.java b/libjava/java/lang/reflect/AccessibleObject.java index 456f65aee99..4fb89bb44b5 100644 --- a/libjava/java/lang/reflect/AccessibleObject.java +++ b/libjava/java/lang/reflect/AccessibleObject.java @@ -59,8 +59,7 @@ public class AccessibleObject { /** * True if this object is marked accessible, which means the reflected - * object bypasses normal security checks. <em>NOTE</em>Don't try messing - * with this by reflection. You'll mess yourself up. + * object bypasses normal security checks. */ // default visibility for use by inherited classes boolean flag = false; @@ -88,19 +87,11 @@ public class AccessibleObject * security check. If a security manager exists, it is checked for * <code>ReflectPermission("suppressAccessChecks")</code>.<p> * - * If <code>flag</code> is true, and the initial security check succeeds, - * this can still fail if a forbidden object is encountered, leaving the - * array half-modified. At the moment, the forbidden members are:<br> - * <ul> - * <li>Any Constructor for java.lang.Class</li> - * <li>Any AccessibleObject for java.lang.reflect.AccessibleObject - * (this is not specified by Sun, but it closes a big security hole - * where you can use reflection to bypass the security checks that - * reflection is supposed to provide)</li> - * </ul> - * (Sun has not specified others, but good candidates might include - * ClassLoader, String, and such. However, the more checks we do, the - * slower this method gets). + * It is forbidden to set the accessibility flag to true on any constructor + * for java.lang.Class. This will result in a SecurityException. If the + * SecurityException is thrown for any of the passed AccessibleObjects, + * the accessibility flag will be set on AccessibleObjects in the array prior + * to the one which resulted in the exception. * * @param array the array of accessible objects * @param flag the desired state of accessibility, true to bypass security @@ -121,19 +112,8 @@ public class AccessibleObject * manager exists, it is checked for * <code>ReflectPermission("suppressAccessChecks")</code>.<p> * - * If <code>flag</code> is true, and the initial security check succeeds, - * this will still fail for a forbidden object. At the moment, the - * forbidden members are:<br> - * <ul> - * <li>Any Constructor for java.lang.Class</li> - * <li>Any AccessibleObject for java.lang.reflect.AccessibleObject - * (this is not specified by Sun, but it closes a big security hole - * where you can use reflection to bypass the security checks that - * reflection is supposed to provide)</li> - * </ul> - * (Sun has not specified others, but good candidates might include - * ClassLoader, String, and such. However, the more checks we do, the - * slower this method gets). + * It is forbidden to set the accessibility flag to true on any constructor for + * java.lang.Class. This will result in a SecurityException. * * @param flag the desired state of accessibility, true to bypass security * @throws NullPointerException if array is null @@ -165,15 +145,14 @@ public class AccessibleObject * after calling checkPermission. * * @param flag the desired status - * @throws SecurityException if flag is true and this is one of the - * forbidden members mentioned in {@link setAccessible(boolean)}. + * @throws SecurityException if flag is true and this is a constructor + * for <code>java.lang.Class</code>. */ private final void secureSetAccessible(boolean flag) { if (flag && - ((this instanceof Constructor - && ((Constructor) this).getDeclaringClass() == Class.class) - || ((Member) this).getDeclaringClass() == AccessibleObject.class)) + (this instanceof Constructor + && ((Constructor) this).getDeclaringClass() == Class.class)) throw new SecurityException("Cannot make object accessible: " + this); this.flag = flag; } diff --git a/libjava/java/lang/reflect/Constructor.java b/libjava/java/lang/reflect/Constructor.java index 53db35a6975..980ca2a41f2 100644 --- a/libjava/java/lang/reflect/Constructor.java +++ b/libjava/java/lang/reflect/Constructor.java @@ -151,8 +151,12 @@ public final class Constructor extends AccessibleObject implements Member if (parameter_types == null) getType (); StringBuffer b = new StringBuffer (); - Modifier.toString(getModifiers(), b); - b.append(" "); + int mods = getModifiers(); + if (mods != 0) + { + Modifier.toString(mods, b); + b.append(" "); + } Method.appendClassName (b, declaringClass); b.append("("); for (int i = 0; i < parameter_types.length; ++i) diff --git a/libjava/java/lang/reflect/Method.java b/libjava/java/lang/reflect/Method.java index 3e0507fcaa1..f93a7278890 100644 --- a/libjava/java/lang/reflect/Method.java +++ b/libjava/java/lang/reflect/Method.java @@ -163,8 +163,12 @@ public final class Method extends AccessibleObject implements Member getType (); StringBuffer b = new StringBuffer (); - Modifier.toString(getModifiers(), b); - b.append(" "); + int mods = getModifiers(); + if (mods != 0) + { + Modifier.toString(mods, b); + b.append(" "); + } appendClassName (b, return_type); b.append(" "); appendClassName (b, declaringClass); diff --git a/libjava/java/lang/reflect/natConstructor.cc b/libjava/java/lang/reflect/natConstructor.cc index 466c7544112..3697332d1ef 100644 --- a/libjava/java/lang/reflect/natConstructor.cc +++ b/libjava/java/lang/reflect/natConstructor.cc @@ -45,34 +45,39 @@ java::lang::reflect::Constructor::getType () jobject java::lang::reflect::Constructor::newInstance (jobjectArray args) { + using namespace java::lang::reflect; + if (parameter_types == NULL) getType (); - gnu::gcj::runtime::StackTrace *t - = new gnu::gcj::runtime::StackTrace(4); - Class *caller = NULL; - try + jmethodID meth = _Jv_FromReflectedConstructor (this); + + // Check accessibility, if required. + if (! (Modifier::isPublic (meth->accflags) || this->isAccessible())) { - for (int i = 1; !caller; i++) + gnu::gcj::runtime::StackTrace *t + = new gnu::gcj::runtime::StackTrace(4); + Class *caller = NULL; + try + { + for (int i = 1; !caller; i++) + { + caller = t->classAt (i); + } + } + catch (::java::lang::ArrayIndexOutOfBoundsException *e) { - caller = t->classAt (i); } - } - catch (::java::lang::ArrayIndexOutOfBoundsException *e) - { - } - if (! isAccessible() && ! _Jv_CheckAccess(caller, declaringClass, - declaringClass->getModifiers())) - throw new java::lang::IllegalAccessException; + if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags)) + throw new IllegalAccessException; + } - using namespace java::lang::reflect; if (Modifier::isAbstract (declaringClass->getModifiers())) throw new InstantiationException; _Jv_InitClass (declaringClass); - jmethodID meth = _Jv_FromReflectedConstructor (this); // In the constructor case the return type is the type of the // constructor. return _Jv_CallAnyMethodA (NULL, declaringClass, meth, true, diff --git a/libjava/java/lang/reflect/natField.cc b/libjava/java/lang/reflect/natField.cc index b7f12f06e92..469cf74de8e 100644 --- a/libjava/java/lang/reflect/natField.cc +++ b/libjava/java/lang/reflect/natField.cc @@ -58,27 +58,32 @@ getAddr (java::lang::reflect::Field* field, jclass caller, jobject obj) // have the compiler insert the caller as a hidden argument in some // calls. However, we never implemented that, so we have to find // the caller by hand instead. - gnu::gcj::runtime::StackTrace *t - = new gnu::gcj::runtime::StackTrace(7); - try - { - // We want to skip all the frames on the stack from this class. - for (int i = 1; - !caller || caller == &java::lang::reflect::Field::class$; - i++) - caller = t->classAt (i); - } - catch (::java::lang::ArrayIndexOutOfBoundsException *e) - { - } - + + using namespace java::lang::reflect; + jfieldID fld = _Jv_FromReflectedField (field); _Jv_ushort flags = fld->getModifiers(); - if (! field->isAccessible () - && ! _Jv_CheckAccess (caller, field->getDeclaringClass(), flags)) - throw new java::lang::IllegalAccessException; + + // Check accessibility, if required. + if (! (Modifier::isPublic (flags) || field->isAccessible())) + { + gnu::gcj::runtime::StackTrace *t + = new gnu::gcj::runtime::StackTrace(7); + try + { + // We want to skip all the frames on the stack from this class. + for (int i = 1; !caller || caller == &Field::class$; i++) + caller = t->classAt (i); + } + catch (::java::lang::ArrayIndexOutOfBoundsException *e) + { + } + + if (! _Jv_CheckAccess (caller, field->getDeclaringClass(), flags)) + throw new java::lang::IllegalAccessException; + } - if (flags & java::lang::reflect::Modifier::STATIC) + if (flags & Modifier::STATIC) { jclass fldClass = field->getDeclaringClass (); JvInitClass(fldClass); diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc index 6330c4b4675..525a4a0e9c9 100644 --- a/libjava/java/lang/reflect/natMethod.cc +++ b/libjava/java/lang/reflect/natMethod.cc @@ -28,6 +28,7 @@ details. */ #include <java/lang/Long.h> #include <java/lang/Float.h> #include <java/lang/Double.h> +#include <java/lang/IllegalAccessException.h> #include <java/lang/IllegalArgumentException.h> #include <java/lang/NullPointerException.h> #include <java/lang/ArrayIndexOutOfBoundsException.h> @@ -141,48 +142,51 @@ get_ffi_type (jclass klass) jobject java::lang::reflect::Method::invoke (jobject obj, jobjectArray args) { + using namespace java::lang::reflect; + if (parameter_types == NULL) getType (); - - gnu::gcj::runtime::StackTrace *t - = new gnu::gcj::runtime::StackTrace(4); - Class *caller = NULL; - try - { - for (int i = 1; !caller; i++) - { - caller = t->classAt (i); - } - } - catch (::java::lang::ArrayIndexOutOfBoundsException *e) - { - } - + jmethodID meth = _Jv_FromReflectedMethod (this); - jclass klass; - if (! java::lang::reflect::Modifier::isStatic(meth->accflags)) - { - if (! obj) - throw new java::lang::NullPointerException; - klass = obj->getClass(); - if (! declaringClass->isAssignableFrom(klass)) - throw new java::lang::IllegalArgumentException; - - // Find the possibly overloaded method based on the runtime type - // of the object. - meth = _Jv_LookupDeclaredMethod (klass, meth->name, meth->signature); - } - else + + jclass objClass; + + if (Modifier::isStatic(meth->accflags)) { // We have to initialize a static class. It is safe to do this // here and not in _Jv_CallAnyMethodA because JNI initializes a // class whenever a method lookup is done. _Jv_InitClass (declaringClass); - klass = declaringClass; + objClass = declaringClass; + } + else + { + objClass = JV_CLASS (obj); + + if (! _Jv_IsAssignableFrom (declaringClass, objClass)) + throw new java::lang::IllegalArgumentException; } - if (! isAccessible() && ! _Jv_CheckAccess(caller, klass, meth->accflags)) - throw new IllegalArgumentException; + // Check accessibility, if required. + if (! (Modifier::isPublic (meth->accflags) || this->isAccessible())) + { + gnu::gcj::runtime::StackTrace *t + = new gnu::gcj::runtime::StackTrace(4); + Class *caller = NULL; + try + { + for (int i = 1; !caller; i++) + { + caller = t->classAt (i); + } + } + catch (::java::lang::ArrayIndexOutOfBoundsException *e) + { + } + + if (! _Jv_CheckAccess(caller, objClass, meth->accflags)) + throw new IllegalAccessException; + } return _Jv_CallAnyMethodA (obj, return_type, meth, false, parameter_types, args); @@ -333,6 +337,7 @@ _Jv_CallAnyMethodA (jobject obj, jclass return_type, jmethodID meth, jboolean is_constructor, + jboolean is_virtual_call, JArray<jclass> *parameter_types, jvalue *args, jvalue *result, @@ -457,9 +462,21 @@ _Jv_CallAnyMethodA (jobject obj, break; } + void *ncode; + + if (is_virtual_call) + { + _Jv_VTable *vtable = *(_Jv_VTable **) obj; + ncode = vtable->get_method (meth->index); + } + else + { + ncode = meth->ncode; + } + try { - ffi_call (&cif, (void (*)()) meth->ncode, &ffi_result, values); + ffi_call (&cif, (void (*)()) ncode, &ffi_result, values); } catch (Throwable *ex) { @@ -591,6 +608,7 @@ _Jv_CallAnyMethodA (jobject obj, jvalue ret_value; _Jv_CallAnyMethodA (obj, return_type, meth, is_constructor, + _Jv_isVirtualMethod (meth), parameter_types, argvals, &ret_value, false); diff --git a/libjava/java/nio/ByteOrder.java b/libjava/java/nio/ByteOrder.java index f1001a33b71..b4fcbe53a8b 100644 --- a/libjava/java/nio/ByteOrder.java +++ b/libjava/java/nio/ByteOrder.java @@ -38,6 +38,8 @@ exception statement from your version. */ package java.nio; +import gnu.classpath.Configuration; + /** * @author Michael Koch * @since 1.4 @@ -47,6 +49,15 @@ public final class ByteOrder public static final ByteOrder BIG_ENDIAN = new ByteOrder(); public static final ByteOrder LITTLE_ENDIAN = new ByteOrder(); + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + /** * Returns the native byte order of the platform currently running. */ diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java index 4028b545d25..a54c20693fe 100644 --- a/libjava/java/nio/DirectByteBufferImpl.java +++ b/libjava/java/nio/DirectByteBufferImpl.java @@ -38,10 +38,20 @@ exception statement from your version. */ package java.nio; +import gnu.classpath.Configuration; import gnu.gcj.RawData; class DirectByteBufferImpl extends ByteBuffer { + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + RawData address; private int offset; private boolean readOnly; diff --git a/libjava/java/nio/channels/FileChannelImpl.java b/libjava/java/nio/channels/FileChannelImpl.java index 85113a0287b..a14a7e1dd43 100644 --- a/libjava/java/nio/channels/FileChannelImpl.java +++ b/libjava/java/nio/channels/FileChannelImpl.java @@ -47,6 +47,7 @@ import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.MappedByteBufferImpl; +import gnu.classpath.Configuration; import gnu.gcj.RawData; /** @@ -59,6 +60,15 @@ import gnu.gcj.RawData; public class FileChannelImpl extends FileChannel { + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + public RawData map_address; int length; diff --git a/libjava/java/text/RuleBasedCollator.java b/libjava/java/text/RuleBasedCollator.java index c05b45d5049..27507524876 100644 --- a/libjava/java/text/RuleBasedCollator.java +++ b/libjava/java/text/RuleBasedCollator.java @@ -180,6 +180,9 @@ public class RuleBasedCollator extends Collator */ public RuleBasedCollator (String rules) throws ParseException { + if (rules.equals ("")) + throw new ParseException ("empty rule set", 0); + this.rules = rules; this.frenchAccents = false; @@ -225,7 +228,19 @@ public class RuleBasedCollator extends Collator if (argument.length() == 0) throw new ParseException ("invalid character", save); String arg = argument.toString(); - int item_index = vec.indexOf(arg); + int item_index = -1; + + for (int j = 0; j < vec.size(); ++j) + { + CollationElement e = (CollationElement) vec.elementAt (j); + + if (arg.equals (e.key)) + { + item_index = j; + break; + } + } + if (c != '&') { // If the argument already appears in the vector, then we @@ -535,8 +550,7 @@ public class RuleBasedCollator extends Collator private final boolean is_special (char c) { // Rules from JCL book. - return ((c >= 0x0009 && c <= 0x000d) - || (c >= 0x0020 && c <= 0x002f) + return ((c >= 0x0021 && c <= 0x002f) || (c >= 0x003a && c <= 0x0040) || (c >= 0x005b && c <= 0x0060) || (c >= 0x007b && c <= 0x007e)); @@ -549,15 +563,20 @@ public class RuleBasedCollator extends Collator int len = rules.length(); while (index < len) { - char c = rules.charAt(index); - if (c == '\'' && index + 2 < len - && rules.charAt(index + 2) == '\'' - && is_special (rules.charAt(index + 1))) - index += 2; - else if (is_special (c) || Character.isWhitespace(c)) + char c = rules.charAt (index); + if (c == '\'' + && index + 2 < len + && rules.charAt (index + 2) == '\'') + { + result.append (rules.charAt (index + 1)); + index += 2; + } + else if (is_special (c)) return index; - result.append(c); - ++index; + else if (!Character.isWhitespace (c)) + result.append (c); + + ++index; } return index; } diff --git a/libjava/java/util/TreeMap.java b/libjava/java/util/TreeMap.java index e0cff28e02c..9426a0bc7f5 100644 --- a/libjava/java/util/TreeMap.java +++ b/libjava/java/util/TreeMap.java @@ -533,7 +533,7 @@ public class TreeMap extends AbstractMap * key's mapping. * * @param key the key used to locate the value - * @param value the value to be stored in the HashMap + * @param value the value to be stored in the Map * @return the prior mapping of the key, or null if there was none * @throws ClassCastException if key is not comparable to current map keys * @throws NullPointerException if key is null, but the comparator does @@ -584,11 +584,11 @@ public class TreeMap extends AbstractMap } /** - * Copies all elements of the given map into this hashtable. If this table + * Copies all elements of the given map into this TreeMap. If this map * already has a mapping for a key, the new mapping replaces the current * one. * - * @param m the map to be hashed into this + * @param m the map to be added * @throws ClassCastException if a key in m is not comparable with keys * in the map * @throws NullPointerException if a key in m is null, and the comparator @@ -1374,7 +1374,7 @@ public class TreeMap extends AbstractMap } /** - * Iterate over HashMap's entries. This implementation is parameterized + * Iterate over TreeMap's entries. This implementation is parameterized * to give a sequential view of keys, values, or entries. * * @author Eric Blake <ebb9@email.byu.edu> diff --git a/libjava/java/util/logging/ErrorManager.java b/libjava/java/util/logging/ErrorManager.java index cc36bf6301c..7381a5227ac 100644 --- a/libjava/java/util/logging/ErrorManager.java +++ b/libjava/java/util/logging/ErrorManager.java @@ -2,7 +2,7 @@ -- a class for dealing with errors that a Handler encounters during logging -Copyright (C) 2002 Free Software Foundation, Inc. +Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -100,7 +100,16 @@ public class ErrorManager public static final int FORMAT_FAILURE = 5; - private boolean everUsed = false; + /** + * Indicates whether the {@link #error} method of this ErrorManager + * has ever been used. + * + * Declared volatile in order to correctly support the + * double-checked locking idiom (once the revised Java Memory Model + * gets adopted); see Classpath bug #2944. + */ + private volatile boolean everUsed = false; + public ErrorManager() { @@ -125,13 +134,19 @@ public class ErrorManager if (everUsed) return; - synchronized (ErrorManager.class) + synchronized (this) { /* The double check is intentional. If the first check was * omitted, the monitor would have to be entered every time * error() method was called. If the second check was * omitted, the code below could be executed by multiple * threads simultaneously. + * + * This is the 'double-checked locking' idiom, which is broken + * with the current version of the Java memory model. However, + * we assume that JVMs will have adopted a revised version of + * the Java Memory Model by the time GNU Classpath gains + * widespread acceptance. See Classpath bug #2944. */ if (everUsed) return; diff --git a/libjava/jni.cc b/libjava/jni.cc index 857ee4bc3dd..e2e10defd0a 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -767,9 +767,6 @@ static T obj = unwrap (obj); klass = unwrap (klass); - if (style == normal) - id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature); - jclass decl_class = klass ? klass : obj->getClass (); JvAssert (decl_class != NULL); @@ -791,6 +788,7 @@ static T jvalue result; _Jv_CallAnyMethodA (obj, return_type, id, style == constructor, + style == normal, arg_types, args, &result); return wrap_value (env, extract_from_jvalue<T>(result)); @@ -826,9 +824,6 @@ static T obj = unwrap (obj); klass = unwrap (klass); - if (style == normal) - id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature); - jclass decl_class = klass ? klass : obj->getClass (); JvAssert (decl_class != NULL); @@ -857,6 +852,7 @@ static T jvalue result; _Jv_CallAnyMethodA (obj, return_type, id, style == constructor, + style == normal, arg_types, arg_copy, &result); return wrap_value (env, extract_from_jvalue<T>(result)); @@ -877,9 +873,6 @@ static void obj = unwrap (obj); klass = unwrap (klass); - if (style == normal) - id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature); - jclass decl_class = klass ? klass : obj->getClass (); JvAssert (decl_class != NULL); @@ -899,6 +892,7 @@ static void _Jv_CallAnyMethodA (obj, return_type, id, style == constructor, + style == normal, arg_types, args, NULL); } catch (jthrowable t) @@ -924,9 +918,6 @@ static void (JNICALL _Jv_JNI_CallAnyVoidMethodA) (JNIEnv *env, jobject obj, jclass klass, jmethodID id, jvalue *args) { - if (style == normal) - id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature); - jclass decl_class = klass ? klass : obj->getClass (); JvAssert (decl_class != NULL); @@ -950,6 +941,7 @@ static void _Jv_CallAnyMethodA (obj, return_type, id, style == constructor, + style == normal, arg_types, args, NULL); } catch (jthrowable t) diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c index 04eb2e5a524..08a9742b69e 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c @@ -36,6 +36,7 @@ exception statement from your version. */ #include "gtkpeer.h" +#include "gdkfont.h" #include "gnu_java_awt_peer_gtk_GdkGraphics2D.h" #include <gdk/gdktypes.h> #include <gdk/gdkprivate.h> @@ -45,6 +46,8 @@ #include <gdk-pixbuf/gdk-pixdata.h> #include <cairo.h> +#include <cairo-xlib.h> + #include <stdio.h> #include <stdlib.h> @@ -198,9 +201,9 @@ init_graphics2d_as_renderable (struct graphics2d *gr) vis = gdk_x11_visual_get_xvisual (gdk_drawable_get_visual (gr->drawable)); g_assert (vis != NULL); - gr->surface = cairo_surface_create_for_drawable (dpy, draw, vis, - CAIRO_FORMAT_ARGB32, - DefaultColormap (dpy, DefaultScreen (dpy))); + gr->surface = cairo_xlib_surface_create (dpy, draw, vis, + CAIRO_FORMAT_ARGB32, + DefaultColormap (dpy, DefaultScreen (dpy))); g_assert (gr->surface != NULL); g_assert (gr->cr != NULL); cairo_set_target_surface (gr->cr, gr->surface); @@ -378,8 +381,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable gc = gdk_gc_new (dst->drawable); g_assert (gc != NULL); - gdk_draw_drawable(dst->drawable, gc, src->drawable, - 0, 0, x, y, width, height); + gdk_draw_drawable(dst->drawable, gc, src->drawable, + 0, 0, x, y, width, height); g_object_unref (gc); @@ -474,7 +477,6 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose g_object_unref (gr->drawbuf); g_object_unref (gr->drawable); - free (gr); if (gr->pattern) cairo_surface_destroy (gr->pattern); @@ -483,6 +485,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose free (gr->pattern_pixels); if (gr->debug) printf ("disposed of graphics2d\n"); + free (gr); gdk_threads_leave (); } @@ -662,6 +665,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels begin_drawing_operation (gr); + { cairo_surface_t *surf = cairo_surface_create_for_image ((char *)jpixels, CAIRO_FORMAT_ARGB32, @@ -670,8 +674,9 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels cairo_show_surface (gr->cr, surf, w, h); cairo_surface_destroy (surf); } + - end_drawing_operation (gr); + end_drawing_operation (gr); (*env)->ReleaseIntArrayElements (env, jarr, jpixels, 0); @@ -723,6 +728,82 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix update_pattern_transform (gr); } +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont + (JNIEnv *env, jobject obj, jobject font) +{ + struct graphics2d *gr = NULL; + struct peerfont *pfont = NULL; + cairo_font_t *ft = NULL; + FT_Face face = NULL; + + gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); + g_assert (gr != NULL); + + pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font); + g_assert (pfont != NULL); + + gdk_threads_enter (); + + face = pango_ft2_font_get_face (pfont->font); + g_assert (face != NULL); + + ft = cairo_ft_font_create_for_ft_face (face); + g_assert (ft != NULL); + + if (gr->debug) printf ("cairo_set_font '%s'\n", + face->family_name); + + cairo_set_font (gr->cr, ft); + + cairo_scale_font (gr->cr, + pango_font_description_get_size (pfont->desc) / + (double)PANGO_SCALE); + + cairo_font_destroy (ft); + + gdk_threads_leave (); +} + +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoShowGlyphs + (JNIEnv *env, jobject obj, jintArray jcodes, jfloatArray jposns, jint nglyphs) +{ + struct graphics2d *gr = NULL; + cairo_glyph_t *glyphs = NULL; + jfloat *posns = NULL; + jint *codes = NULL; + jint i; + + gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); + g_assert (gr != NULL); + + if (gr->debug) printf ("cairo_show_glyphs (%d glyphs)\n", nglyphs); + + glyphs = malloc (sizeof(cairo_glyph_t) * nglyphs); + g_assert (glyphs); + + codes = (*env)->GetIntArrayElements (env, jcodes, NULL); + g_assert (codes != NULL); + + posns = (*env)->GetFloatArrayElements (env, jposns, NULL); + g_assert (posns != NULL); + + for (i = 0; i < nglyphs; ++i) + { + glyphs[i].index = codes[i]; + glyphs[i].x = (double) posns[2*i]; + glyphs[i].y = (double) posns[2*i + 1]; + } + + (*env)->ReleaseIntArrayElements (env, jcodes, codes, 0); + (*env)->ReleaseFloatArrayElements (env, jposns, posns, 0); + + begin_drawing_operation (gr); + cairo_show_glyphs (gr->cr, glyphs, nglyphs); + end_drawing_operation (gr); + + free(glyphs); +} + JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator (JNIEnv *env, jobject obj, jint op) { diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c index 79d7f7d55b2..5d144f8ec65 100644 --- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c +++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c @@ -57,6 +57,8 @@ jmethodID postAdjustmentEventID; jmethodID postItemEventID; jmethodID postListItemEventID; jmethodID postTextEventID; +jmethodID postWindowEventID; + JNIEnv *gdk_env; #ifdef PORTABLE_NATIVE_SYNC @@ -163,6 +165,9 @@ Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz) "postMouseEvent", "(IJIIIIZ)V"); postConfigureEventID = (*env)->GetMethodID (env, gtkwindowpeer, "postConfigureEvent", "(IIIIIIII)V"); + postWindowEventID = (*env)->GetMethodID (env, gtkwindowpeer, + "postWindowEvent", + "(ILjava/awt/Window;I)V"); postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer, "postExposeEvent", "(IIII)V"); postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer, 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 3cac71835b7..d71f36a4298 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 @@ -41,6 +41,23 @@ exception statement from your version. */ #include "gnu_java_awt_peer_gtk_GtkFramePeer.h" #include <gdk/gdkprivate.h> #include <gdk/gdkx.h> +#include <X11/Xatom.h> + +static void window_delete_cb (GtkWidget *widget, GdkEvent *event, + jobject peer); +static void window_destroy_cb (GtkWidget *widget, GdkEvent *event, + jobject peer); +static void window_show_cb (GtkWidget *widget, jobject peer); +static gboolean window_focus_in_cb (GtkWidget * widget, + GdkEventFocus *event, + jobject peer); +static gboolean window_focus_out_cb (GtkWidget * widget, + GdkEventFocus *event, + jobject peer); +static gboolean window_window_state_cb (GtkWidget *widget, + GdkEvent *event, + jobject peer); +static jint window_get_new_state (GtkWidget *widget); /* * Make a new window. @@ -152,6 +169,25 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window); + /* Connect signals for window event support. */ + g_signal_connect (G_OBJECT (ptr), "delete-event", + G_CALLBACK (window_delete_cb), obj); + + g_signal_connect (G_OBJECT (ptr), "destroy-event", + G_CALLBACK (window_destroy_cb), obj); + + g_signal_connect (G_OBJECT (ptr), "show", + G_CALLBACK (window_show_cb), obj); + + g_signal_connect (G_OBJECT (ptr), "focus-in-event", + G_CALLBACK (window_focus_in_cb), obj); + + g_signal_connect (G_OBJECT (ptr), "focus-out-event", + G_CALLBACK (window_focus_out_cb), obj); + + g_signal_connect (G_OBJECT (ptr), "window-state-event", + G_CALLBACK (window_window_state_cb), obj); + gdk_threads_leave (); } @@ -302,3 +338,154 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight return height; } + +static void +window_delete_cb (GtkWidget *widget __attribute__((unused)), + GdkEvent *event __attribute__((unused)), + jobject peer) +{ + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_CLOSING, + (jobject) NULL, (jint) 0); +} + +static void +window_destroy_cb (GtkWidget *widget __attribute__((unused)), + GdkEvent *event __attribute__((unused)), + jobject peer) +{ + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_CLOSED, + (jobject) NULL, (jint) 0); +} + +static void +window_show_cb (GtkWidget *widget __attribute__((unused)), + jobject peer) +{ + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_OPENED, + (jobject) NULL, (jint) 0); +} + +static gboolean +window_focus_in_cb (GtkWidget * widget __attribute__((unused)), + GdkEventFocus *event __attribute__((unused)), + jobject peer) +{ + /* FIXME: when hiding then showing, we get two sets of + (LOST_FOCUS/DEACTIVATED, ACTIVATED/GAINED_FOCUS) events. */ + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_ACTIVATED, + (jobject) NULL, (jint) 0); + + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_GAINED_FOCUS, + (jobject) NULL, (jint) 0); + return TRUE; +} + +static gboolean +window_focus_out_cb (GtkWidget * widget __attribute__((unused)), + GdkEventFocus *event __attribute__((unused)), + jobject peer) +{ + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_LOST_FOCUS, + (jobject) NULL, (jint) 0); + + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_DEACTIVATED, + (jobject) NULL, (jint) 0); + return TRUE; +} + +static gboolean +window_window_state_cb (GtkWidget *widget, + GdkEvent *event, + jobject peer) +{ + jint new_state; + + /* Handle WINDOW_ICONIFIED and WINDOW_DEICONIFIED events. */ + if (event->window_state.changed_mask & GDK_WINDOW_STATE_ICONIFIED) + { + /* We've either been iconified or deiconified. */ + if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED) + { + /* We've been iconified. */ + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_ICONIFIED, + (jobject) NULL, (jint) 0); + } + else + { + /* We've been deiconified. */ + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_DEICONIFIED, + (jobject) NULL, (jint) 0); + } + } + + /* Post a WINDOW_STATE_CHANGED event, passing the new frame state to + GtkWindowPeer. */ + new_state = AWT_FRAME_STATE_NORMAL; + + if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED) + new_state |= AWT_FRAME_STATE_ICONIFIED; + + new_state |= window_get_new_state (widget); + + (*gdk_env)->CallVoidMethod (gdk_env, peer, + postWindowEventID, + (jint) AWT_WINDOW_STATE_CHANGED, + (jobject) NULL, new_state); + return TRUE; +} + +static jint +window_get_new_state (GtkWidget *widget) +{ + GdkDisplay *display = gtk_widget_get_display(widget); + jint new_state = AWT_FRAME_STATE_NORMAL; + Atom type; + gint format; + gulong atom_count; + gulong bytes_after; + Atom *atom_list = NULL; + gulong i; + + XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (widget->window), + gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"), + 0, G_MAXLONG, False, XA_ATOM, &type, &format, &atom_count, + &bytes_after, (guchar **)&atom_list); + + if (type != None) + { + Atom maxvert = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT"); + Atom maxhorz = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ"); + + i = 0; + while (i < atom_count) + { + if (atom_list[i] == maxhorz) + new_state |= AWT_FRAME_STATE_MAXIMIZED_HORIZ; + else if (atom_list[i] == maxvert) + new_state |= AWT_FRAME_STATE_MAXIMIZED_VERT; + + ++i; + } + + XFree (atom_list); + } + return new_state; +} diff --git a/libjava/jni/gtk-peer/gtkpeer.h b/libjava/jni/gtk-peer/gtkpeer.h index 879f0b0b457..8f8ec40c08c 100644 --- a/libjava/jni/gtk-peer/gtkpeer.h +++ b/libjava/jni/gtk-peer/gtkpeer.h @@ -347,6 +347,23 @@ struct graphics #define AWT_FOCUS_LOST 1004 #define AWT_FOCUS_GAINED 1005 +#define AWT_WINDOW_OPENED 200 +#define AWT_WINDOW_CLOSING 201 +#define AWT_WINDOW_CLOSED 202 +#define AWT_WINDOW_ICONIFIED 203 +#define AWT_WINDOW_DEICONIFIED 204 +#define AWT_WINDOW_ACTIVATED 205 +#define AWT_WINDOW_DEACTIVATED 206 +#define AWT_WINDOW_GAINED_FOCUS 207 +#define AWT_WINDOW_LOST_FOCUS 208 +#define AWT_WINDOW_STATE_CHANGED 209 + +#define AWT_FRAME_STATE_NORMAL 0 +#define AWT_FRAME_STATE_ICONIFIED 1 +#define AWT_FRAME_STATE_MAXIMIZED_HORIZ 2 +#define AWT_FRAME_STATE_MAXIMIZED_VERT 4 +#define AWT_FRAME_STATE_MAXIMIZED_BOTH 6 + #define AWT_STYLE_PLAIN 0 #define AWT_STYLE_BOLD 1 #define AWT_STYLE_ITALIC 2 @@ -364,6 +381,8 @@ extern jmethodID postAdjustmentEventID; extern jmethodID postItemEventID; extern jmethodID postListItemEventID; extern jmethodID postTextEventID; +extern jmethodID postWindowEventID; + extern jmethodID syncAttrsID; extern jclass gdkColor; extern jmethodID gdkColorID; diff --git a/libjava/posix-threads.cc b/libjava/posix-threads.cc index 656f483e96d..03ae4535a05 100644 --- a/libjava/posix-threads.cc +++ b/libjava/posix-threads.cc @@ -193,7 +193,7 @@ _Jv_CondWait (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu, int _Jv_CondNotify (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu) { - if (_Jv_PthreadCheckMonitor (mu)) + if (_Jv_MutexCheckMonitor (mu)) return _JV_NOT_OWNER; _Jv_Thread_t *target; @@ -232,7 +232,7 @@ _Jv_CondNotify (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu) int _Jv_CondNotifyAll (_Jv_ConditionVariable_t *cv, _Jv_Mutex_t *mu) { - if (_Jv_PthreadCheckMonitor (mu)) + if (_Jv_MutexCheckMonitor (mu)) return _JV_NOT_OWNER; _Jv_Thread_t *target; diff --git a/libjava/resolve.cc b/libjava/resolve.cc index ce1af8d2586..d71e1251ff0 100644 --- a/libjava/resolve.cc +++ b/libjava/resolve.cc @@ -575,6 +575,16 @@ _Jv_PrepareClass(jclass klass) _Jv_InterpMethod *im = reinterpret_cast<_Jv_InterpMethod *> (imeth); _Jv_VerifyMethod (im); clz->methods[i].ncode = im->ncode (); + + // Resolve ctable entries pointing to this method. See + // _Jv_Defer_Resolution. + void **code = (void **)imeth->deferred; + while (code) + { + void **target = (void **)*code; + *code = clz->methods[i].ncode; + code = target; + } } } diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index 871b0e76d1c..74e4a64e351 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2003-10-22 Tom Tromey <tromey@redhat.com> + + PR libgcj/12416: + * libjava.lang/PR12416.out: New file. + * libjava.lang/PR12416.java: New file. + + PR libgcj/12656: + * libjava.lang/PR12656.java: New file. + * libjava.lang/PR12656.out: New file. + +2003-10-21 Tom Tromey <tromey@redhat.com> + + * lib/libjava.exp (find_javac): Use -Wno-unreachable-bytecode. + 2003-10-08 Tom Tromey <tromey@redhat.com> * libjava.mauve/xfails: Removed some tests. diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in index a45ec55ddb2..1527ee83291 100644 --- a/libjava/testsuite/Makefile.in +++ b/libjava/testsuite/Makefile.in @@ -76,6 +76,7 @@ DIVIDESPEC = @DIVIDESPEC@ DLLTOOL = @DLLTOOL@ EXCEPTIONSPEC = @EXCEPTIONSPEC@ EXEEXT = @EXEEXT@ +EXTRA_CC_FILES = @EXTRA_CC_FILES@ GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@ GCDEPS = @GCDEPS@ GCINCS = @GCINCS@ diff --git a/libjava/win32.cc b/libjava/win32.cc index abe768ae5bd..e44b7b28729 100644 --- a/libjava/win32.cc +++ b/libjava/win32.cc @@ -12,6 +12,7 @@ details. */ #include <platform.h> #include <sys/timeb.h> #include <stdlib.h> +#include <fcntl.h> #include <java/lang/ArithmeticException.h> #include <java/lang/UnsupportedOperationException.h> @@ -342,3 +343,9 @@ _Jv_select (int n, fd_set *readfds, fd_set *writefds, } return r; } + +int +_Jv_pipe (int filedes[2]) +{ + return _pipe (filedes, 4096, _O_BINARY); +} |