? tmpcvs6705
? tmpwrk6705
Index: configure
===================================================================
RCS file: /cvs/kaffe/kaffe/configure,v
retrieving revision 1.313
diff -u -r1.313 configure
--- configure	28 Apr 2004 20:42:50 -0000	1.313
+++ configure	6 May 2004 08:55:43 -0000
@@ -40970,6 +40970,157 @@
 
 
 
+for ac_header in ieeefp.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------ ##
+## Report this to kaffe@kaffe.org ##
+## ------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
 for ac_header in ia64intrin.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -45440,6 +45591,108 @@
 fi
 rm -f conftest.data
 
+
+
+for ac_func in fpsetround
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
 
 
 
Index: configure.ac
===================================================================
RCS file: /cvs/kaffe/kaffe/configure.ac,v
retrieving revision 1.12
diff -u -r1.12 configure.ac
--- configure.ac	28 Apr 2004 20:42:55 -0000	1.12
+++ configure.ac	6 May 2004 08:55:51 -0000
@@ -982,6 +982,9 @@
 AC_CHECK_HEADERS([wtypes.h])
 AC_CHECK_HEADERS([zlib.h])
 
+dnl needed for FPU control
+AC_CHECK_HEADERS([ieeefp.h])
+
 dnl needed for ia64
 AC_CHECK_HEADERS([ia64intrin.h])
 
@@ -1163,6 +1166,7 @@
 AC_FUNC_MMAP
 AC_FUNC_UTIME_NULL
 
+AC_CHECK_FUNCS([fpsetround])
 AC_CHECK_FUNCS([select socket getsockname getpagesize])
 AC_CHECK_FUNCS([memcpy memmove])
 AC_CHECK_FUNCS([mkdir rmdir])
Index: config/config.h.in
===================================================================
RCS file: /cvs/kaffe/kaffe/config/config.h.in,v
retrieving revision 1.99
diff -u -r1.99 config.h.in
--- config/config.h.in	22 Apr 2004 16:28:08 -0000	1.99
+++ config/config.h.in	6 May 2004 08:55:51 -0000
@@ -102,6 +102,9 @@
 /* Define to 1 if you have the `fork' function. */
 #undef HAVE_FORK
 
+/* Define to 1 if you have the `fpsetround' function. */
+#undef HAVE_FPSETROUND
+
 /* Define to 1 if you have the `fsync' function. */
 #undef HAVE_FSYNC
 
@@ -182,6 +185,9 @@
 
 /* Define to 1 if you have the <iconv.h> header file. */
 #undef HAVE_ICONV_H
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+#undef HAVE_IEEEFP_H
 
 /* Define to 1 if you have the <ifaddrs.h> header file. */
 #undef HAVE_IFADDRS_H
Index: kaffe/kaffevm/intrp/icode.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/intrp/icode.h,v
retrieving revision 1.20
diff -u -r1.20 icode.h
--- kaffe/kaffevm/intrp/icode.h	1 Feb 2004 22:14:53 -0000	1.20
+++ kaffe/kaffevm/intrp/icode.h	6 May 2004 08:55:52 -0000
@@ -12,6 +12,15 @@
 #ifndef __icode_h
 #define	__icode_h
 
+#include <float.h>
+
+#if defined(HAVE_IEEEFP_H)
+/* required for fpgetround */
+#include <ieeefp.h>
+#endif /* defined(HAVE_IEEEFP_H) */
+
+#include "fp.h"
+
 #define	move_long_const(t, c)			(t)[0].v.tlong = (c)
 #define	add_long(t, f1, f2)			(t)[0].v.tlong = (f1)[0].v.tlong + (f2)[0].v.tlong
 #define	sub_long(t, f1, f2)			(t)[0].v.tlong = (f1)[0].v.tlong - (f2)[0].v.tlong
@@ -269,7 +278,120 @@
 #define	cvt_float_int(t, f)			(t)[0].v.tint = soft_cvtfi((f)[0].v.tfloat)
 #define	cvt_float_double(t, f)			(t)[0].v.tdouble = (f)[0].v.tfloat
 #define	cvt_double_int(t, f)			(t)[0].v.tint = soft_cvtdi((f)[0].v.tdouble)
-#define	cvt_double_float(t, f)			(t)[0].v.tfloat = (f)[0].v.tdouble
+
+/**
+ * Convert a double to a float.
+ *
+ * Special case handling is performed to avoid
+ * getting undefined behaviour if the double can not be
+ * represented as a float.
+ *
+ * If the absolute value is lager than FLT_MAX, signed
+ * infinity is returned. If the absolute value is smaller
+ * than the smallest denormalized float value, signed 0
+ * is returned.
+ *
+ * Rounding can also be an issue, if the double value can
+ * not be represented precisely by a float. C89 doesn't
+ * require rounding when a double is converted to a float,
+ * K&R does. C99 requires rounding again, and specifies
+ * round-to-nearest rounding for conversions between 
+ * floating point types.
+ *
+ * The only way to specify rounding portably seems to be
+ * to use operating system specific functions.
+ *
+ * @param d value to convert
+ * @return converted float
+ */
+ 
+static inline
+jfloat
+soft_convert_double_float(jdouble d) {
+
+	const float FLOAT_POSITIVE_INFINITY = intToFloat(0x7f800000);
+	const float FLOAT_NEGATIVE_INFINITY = intToFloat(0xff800000);
+	const float FLOAT_DENORMALIZED_MINIMUM = intToFloat(0x00000001);
+
+	/* Get the absolute value of the parameter. */
+	jdouble abs_val = fabs(d);
+
+	/* Check for overflow. */
+
+	/* An overflow can happen if the absolute value of the 
+	 * parameter to convert is greater than the maximum 
+	 * representable float.
+	 */
+
+	/* NOTE: I should probably use java_lang_Float_MAX_VALUE
+	 * 	 here.
+	 */
+	if (abs_val > FLT_MAX) {
+		/* Java Language Specification 2n Ed §4.2.4 
+		 * demands that overflow results in signed
+		 * infinity. C standard says leaving the
+		 * domain range results in undefined behaviour,
+		 * so we need to check for it and make adjustments.
+		 */
+
+		if (d > 0.0) {
+			return FLOAT_POSITIVE_INFINITY;
+		}
+		else {
+			return FLOAT_NEGATIVE_INFINITY;
+		}
+	}
+
+	/* check for underflow */
+	/* underflow can happen if the parameter to convert is
+	 * between (+/-)0.0 and (+/-)smallest denormalized float.
+	 */
+	/* NOTE: I'm not sure if this is really necessary, though.
+	 */
+	/* NOTE: I'm also not sure whether we're doing the rounding
+	 *	 as per spec. It may be necessary to round 
+	 * 	 denormalized doubles up to FLOAT_DENORMALIZED_MINIMUM
+	 *	 in some cases.
+	 */
+	else if (abs_val > 0.0 && abs_val < FLOAT_DENORMALIZED_MINIMUM) {
+		/* Java Language Specification 2n Ed §4.2.4
+                 * demands that underflow results in denormalized
+		 * value or signed 0. So if the double is smaller
+		 * than smallest denormalized float value, we
+		 * return a signed 0.
+		 */
+
+		if (d >= 0.0) {
+			return 0.0f;
+		}
+		else {
+			return -0.0f;
+		}
+	}
+
+	/* leave the rest (NaN, in-range-doubles) to the C compiler */
+
+	else {
+
+		jfloat result;
+
+		/* Set rounding to round-to-nearest */
+#if defined(HAVE_FPSETROUND)
+		fp_rnd old_rnd_dir = fpsetround(FP_RN);
+#endif /* defined(HAVE_FPSETROUND) */
+
+		result = (float) d;
+
+		/* Reset rounding */
+#if defined(HAVE_FPSETROUND)
+		fpsetround(old_rnd_dir);
+#endif /* defined(HAVE_FPSETROUND) */
+
+		return result;
+	}
+}
+
+#define	cvt_double_float(t, f)			(t)[0].v.tfloat = soft_convert_double_float((f)[0].v.tdouble)
 
 #define	softcall_lookupinterfacemethod(r, n, t)	(r)[0].v.taddr = soft_lookupinterfacemethod((t)[0].v.taddr, (n)->class, (n)->idx)
 #define	softcall_new(r, t)			(r)->v.taddr = soft_new(t)
Index: libraries/javalib/java/text/Format.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/text/Format.java,v
retrieving revision 1.17
diff -u -r1.17 Format.java
--- libraries/javalib/java/text/Format.java	23 Apr 2004 17:35:12 -0000	1.17
+++ libraries/javalib/java/text/Format.java	6 May 2004 08:55:56 -0000
@@ -67,7 +67,7 @@
   {
     static final long serialVersionUID = 276966692217360283L;
    
-    public Field(String name)
+    protected Field(String name)
     {
       super(name);
     }
