[MLton-commit] r5827
Matthew Fluet
fluet at mlton.org
Mon Aug 6 14:48:36 PDT 2007
Use generalized gdtoa functions to perform conversions at specified rounding modes.
Only Real.{fmt StringCvt.EXACT,fromDecimal,toDecimal} are specified to
operate under TO_NEAREST semantics.
Real.{fmt StringCVT.{FIX,GEN,SCI},fromString,scan,toString} should all
operate under the semantics of the current rounding mode.
This means that while
Real.fromDecimal (IEEEReal.fromString (Real.fmt StringCvt.EXACT r))
and
Real.fromDecimal (Real.toDecimal r)
and
Real.fromDecimal (IEEEReal.fromString (IEEReal.toString (Real.toDecimal r)))
are all guaranteed to return r (under any ambient rounding mode), it
is not the case that
Real.fromString (Real.fmt StringCvt.EXACT r)
is guaranteed to return r; the exact decimal approx (as a string) need
only convert to r under the TO_NEAREST rounding mode.
However,
Real.fromString (Real.fmt (StringCvt.{FIX,GEN,SCI} (SOME 1000)) r)
should return r (under any ambient rounding mode); that is, a
real->string conversion (with sufficient digits of precision) will
yield a string that converts back to the same real at the same
rounding mode. (The PLDI'90 papers term this 'correct rounding', and
the gdtoa library should provide it.)
----------------------------------------------------------------------
U mlton/trunk/basis-library/primitive/basis-ffi.sml
U mlton/trunk/basis-library/primitive/prim-real.sml
U mlton/trunk/basis-library/real/real.sig
U mlton/trunk/basis-library/real/real.sml
U mlton/trunk/doc/changelog
U mlton/trunk/runtime/basis/Real/gdtoa.c
U mlton/trunk/runtime/basis/Real/strto.c
U mlton/trunk/runtime/basis-ffi.h
U mlton/trunk/runtime/gc/init.c
U mlton/trunk/runtime/gdtoa-patch
U mlton/trunk/runtime/gen/basis-ffi.def
U mlton/trunk/runtime/gen/basis-ffi.h
U mlton/trunk/runtime/gen/basis-ffi.sml
----------------------------------------------------------------------
Modified: mlton/trunk/basis-library/primitive/basis-ffi.sml
===================================================================
--- mlton/trunk/basis-library/primitive/basis-ffi.sml 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/basis-library/primitive/basis-ffi.sml 2007-08-06 21:48:33 UTC (rev 5827)
@@ -914,7 +914,7 @@
val equal = _import "Real32_equal" : Real32.t * Real32.t -> Bool.t;
val fetch = _import "Real32_fetch" : (Real32.t) ref -> Real32.t;
val frexp = _import "Real32_frexp" : Real32.t * (C_Int.t) ref -> Real32.t;
-val gdtoa = _import "Real32_gdtoa" : Real32.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
+val gdtoa = _import "Real32_gdtoa" : Real32.t * C_Int.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
val ldexp = _import "Real32_ldexp" : Real32.t * C_Int.t -> Real32.t;
val le = _import "Real32_le" : Real32.t * Real32.t -> Bool.t;
val lt = _import "Real32_lt" : Real32.t * Real32.t -> Bool.t;
@@ -960,7 +960,7 @@
val round = _import "Real32_round" : Real32.t -> Real32.t;
val signBit = _import "Real32_signBit" : Real32.t -> C_Int.t;
val store = _import "Real32_store" : (Real32.t) ref * Real32.t -> unit;
-val strto = _import "Real32_strto" : NullString8.t -> Real32.t;
+val strto = _import "Real32_strto" : NullString8.t * C_Int.t -> Real32.t;
val sub = _import "Real32_sub" : Real32.t * Real32.t -> Real32.t;
end
structure Real64 =
@@ -974,7 +974,7 @@
val equal = _import "Real64_equal" : Real64.t * Real64.t -> Bool.t;
val fetch = _import "Real64_fetch" : (Real64.t) ref -> Real64.t;
val frexp = _import "Real64_frexp" : Real64.t * (C_Int.t) ref -> Real64.t;
-val gdtoa = _import "Real64_gdtoa" : Real64.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
+val gdtoa = _import "Real64_gdtoa" : Real64.t * C_Int.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
val ldexp = _import "Real64_ldexp" : Real64.t * C_Int.t -> Real64.t;
val le = _import "Real64_le" : Real64.t * Real64.t -> Bool.t;
val lt = _import "Real64_lt" : Real64.t * Real64.t -> Bool.t;
@@ -1020,7 +1020,7 @@
val round = _import "Real64_round" : Real64.t -> Real64.t;
val signBit = _import "Real64_signBit" : Real64.t -> C_Int.t;
val store = _import "Real64_store" : (Real64.t) ref * Real64.t -> unit;
-val strto = _import "Real64_strto" : NullString8.t -> Real64.t;
+val strto = _import "Real64_strto" : NullString8.t * C_Int.t -> Real64.t;
val sub = _import "Real64_sub" : Real64.t * Real64.t -> Real64.t;
end
structure Socket =
Modified: mlton/trunk/basis-library/primitive/prim-real.sml
===================================================================
--- mlton/trunk/basis-library/primitive/prim-real.sml 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/basis-library/primitive/prim-real.sml 2007-08-06 21:48:33 UTC (rev 5827)
@@ -54,7 +54,7 @@
val abs: real -> real
val class: real -> C_Int.t
val frexp: real * C_Int.t ref -> real
- val gdtoa: real * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
+ val gdtoa: real * C_Int.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
val ldexp: real * C_Int.t -> real
val maxFinite: real
val minNormalPos: real
@@ -64,7 +64,7 @@
val nextAfterUp: real -> real
val round: real -> real
val signBit: real -> C_Int.t
- val strto: Primitive.NullString8.t -> real
+ val strto: Primitive.NullString8.t * C_Int.t -> real
(* Integer to float; depends on rounding mode. *)
val fromInt8Unsafe: Primitive.Int8.int -> real
@@ -148,7 +148,7 @@
val abs = _prim "Real32_abs": real -> real;
val class = _import "Real32_class": real -> C_Int.t;
val frexp = _import "Real32_frexp": real * C_Int.t ref -> real;
- val gdtoa = _import "Real32_gdtoa": real * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t;
+ val gdtoa = _import "Real32_gdtoa": real * C_Int.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t;
val ldexp = _prim "Real32_ldexp": real * C_Int.t -> real;
val maxFinite = #1 _symbol "Real32_maxFinite": real GetSet.t; ()
val minNormalPos = #1 _symbol "Real32_minNormalPos": real GetSet.t; ()
@@ -158,7 +158,7 @@
val nextAfterUp = _import "Real32_nextAfterUp": real -> real;
val round = _prim "Real32_round": real -> real;
val signBit = _import "Real32_signBit": real -> C_Int.t;
- val strto = _import "Real32_strto": NullString8.t -> real;
+ val strto = _import "Real32_strto": NullString8.t * C_Int.t -> real;
val fromInt8Unsafe = _prim "WordS8_rndToReal32": Int8.int -> real;
val fromInt16Unsafe = _prim "WordS16_rndToReal32": Int16.int -> real;
@@ -245,7 +245,7 @@
val abs = _prim "Real64_abs": real -> real;
val class = _import "Real64_class": real -> C_Int.t;
val frexp = _import "Real64_frexp": real * C_Int.t ref -> real;
- val gdtoa = _import "Real64_gdtoa": real * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t;
+ val gdtoa = _import "Real64_gdtoa": real * C_Int.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t;
val ldexp = _prim "Real64_ldexp": real * C_Int.t -> real;
val maxFinite = #1 _symbol "Real64_maxFinite": real GetSet.t; ()
val minNormalPos = #1 _symbol "Real64_minNormalPos": real GetSet.t; ()
@@ -255,7 +255,7 @@
val nextAfterUp = _import "Real64_nextAfterUp": real -> real;
val round = _prim "Real64_round": real -> real;
val signBit = _import "Real64_signBit": real -> C_Int.t;
- val strto = _import "Real64_strto": NullString8.t -> real;
+ val strto = _import "Real64_strto": NullString8.t * C_Int.t -> real;
val fromInt8Unsafe = _prim "WordS8_rndToReal64": Int8.int -> real;
val fromInt16Unsafe = _prim "WordS16_rndToReal64": Int16.int -> real;
Modified: mlton/trunk/basis-library/real/real.sig
===================================================================
--- mlton/trunk/basis-library/real/real.sig 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/basis-library/real/real.sig 2007-08-06 21:48:33 UTC (rev 5827)
@@ -42,8 +42,8 @@
val modf: real * real ref -> real
val round: real -> real
- val gdtoa: real * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
- val strto: Primitive.NullString8.t -> real
+ val gdtoa: real * C_Int.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
+ val strto: Primitive.NullString8.t * C_Int.t -> real
val fromInt8Unsafe: Primitive.Int8.int -> real
val fromInt16Unsafe: Primitive.Int16.int -> real
Modified: mlton/trunk/basis-library/real/real.sml
===================================================================
--- mlton/trunk/basis-library/real/real.sml 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/basis-library/real/real.sml 2007-08-06 21:48:33 UTC (rev 5827)
@@ -305,8 +305,22 @@
| _ => x - realTrunc (x/y) * y))
(* fromDecimal, scan, fromString: decimal -> binary conversions *)
+ fun strto (str: NullString.t,
+ rounding_mode: IEEEReal.rounding_mode) =
+ let
+ val rounding : C_Int.int =
+ case rounding_mode of
+ TO_NEAREST => 1
+ | TO_NEGINF => 3
+ | TO_POSINF => 2
+ | TO_ZERO => 0
+ in
+ Prim.strto (str, rounding)
+ end
exception Bad
- fun fromDecimal ({class, digits, exp, sign}: IEEEReal.decimal_approx) =
+ fun fromDecimalWithRoundingMode
+ ({class, digits, exp, sign}: IEEEReal.decimal_approx,
+ rounding_mode: IEEEReal.rounding_mode) =
let
fun doit () =
let
@@ -314,11 +328,19 @@
if Int.< (exp, 0)
then concat ["-", Int.toString (Int.~ exp)]
else Int.toString exp
-(* val x = concat ["0.", digits, "E", exp, "\000"] *)
- val n = Int.+ (4, Int.+ (List.length digits, String.size exp))
+(*
+ val str = concat [if sign then "-" else "",
+ "0.", digits,
+ "E", exp, "\000"]
+*)
+ val n = Int.+ (if sign then 1 else 0,
+ Int.+ (4 (* "0." + "E" + "\000" *),
+ Int.+ (List.length digits,
+ String.size exp)))
val a = Array.arrayUninit n
fun upd (i, c) = (Array.update (a, i, c); Int.+ (i, 1))
val i = 0
+ val i = if sign then upd (i, #"-") else i
val i = upd (i, #"0")
val i = upd (i, #".")
val i =
@@ -331,12 +353,10 @@
val i = upd (i, #"E")
val i = CharVector.foldl (fn (c, i) => upd (i, c)) i exp
val _ = upd (i, #"\000")
- val x = Vector.unsafeFromArray a
- val x = Prim.strto (NullString.fromString x)
+ val str = Vector.unsafeFromArray a
+ val x = strto (NullString.fromString str, rounding_mode)
in
- if sign
- then ~ x
- else x
+ x
end
in
SOME (case class of
@@ -348,10 +368,15 @@
handle Bad => NONE
end
+ fun fromDecimal da = fromDecimalWithRoundingMode (da, TO_NEAREST)
+
fun scan reader state =
case IEEEReal.scan reader state of
NONE => NONE
- | SOME (da, state) => SOME (valOf (fromDecimal da), state)
+ | SOME (da, state) =>
+ SOME (valOf (fromDecimalWithRoundingMode
+ (da, IEEEReal.getRoundingMode ())),
+ state)
val fromString = StringCvt.scanString scan
@@ -360,7 +385,8 @@
local
val one = One.make (fn () => ref (0: C_Int.int))
in
- fun gdtoa (x: real, mode: mode, ndig: int) =
+ fun gdtoa (x: real, mode: mode, ndig: int,
+ rounding_mode: IEEEReal.rounding_mode) =
let
val mode : C_Int.int =
case mode of
@@ -368,9 +394,15 @@
| Gen => 0
| Sci => 2
val ndig : C_Int.int = C_Int.fromInt ndig
+ val rounding : C_Int.int =
+ case rounding_mode of
+ TO_NEAREST => 1
+ | TO_NEGINF => 3
+ | TO_POSINF => 2
+ | TO_ZERO => 0
in
One.use (one, fn decpt =>
- (Prim.gdtoa (x, mode, ndig, decpt),
+ (Prim.gdtoa (x, mode, ndig, rounding, decpt),
C_Int.toInt (!decpt)))
end
end
@@ -391,7 +423,7 @@
sign = signBit x}
| c =>
let
- val (cs, exp) = gdtoa (x, Gen, 0)
+ val (cs, exp) = gdtoa (x, Gen, 0, TO_NEAREST)
fun loop (i, ac) =
if Int.< (i, 0)
then ac
@@ -456,7 +488,8 @@
fun sci (x: real, ndig: int): string =
let
val sign = if x < zero then "~" else ""
- val (cs, decpt) = gdtoa (x, Sci, Int.+ (1, ndig))
+ val (cs, decpt) =
+ gdtoa (x, Sci, Int.+ (1, ndig), IEEEReal.getRoundingMode ())
val length = CUtil.C_String.length cs
val whole = String.tabulate (1, fn _ => CUtil.C_String.sub (cs, 0))
val frac =
@@ -548,7 +581,8 @@
fn x =>
let
val sign = if x < zero then "~" else ""
- val (cs, decpt) = gdtoa (x, Fix, n)
+ val (cs, decpt) =
+ gdtoa (x, Fix, n, IEEEReal.getRoundingMode ())
in
fix (sign, cs, decpt, n)
end
@@ -679,19 +713,16 @@
val fromIntInf: IntInf.int -> real =
fn i =>
-(*
- fromInt (IntInf.toInt i)
- handle Overflow =>
-*)
- let
- val (i, sign) =
- if IntInf.< (i, 0)
- then (IntInf.~ i, true)
- else (i, false)
- val x = Prim.strto (NullString.nullTerm (IntInf.toString i))
- in
- if sign then ~ x else x
- end
+ let
+ val str =
+ if IntInf.< (i, 0)
+ then "-" ^ (IntInf.toString (IntInf.~ i))
+ else IntInf.toString i
+ val x = strto (NullString.nullTerm str,
+ IEEEReal.getRoundingMode ())
+ in
+ x
+ end
val toIntInf: rounding_mode -> real -> LargeInt.int =
fn mode => fn x =>
@@ -709,12 +740,7 @@
case class x of
INF => raise Overflow
| _ =>
-(*
- if minInt <= x andalso x <= maxInt
- then IntInf.fromInt (Prim.toInt x)
- else
-*)
- valOf (IntInf.fromString (fmt (StringCvt.FIX (SOME 0)) x))
+ valOf (IntInf.fromString (fmt (StringCvt.FIX (SOME 0)) x))
end
local
@@ -1036,7 +1062,8 @@
* special cases (nans and infs). Also, because of the way IEEE
* floating point numbers are represented, word {de,in}crement
* automatically does the right thing at the boundary between normals
- * and denormals. Also, convienently, maxFinite+1 = posInf.
+ * and denormals. Also, convienently, maxFinite+1 = posInf and
+ * minFinite-1 = negInf.
*)
structure Real32 = Real (open Primitive.Real32
Modified: mlton/trunk/doc/changelog
===================================================================
--- mlton/trunk/doc/changelog 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/doc/changelog 2007-08-06 21:48:33 UTC (rev 5827)
@@ -1,5 +1,12 @@
Here are the changes since version 20051202.
+* 2007-08-06
+ - Fixed bug in treatment of Real<N>.{scan,fromString} operations.
+ Real<N>.{scan,fromString} were using TO_NEAREST semantics, but
+ should obey current rounding mode. (Only Real<N>.fromDecimal is
+ specified to always have TO_NEAREST semantics.) Thanks to Sean
+ McLaughlin for the bug report.
+
* 2007-07-27
- Fixed bugs in constant-folding of floating-point operations with C
codegen.
Modified: mlton/trunk/runtime/basis/Real/gdtoa.c
===================================================================
--- mlton/trunk/runtime/basis/Real/gdtoa.c 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/basis/Real/gdtoa.c 2007-08-06 21:48:33 UTC (rev 5827)
@@ -6,10 +6,11 @@
#endif
/* This code is patterned on g_dfmt from the gdtoa sources. */
-C_String_t Real32_gdtoa (Real32_t f, C_Int_t mode, C_Int_t ndig, Ref(C_Int_t) decpt) {
+C_String_t Real32_gdtoa (Real32_t f, C_Int_t mode, C_Int_t ndig,
+ C_Int_t rounding, Ref(C_Int_t) decpt) {
ULong bits[1];
int ex;
- static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, 0 };
+ FPI fpi = { 24, 1-127-24+1, 254-127-24+1, (int)rounding, 0 };
int i;
ULong L[1];
char *result;
@@ -24,17 +25,18 @@
ex = 1;
ex -= 0x7f + 23;
i = STRTOG_Normal;
- result = gdtoa (&fpi, ex, bits, &i, (int)mode, (int)ndig, (int*)decpt, NULL);
+ result = gdtoa__gdtoa (&fpi, ex, bits, &i, (int)mode, (int)ndig, (int*)decpt, NULL);
if (DEBUG)
- fprintf (stderr, "%s = gdtoa (%g, %d, %d) decpt = %d\n",
- result, (double)f, (int)mode, (int)ndig, *((int*)decpt));
+ fprintf (stderr, "%s = gdtoa (%g, %d, %d, %d) decpt = %d\n",
+ result, (double)f, (int)mode, (int)ndig, (int)rounding, *((int*)decpt));
return (C_String_t)result;
}
-C_String_t Real64_gdtoa (Real64_t d, C_Int_t mode, C_Int_t ndig, Ref(C_Int_t) decpt) {
+C_String_t Real64_gdtoa (Real64_t d, C_Int_t mode, C_Int_t ndig,
+ C_Int_t rounding, Ref(C_Int_t) decpt) {
ULong bits[2];
int ex;
- static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 };
+ FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, (int)rounding, 0 };
int i;
ULong L[2];
char *result;
@@ -58,9 +60,9 @@
ex = 1;
ex -= 0x3ff + 52;
i = STRTOG_Normal;
- result = gdtoa (&fpi, ex, bits, &i, mode, ndig, (int*)decpt, NULL);
+ result = gdtoa__gdtoa (&fpi, ex, bits, &i, mode, ndig, (int*)decpt, NULL);
if (DEBUG)
- fprintf (stderr, "%s = gdtoa (%g, %d, %d) decpt = %d\n",
- result, d, (int)mode, (int)ndig, *((int*)decpt));
+ fprintf (stderr, "%s = gdtoa (%g, %d, %d, %d) decpt = %d\n",
+ result, d, (int)mode, (int)ndig, (int)rounding, *((int*)decpt));
return (C_String_t)result;
}
Modified: mlton/trunk/runtime/basis/Real/strto.c
===================================================================
--- mlton/trunk/runtime/basis/Real/strto.c 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/basis/Real/strto.c 2007-08-06 21:48:33 UTC (rev 5827)
@@ -1,20 +1,22 @@
#include "platform.h"
#include "gdtoa/gdtoa.h"
-Real32_t Real32_strto (NullString8_t s) {
+Real32_t Real32_strto (NullString8_t s, C_Int_t rounding) {
char *endptr;
Real32_t res;
+ int ret;
- res = gdtoa_strtof ((const char*)s, &endptr);
+ ret = gdtoa__strtorf ((const char*)s, &endptr, (int)rounding, &res);
assert (NULL != endptr);
return res;
}
-Real64_t Real64_strto (NullString8_t s) {
+Real64_t Real64_strto (NullString8_t s, C_Int_t rounding) {
char *endptr;
Real64_t res;
+ int ret;
- res = gdtoa_strtod ((const char*)s, &endptr);
+ ret = gdtoa__strtord ((const char*)s, &endptr, (int)rounding, &res);
assert (NULL != endptr);
return res;
}
Modified: mlton/trunk/runtime/basis-ffi.h
===================================================================
--- mlton/trunk/runtime/basis-ffi.h 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/basis-ffi.h 2007-08-06 21:48:33 UTC (rev 5827)
@@ -751,7 +751,7 @@
MLTON_CODEGEN_STATIC_INLINE Bool_t Real32_equal(Real32_t,Real32_t);
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_fetch(Ref(Real32_t));
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_frexp(Real32_t,Ref(C_Int_t));
-C_String_t Real32_gdtoa(Real32_t,C_Int_t,C_Int_t,Ref(C_Int_t));
+C_String_t Real32_gdtoa(Real32_t,C_Int_t,C_Int_t,C_Int_t,Ref(C_Int_t));
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_ldexp(Real32_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real32_le(Real32_t,Real32_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real32_lt(Real32_t,Real32_t);
@@ -794,7 +794,7 @@
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_round(Real32_t);
C_Int_t Real32_signBit(Real32_t);
MLTON_CODEGEN_STATIC_INLINE void Real32_store(Ref(Real32_t),Real32_t);
-Real32_t Real32_strto(NullString8_t);
+Real32_t Real32_strto(NullString8_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_sub(Real32_t,Real32_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_abs(Real64_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_add(Real64_t,Real64_t);
@@ -804,7 +804,7 @@
MLTON_CODEGEN_STATIC_INLINE Bool_t Real64_equal(Real64_t,Real64_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_fetch(Ref(Real64_t));
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_frexp(Real64_t,Ref(C_Int_t));
-C_String_t Real64_gdtoa(Real64_t,C_Int_t,C_Int_t,Ref(C_Int_t));
+C_String_t Real64_gdtoa(Real64_t,C_Int_t,C_Int_t,C_Int_t,Ref(C_Int_t));
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_ldexp(Real64_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real64_le(Real64_t,Real64_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real64_lt(Real64_t,Real64_t);
@@ -847,7 +847,7 @@
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_round(Real64_t);
C_Int_t Real64_signBit(Real64_t);
MLTON_CODEGEN_STATIC_INLINE void Real64_store(Ref(Real64_t),Real64_t);
-Real64_t Real64_strto(NullString8_t);
+Real64_t Real64_strto(NullString8_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_sub(Real64_t,Real64_t);
C_Errno_t(C_Int_t) Socket_accept(C_Sock_t,Array(Word8_t),Ref(C_Socklen_t));
extern const C_Int_t Socket_AF_INET;
Modified: mlton/trunk/runtime/gc/init.c
===================================================================
--- mlton/trunk/runtime/gc/init.c 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/gc/init.c 2007-08-06 21:48:33 UTC (rev 5827)
@@ -22,13 +22,13 @@
// From gdtoa/gdtoa.h.
// Can't include the whole thing because it brings in too much junk.
-float gdtoa_strtof (const char *, char **);
+float gdtoa__strtof (const char *, char **);
static float stringToFloat (char *s) {
char *endptr;
float f;
- f = gdtoa_strtof (s, &endptr);
+ f = gdtoa__strtof (s, &endptr);
if (s == endptr)
die ("Invalid @MLton float: %s.", s);
return f;
Modified: mlton/trunk/runtime/gdtoa-patch
===================================================================
--- mlton/trunk/runtime/gdtoa-patch 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/gdtoa-patch 2007-08-06 21:48:33 UTC (rev 5827)
@@ -1,6 +1,6 @@
diff -P -C 2 -r gdtoa/arithchk.c gdtoa-new/arithchk.c
-*** gdtoa/arithchk.c 1998-06-19 13:46:11.000000000 -0700
---- gdtoa-new/arithchk.c 2006-05-24 17:02:44.303399187 -0700
+*** gdtoa/arithchk.c 1998-06-19 15:46:11.000000000 -0500
+--- gdtoa-new/arithchk.c 2007-08-06 16:26:02.000000000 -0500
***************
*** 137,141 ****
}
@@ -14,9 +14,30 @@
! int main()
{
Akind *a = 0;
+Binary files gdtoa/arithchk.out and gdtoa-new/arithchk.out differ
+diff -P -C 2 -r gdtoa/dmisc.c gdtoa-new/dmisc.c
+*** gdtoa/dmisc.c 1998-11-02 13:34:31.000000000 -0600
+--- gdtoa-new/dmisc.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 90,96 ****
+ void
+ #ifdef KR_headers
+! freedtoa(s) char *s;
+ #else
+! freedtoa(char *s)
+ #endif
+ {
+--- 90,96 ----
+ void
+ #ifdef KR_headers
+! gdtoa__freedtoa(s) char *s;
+ #else
+! gdtoa__freedtoa(char *s)
+ #endif
+ {
diff -P -C 2 -r gdtoa/dtoa.c gdtoa-new/dtoa.c
-*** gdtoa/dtoa.c 2000-11-02 07:09:01.000000000 -0800
---- gdtoa-new/dtoa.c 2006-05-24 17:04:27.987435180 -0700
+*** gdtoa/dtoa.c 2000-11-02 09:09:01.000000000 -0600
+--- gdtoa-new/dtoa.c 2007-08-06 16:26:02.000000000 -0500
***************
*** 81,85 ****
@@ -27,40 +48,386 @@
--- 81,85 ----
char *
-! gdtoa_dtoa
+! gdtoa__dtoa
#ifdef KR_headers
(d, mode, ndigits, decpt, sign, rve)
+***************
+*** 143,147 ****
+ #ifndef MULTIPLE_THREADS
+ if (dtoa_result) {
+! freedtoa(dtoa_result);
+ dtoa_result = 0;
+ }
+--- 143,147 ----
+ #ifndef MULTIPLE_THREADS
+ if (dtoa_result) {
+! gdtoa__freedtoa(dtoa_result);
+ dtoa_result = 0;
+ }
+diff -P -C 2 -r gdtoa/g_ddfmt.c gdtoa-new/g_ddfmt.c
+*** gdtoa/g_ddfmt.c 1998-09-09 07:09:31.000000000 -0500
+--- gdtoa-new/g_ddfmt.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 41,47 ****
+ char *
+ #ifdef KR_headers
+! g_ddfmt(buf, dd, ndig, bufsize) char *buf; double *dd; int ndig; unsigned bufsize;
+ #else
+! g_ddfmt(char *buf, double *dd, int ndig, unsigned bufsize)
+ #endif
+ {
+--- 41,47 ----
+ char *
+ #ifdef KR_headers
+! gdtoa__g_ddfmt(buf, dd, ndig, bufsize) char *buf; double *dd; int ndig; unsigned bufsize;
+ #else
+! gdtoa__g_ddfmt(char *buf, double *dd, int ndig, unsigned bufsize)
+ #endif
+ {
+***************
+*** 155,159 ****
+ fpi.sudden_underflow = 0;
+ i = STRTOG_Normal;
+! s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ b = g__fmt(buf, s, se, decpt, z->sign);
+ Bfree(z);
+--- 155,159 ----
+ fpi.sudden_underflow = 0;
+ i = STRTOG_Normal;
+! s = gdtoa__gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ b = g__fmt(buf, s, se, decpt, z->sign);
+ Bfree(z);
+diff -P -C 2 -r gdtoa/g_dfmt.c gdtoa-new/g_dfmt.c
+*** gdtoa/g_dfmt.c 1998-09-09 09:18:15.000000000 -0500
+--- gdtoa-new/g_dfmt.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ char*
+ #ifdef KR_headers
+! g_dfmt(buf, d, ndig, bufsize) char *buf; double *d; int ndig; unsigned bufsize;
+ #else
+! g_dfmt(char *buf, double *d, int ndig, unsigned bufsize)
+ #endif
+ {
+--- 40,46 ----
+ char*
+ #ifdef KR_headers
+! gdtoa__g_dfmt(buf, d, ndig, bufsize) char *buf; double *d; int ndig; unsigned bufsize;
+ #else
+! gdtoa__g_dfmt(char *buf, double *d, int ndig, unsigned bufsize)
+ #endif
+ {
+***************
+*** 91,95 ****
+ }
+ i = STRTOG_Normal;
+! s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+--- 91,95 ----
+ }
+ i = STRTOG_Normal;
+! s = gdtoa__gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+diff -P -C 2 -r gdtoa/gdtoa.c gdtoa-new/gdtoa.c
+*** gdtoa/gdtoa.c 1999-09-20 23:22:19.000000000 -0500
+--- gdtoa-new/gdtoa.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 116,120 ****
+
+ char *
+! gdtoa
+ #ifdef KR_headers
+ (fpi, be, bits, kindp, mode, ndigits, decpt, rve)
+--- 116,120 ----
+
+ char *
+! gdtoa__gdtoa
+ #ifdef KR_headers
+ (fpi, be, bits, kindp, mode, ndigits, decpt, rve)
+***************
+*** 169,173 ****
+ #ifndef MULTIPLE_THREADS
+ if (dtoa_result) {
+! freedtoa(dtoa_result);
+ dtoa_result = 0;
+ }
+--- 169,173 ----
+ #ifndef MULTIPLE_THREADS
+ if (dtoa_result) {
+! gdtoa__freedtoa(dtoa_result);
+ dtoa_result = 0;
+ }
diff -P -C 2 -r gdtoa/gdtoa.h gdtoa-new/gdtoa.h
-*** gdtoa/gdtoa.h 2000-11-01 07:01:39.000000000 -0800
---- gdtoa-new/gdtoa.h 2006-05-24 17:04:17.015912822 -0700
+*** gdtoa/gdtoa.h 2000-11-01 09:01:39.000000000 -0600
+--- gdtoa-new/gdtoa.h 2007-08-06 16:26:02.000000000 -0500
***************
-*** 109,119 ****
+*** 109,155 ****
#endif
! extern char* dtoa ANSI((double d, int mode, int ndigits, int *decpt,
int *sign, char **rve));
- extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
+! extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
int mode, int ndigits, int *decpt, char **rve));
- extern void freedtoa ANSI((char*));
+! extern void freedtoa ANSI((char*));
! extern float strtof ANSI((CONST char *, char **));
! extern double strtod ANSI((CONST char *, char **));
- extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
+! extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
---- 109,119 ----
+! extern char* g_ddfmt ANSI((char*, double*, int, unsigned));
+! extern char* g_dfmt ANSI((char*, double*, int, unsigned));
+! extern char* g_ffmt ANSI((char*, float*, int, unsigned));
+! extern char* g_Qfmt ANSI((char*, void*, int, unsigned));
+! extern char* g_xfmt ANSI((char*, void*, int, unsigned));
+! extern char* g_xLfmt ANSI((char*, void*, int, unsigned));
+
+! extern int strtoId ANSI((CONST char*, char**, double*, double*));
+! extern int strtoIdd ANSI((CONST char*, char**, double*, double*));
+! extern int strtoIf ANSI((CONST char*, char**, float*, float*));
+! extern int strtoIQ ANSI((CONST char*, char**, void*, void*));
+! extern int strtoIx ANSI((CONST char*, char**, void*, void*));
+! extern int strtoIxL ANSI((CONST char*, char**, void*, void*));
+! extern int strtord ANSI((CONST char*, char**, int, double*));
+! extern int strtordd ANSI((CONST char*, char**, int, double*));
+! extern int strtorf ANSI((CONST char*, char**, int, float*));
+! extern int strtorQ ANSI((CONST char*, char**, int, void*));
+! extern int strtorx ANSI((CONST char*, char**, int, void*));
+! extern int strtorxL ANSI((CONST char*, char**, int, void*));
+ #if 1
+! extern int strtodI ANSI((CONST char*, char**, double*));
+! extern int strtopd ANSI((CONST char*, char**, double*));
+! extern int strtopdd ANSI((CONST char*, char**, double*));
+! extern int strtopf ANSI((CONST char*, char**, float*));
+! extern int strtopQ ANSI((CONST char*, char**, void*));
+! extern int strtopx ANSI((CONST char*, char**, void*));
+! extern int strtopxL ANSI((CONST char*, char**, void*));
+ #else
+! #define strtopd(s,se,x) strtord(s,se,1,x)
+! #define strtopdd(s,se,x) strtordd(s,se,1,x)
+! #define strtopf(s,se,x) strtorf(s,se,1,x)
+! #define strtopQ(s,se,x) strtorQ(s,se,1,x)
+! #define strtopx(s,se,x) strtorx(s,se,1,x)
+! #define strtopxL(s,se,x) strtorxL(s,se,1,x)
#endif
-! extern char* gdtoa_dtoa ANSI((double d, int mode, int ndigits, int *decpt,
+--- 109,155 ----
+ #endif
+
+! extern char* gdtoa__dtoa ANSI((double d, int mode, int ndigits, int *decpt,
int *sign, char **rve));
- extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
+! extern char* gdtoa__gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
int mode, int ndigits, int *decpt, char **rve));
- extern void freedtoa ANSI((char*));
-! extern float gdtoa_strtof ANSI((CONST char *, char **));
-! extern double gdtoa_strtod ANSI((CONST char *, char **));
- extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
+! extern void gdtoa__freedtoa ANSI((char*));
+! extern float gdtoa__strtof ANSI((CONST char *, char **));
+! extern double gdtoa__strtod ANSI((CONST char *, char **));
+! extern int gdtoa__strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
+! extern char* gdtoa__g_ddfmt ANSI((char*, double*, int, unsigned));
+! extern char* gdtoa__g_dfmt ANSI((char*, double*, int, unsigned));
+! extern char* gdtoa__g_ffmt ANSI((char*, float*, int, unsigned));
+! extern char* gdtoa__g_Qfmt ANSI((char*, void*, int, unsigned));
+! extern char* gdtoa__g_xfmt ANSI((char*, void*, int, unsigned));
+! extern char* gdtoa__g_xLfmt ANSI((char*, void*, int, unsigned));
+
+! extern int gdtoa__strtoId ANSI((CONST char*, char**, double*, double*));
+! extern int gdtoa__strtoIdd ANSI((CONST char*, char**, double*, double*));
+! extern int gdtoa__strtoIf ANSI((CONST char*, char**, float*, float*));
+! extern int gdtoa__strtoIQ ANSI((CONST char*, char**, void*, void*));
+! extern int gdtoa__strtoIx ANSI((CONST char*, char**, void*, void*));
+! extern int gdtoa__strtoIxL ANSI((CONST char*, char**, void*, void*));
+! extern int gdtoa__strtord ANSI((CONST char*, char**, int, double*));
+! extern int gdtoa__strtordd ANSI((CONST char*, char**, int, double*));
+! extern int gdtoa__strtorf ANSI((CONST char*, char**, int, float*));
+! extern int gdtoa__strtorQ ANSI((CONST char*, char**, int, void*));
+! extern int gdtoa__strtorx ANSI((CONST char*, char**, int, void*));
+! extern int gdtoa__strtorxL ANSI((CONST char*, char**, int, void*));
+ #if 1
+! extern int gdtoa__strtodI ANSI((CONST char*, char**, double*));
+! extern int gdtoa__strtopd ANSI((CONST char*, char**, double*));
+! extern int gdtoa__strtopdd ANSI((CONST char*, char**, double*));
+! extern int gdtoa__strtopf ANSI((CONST char*, char**, float*));
+! extern int gdtoa__strtopQ ANSI((CONST char*, char**, void*));
+! extern int gdtoa__strtopx ANSI((CONST char*, char**, void*));
+! extern int gdtoa__strtopxL ANSI((CONST char*, char**, void*));
+ #else
+! #define gdtoa__strtopd(s,se,x) gdtoa__strtord(s,se,1,x)
+! #define gdtoa__strtopdd(s,se,x) gdtoa__strtordd(s,se,1,x)
+! #define gdtoa__strtopf(s,se,x) gdtoa__strtorf(s,se,1,x)
+! #define gdtoa__strtopQ(s,se,x) gdtoa__strtorQ(s,se,1,x)
+! #define gdtoa__strtopx(s,se,x) gdtoa__strtorx(s,se,1,x)
+! #define gdtoa__strtopxL(s,se,x) gdtoa__strtorxL(s,se,1,x)
+ #endif
+
+diff -P -C 2 -r gdtoa/gdtoaimp.h gdtoa-new/gdtoaimp.h
+*** gdtoa/gdtoaimp.h 2000-11-02 09:09:01.000000000 -0600
+--- gdtoa-new/gdtoaimp.h 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 571,576 ****
+ extern Bigint *set_ones ANSI((Bigint*, int));
+ extern char *strcp ANSI((char*, const char*));
+! extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
+! extern double strtod ANSI((const char *s00, char **se));
+ extern Bigint *sum ANSI((Bigint*, Bigint*));
+ extern int trailz ANSI((Bigint*));
+--- 571,576 ----
+ extern Bigint *set_ones ANSI((Bigint*, int));
+ extern char *strcp ANSI((char*, const char*));
+! extern int gdtoa__strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
+! extern double gdtoa__strtod ANSI((const char *s00, char **se));
+ extern Bigint *sum ANSI((Bigint*, Bigint*));
+ extern int trailz ANSI((Bigint*));
+diff -P -C 2 -r gdtoa/g_ffmt.c gdtoa-new/g_ffmt.c
+*** gdtoa/g_ffmt.c 1998-09-12 15:39:39.000000000 -0500
+--- gdtoa-new/g_ffmt.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ char*
+ #ifdef KR_headers
+! g_ffmt(buf, f, ndig, bufsize) char *buf; float *f; int ndig; unsigned bufsize;
+ #else
+! g_ffmt(char *buf, float *f, int ndig, unsigned bufsize)
+ #endif
+ {
+--- 40,46 ----
+ char*
+ #ifdef KR_headers
+! gdtoa__g_ffmt(buf, f, ndig, bufsize) char *buf; float *f; int ndig; unsigned bufsize;
+ #else
+! gdtoa__g_ffmt(char *buf, float *f, int ndig, unsigned bufsize)
+ #endif
+ {
+***************
+*** 90,94 ****
+ }
+ i = STRTOG_Normal;
+! s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+--- 90,94 ----
+ }
+ i = STRTOG_Normal;
+! s = gdtoa__gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+diff -P -C 2 -r gdtoa/g__fmt.c gdtoa-new/g__fmt.c
+*** gdtoa/g__fmt.c 2003-03-21 14:59:43.000000000 -0600
+--- gdtoa-new/g__fmt.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 97,101 ****
+ *b = 0;
+ }
+! freedtoa(s0);
+ return b;
+ }
+--- 97,101 ----
+ *b = 0;
+ }
+! gdtoa__freedtoa(s0);
+ return b;
+ }
+diff -P -C 2 -r gdtoa/g_Qfmt.c gdtoa-new/g_Qfmt.c
+*** gdtoa/g_Qfmt.c 2000-11-01 09:21:10.000000000 -0600
+--- gdtoa-new/g_Qfmt.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 58,64 ****
+ char*
+ #ifdef KR_headers
+! g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize;
+ #else
+! g_Qfmt(char *buf, void *V, int ndig, unsigned bufsize)
+ #endif
+ {
+--- 58,64 ----
+ char*
+ #ifdef KR_headers
+! gdtoa__g_Qfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize;
+ #else
+! gdtoa__g_Qfmt(char *buf, void *V, int ndig, unsigned bufsize)
+ #endif
+ {
+***************
+*** 116,120 ****
+ mode = 0;
+ }
+! s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+--- 116,120 ----
+ mode = 0;
+ }
+! s = gdtoa__gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+diff -P -C 2 -r gdtoa/g_xfmt.c gdtoa-new/g_xfmt.c
+*** gdtoa/g_xfmt.c 1998-09-09 08:59:17.000000000 -0500
+--- gdtoa-new/g_xfmt.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 60,66 ****
+ char*
+ #ifdef KR_headers
+! g_xfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize;
+ #else
+! g_xfmt(char *buf, void *V, int ndig, unsigned bufsize)
+ #endif
+ {
+--- 60,66 ----
+ char*
+ #ifdef KR_headers
+! gdtoa__g_xfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize;
+ #else
+! gdtoa__g_xfmt(char *buf, void *V, int ndig, unsigned bufsize)
+ #endif
+ {
+***************
+*** 115,119 ****
+ mode = 0;
+ }
+! s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+--- 115,119 ----
+ mode = 0;
+ }
+! s = gdtoa__gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+diff -P -C 2 -r gdtoa/g_xLfmt.c gdtoa-new/g_xLfmt.c
+*** gdtoa/g_xLfmt.c 1998-09-09 11:35:43.000000000 -0500
+--- gdtoa-new/g_xLfmt.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 56,62 ****
+ char*
+ #ifdef KR_headers
+! g_xLfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize;
+ #else
+! g_xLfmt(char *buf, void *V, int ndig, unsigned bufsize)
+ #endif
+ {
+--- 56,62 ----
+ char*
+ #ifdef KR_headers
+! gdtoa__g_xLfmt(buf, V, ndig, bufsize) char *buf; char *V; int ndig; unsigned bufsize;
+ #else
+! gdtoa__g_xLfmt(char *buf, void *V, int ndig, unsigned bufsize)
+ #endif
+ {
+***************
+*** 110,114 ****
+ mode = 0;
+ }
+! s = gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
+--- 110,114 ----
+ mode = 0;
+ }
+! s = gdtoa__gdtoa(&fpi, ex, bits, &i, mode, ndig, &decpt, &se);
+ return g__fmt(buf, s, se, decpt, sign);
+ }
diff -P -C 2 -r gdtoa/strtod.c gdtoa-new/strtod.c
-*** gdtoa/strtod.c 2003-03-21 13:24:01.000000000 -0800
---- gdtoa-new/strtod.c 2006-05-24 17:02:44.309398379 -0700
+*** gdtoa/strtod.c 2003-03-21 15:24:01.000000000 -0600
+--- gdtoa-new/strtod.c 2007-08-06 16:26:02.000000000 -0500
***************
*** 59,63 ****
@@ -71,12 +438,61 @@
--- 59,63 ----
double
-! gdtoa_strtod
+! gdtoa__strtod
#ifdef KR_headers
(s00, se) CONST char *s00; char **se;
+diff -P -C 2 -r gdtoa/strtodg.c gdtoa-new/strtodg.c
+*** gdtoa/strtodg.c 2003-03-21 14:59:43.000000000 -0600
+--- gdtoa-new/strtodg.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 317,321 ****
+
+ int
+! strtodg
+ #ifdef KR_headers
+ (s00, se, fpi, exp, bits)
+--- 317,321 ----
+
+ int
+! gdtoa__strtodg
+ #ifdef KR_headers
+ (s00, se, fpi, exp, bits)
+diff -P -C 2 -r gdtoa/strtodI.c gdtoa-new/strtodI.c
+*** gdtoa/strtodI.c 2000-11-01 22:33:13.000000000 -0600
+--- gdtoa-new/strtodI.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 57,63 ****
+ int
+ #ifdef KR_headers
+! strtodI(s, sp, dd) CONST char *s; char **sp; double *dd;
+ #else
+! strtodI(CONST char *s, char **sp, double *dd)
+ #endif
+ {
+--- 57,63 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtodI(s, sp, dd) CONST char *s; char **sp; double *dd;
+ #else
+! gdtoa__strtodI(CONST char *s, char **sp, double *dd)
+ #endif
+ {
+***************
+*** 76,80 ****
+ U *u;
+
+! k = strtodg(s, sp, &fpi, &exp, bits);
+ u = (U*)dd;
+ sign = k & STRTOG_Neg ? 0x80000000L : 0;
+--- 76,80 ----
+ U *u;
+
+! k = gdtoa__strtodg(s, sp, &fpi, &exp, bits);
+ u = (U*)dd;
+ sign = k & STRTOG_Neg ? 0x80000000L : 0;
diff -P -C 2 -r gdtoa/strtof.c gdtoa-new/strtof.c
-*** gdtoa/strtof.c 2000-11-01 20:31:40.000000000 -0800
---- gdtoa-new/strtof.c 2006-05-24 17:02:44.309398379 -0700
+*** gdtoa/strtof.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtof.c 2007-08-06 16:26:02.000000000 -0500
***************
*** 38,46 ****
#include "gdtoaimp.h"
@@ -91,10 +507,650 @@
--- 38,46 ----
#include "gdtoaimp.h"
-! float gdtoa_strtof
+! float gdtoa__strtof
#ifdef KR_headers
! (s, sp) CONST char *s; char **sp;
#else
! (CONST char *s, char **sp)
#endif
{
+***************
+*** 55,59 ****
+ union { ULong L[1]; float f; } u;
+
+! k = strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+--- 55,59 ----
+ union { ULong L[1]; float f; } u;
+
+! k = gdtoa__strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+diff -P -C 2 -r gdtoa/strtoId.c gdtoa-new/strtoId.c
+*** gdtoa/strtoId.c 1998-09-09 08:59:17.000000000 -0500
+--- gdtoa-new/strtoId.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtoId(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1;
+ #else
+! strtoId(CONST char *s, char **sp, double *f0, double *f1)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtoId(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1;
+ #else
+! gdtoa__strtoId(CONST char *s, char **sp, double *f0, double *f1)
+ #endif
+ {
+***************
+*** 52,56 ****
+ B[0] = Balloc(1);
+ B[0]->wds = 2;
+! k = strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtod((ULong*)f0, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+--- 52,56 ----
+ B[0] = Balloc(1);
+ B[0]->wds = 2;
+! k = gdtoa__strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtod((ULong*)f0, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+diff -P -C 2 -r gdtoa/strtoIdd.c gdtoa-new/strtoIdd.c
+*** gdtoa/strtoIdd.c 1998-09-09 08:59:17.000000000 -0500
+--- gdtoa-new/strtoIdd.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtoIdd(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1;
+ #else
+! strtoIdd(CONST char *s, char **sp, double *f0, double *f1)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtoIdd(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1;
+ #else
+! gdtoa__strtoIdd(CONST char *s, char **sp, double *f0, double *f1)
+ #endif
+ {
+***************
+*** 56,60 ****
+ B[0] = Balloc(2);
+ B[0]->wds = 4;
+! k = strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtodd((ULong*)f0, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+--- 56,60 ----
+ B[0] = Balloc(2);
+ B[0]->wds = 4;
+! k = gdtoa__strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtodd((ULong*)f0, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+diff -P -C 2 -r gdtoa/strtoIf.c gdtoa-new/strtoIf.c
+*** gdtoa/strtoIf.c 1998-09-09 08:59:17.000000000 -0500
+--- gdtoa-new/strtoIf.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtoIf(s, sp, f0, f1) CONST char *s; char **sp; float *f0, *f1;
+ #else
+! strtoIf(CONST char *s, char **sp, float *f0, float *f1)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtoIf(s, sp, f0, f1) CONST char *s; char **sp; float *f0, *f1;
+ #else
+! gdtoa__strtoIf(CONST char *s, char **sp, float *f0, float *f1)
+ #endif
+ {
+***************
+*** 52,56 ****
+ B[0] = Balloc(0);
+ B[0]->wds = 1;
+! k = strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtof((ULong*)f0, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+--- 52,56 ----
+ B[0] = Balloc(0);
+ B[0]->wds = 1;
+! k = gdtoa__strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtof((ULong*)f0, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+diff -P -C 2 -r gdtoa/strtoIg.c gdtoa-new/strtoIg.c
+*** gdtoa/strtoIg.c 1998-06-26 09:04:19.000000000 -0500
+--- gdtoa-new/strtoIg.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtoIg(s00, se, fpi, exp, B, rvp) CONST char *s00; char **se; FPI *fpi; Long *exp; Bigint **B; int *rvp;
+ #else
+! strtoIg(CONST char *s00, char **se, FPI *fpi, Long *exp, Bigint **B, int *rvp)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtoIg(s00, se, fpi, exp, B, rvp) CONST char *s00; char **se; FPI *fpi; Long *exp; Bigint **B; int *rvp;
+ #else
+! gdtoa__strtoIg(CONST char *s00, char **se, FPI *fpi, Long *exp, Bigint **B, int *rvp)
+ #endif
+ {
+***************
+*** 51,55 ****
+
+ b = *B;
+! rv = strtodg(s00, se, fpi, exp, b->x);
+ if (!(rv & STRTOG_Inexact)) {
+ B[1] = 0;
+--- 51,55 ----
+
+ b = *B;
+! rv = gdtoa__strtodg(s00, se, fpi, exp, b->x);
+ if (!(rv & STRTOG_Inexact)) {
+ B[1] = 0;
+diff -P -C 2 -r gdtoa/strtoIQ.c gdtoa-new/strtoIQ.c
+*** gdtoa/strtoIQ.c 1998-06-22 13:49:25.000000000 -0500
+--- gdtoa-new/strtoIQ.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtoIQ(s, sp, a, b) CONST char *s; char **sp; void *a; void *b;
+ #else
+! strtoIQ(CONST char *s, char **sp, void *a, void *b)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtoIQ(s, sp, a, b) CONST char *s; char **sp; void *a; void *b;
+ #else
+! gdtoa__strtoIQ(CONST char *s, char **sp, void *a, void *b)
+ #endif
+ {
+***************
+*** 53,57 ****
+ B[0] = Balloc(2);
+ B[0]->wds = 4;
+! k = strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtoQ(L, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+--- 53,57 ----
+ B[0] = Balloc(2);
+ B[0]->wds = 4;
+! k = gdtoa__strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtoQ(L, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+diff -P -C 2 -r gdtoa/strtoIx.c gdtoa-new/strtoIx.c
+*** gdtoa/strtoIx.c 1998-09-09 08:13:22.000000000 -0500
+--- gdtoa-new/strtoIx.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtoIx(s, sp, a, b) CONST char *s; char **sp; void *a; void *b;
+ #else
+! strtoIx(CONST char *s, char **sp, void *a, void *b)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtoIx(s, sp, a, b) CONST char *s; char **sp; void *a; void *b;
+ #else
+! gdtoa__strtoIx(CONST char *s, char **sp, void *a, void *b)
+ #endif
+ {
+***************
+*** 53,57 ****
+ B[0] = Balloc(1);
+ B[0]->wds = 2;
+! k = strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtox(L, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+--- 53,57 ----
+ B[0] = Balloc(1);
+ B[0]->wds = 2;
+! k = gdtoa__strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtox(L, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+diff -P -C 2 -r gdtoa/strtoIxL.c gdtoa-new/strtoIxL.c
+*** gdtoa/strtoIxL.c 1998-09-09 08:13:22.000000000 -0500
+--- gdtoa-new/strtoIxL.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtoIxL(s, sp, a, b) CONST char *s; char **sp; void *a; void *b;
+ #else
+! strtoIxL(CONST char *s, char **sp, void *a, void *b)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtoIxL(s, sp, a, b) CONST char *s; char **sp; void *a; void *b;
+ #else
+! gdtoa__strtoIxL(CONST char *s, char **sp, void *a, void *b)
+ #endif
+ {
+***************
+*** 53,57 ****
+ B[0] = Balloc(1);
+ B[0]->wds = 2;
+! k = strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtoxL(L, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+--- 53,57 ----
+ B[0] = Balloc(1);
+ B[0]->wds = 2;
+! k = gdtoa__strtoIg(s, sp, &fpi, exp, B, rv);
+ ULtoxL(L, B[0]->x, exp[0], rv[0]);
+ Bfree(B[0]);
+diff -P -C 2 -r gdtoa/strtopd.c gdtoa-new/strtopd.c
+*** gdtoa/strtopd.c 1998-09-12 10:30:06.000000000 -0500
+--- gdtoa-new/strtopd.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtopd(s, sp, d) char *s; char **sp; double *d;
+ #else
+! strtopd(CONST char *s, char **sp, double *d)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtopd(s, sp, d) char *s; char **sp; double *d;
+ #else
+! gdtoa__strtopd(CONST char *s, char **sp, double *d)
+ #endif
+ {
+***************
+*** 50,54 ****
+ int k;
+
+! k = strtodg(s, sp, &fpi0, &exp, bits);
+ ULtod((ULong*)d, bits, exp, k);
+ return k;
+--- 50,54 ----
+ int k;
+
+! k = gdtoa__strtodg(s, sp, &fpi0, &exp, bits);
+ ULtod((ULong*)d, bits, exp, k);
+ return k;
+diff -P -C 2 -r gdtoa/strtopdd.c gdtoa-new/strtopdd.c
+*** gdtoa/strtopdd.c 2000-11-01 22:33:46.000000000 -0600
+--- gdtoa-new/strtopdd.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtopdd(s, sp, dd) CONST char *s; char **sp; double *dd;
+ #else
+! strtopdd(CONST char *s, char **sp, double *dd)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtopdd(s, sp, dd) CONST char *s; char **sp; double *dd;
+ #else
+! gdtoa__strtopdd(CONST char *s, char **sp, double *dd)
+ #endif
+ {
+***************
+*** 59,63 ****
+ U *u;
+
+! rv = strtodg(s, sp, &fpi, &exp, bits);
+ u = (U*)dd;
+ switch(rv & STRTOG_Retmask) {
+--- 59,63 ----
+ U *u;
+
+! rv = gdtoa__strtodg(s, sp, &fpi, &exp, bits);
+ u = (U*)dd;
+ switch(rv & STRTOG_Retmask) {
+diff -P -C 2 -r gdtoa/strtopf.c gdtoa-new/strtopf.c
+*** gdtoa/strtopf.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtopf.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 40,46 ****
+ int
+ #ifdef KR_headers
+! strtopf(s, sp, f) CONST char *s; char **sp; float *f;
+ #else
+! strtopf(CONST char *s, char **sp, float *f)
+ #endif
+ {
+--- 40,46 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtopf(s, sp, f) CONST char *s; char **sp; float *f;
+ #else
+! gdtoa__strtopf(CONST char *s, char **sp, float *f)
+ #endif
+ {
+***************
+*** 54,58 ****
+ int k;
+
+! k = strtodg(s, sp, &fpi, &exp, bits);
+ L = (ULong*)f;
+ switch(k & STRTOG_Retmask) {
+--- 54,58 ----
+ int k;
+
+! k = gdtoa__strtodg(s, sp, &fpi, &exp, bits);
+ L = (ULong*)f;
+ switch(k & STRTOG_Retmask) {
+diff -P -C 2 -r gdtoa/strtopQ.c gdtoa-new/strtopQ.c
+*** gdtoa/strtopQ.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtopQ.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 58,64 ****
+ int
+ #ifdef KR_headers
+! strtopQ(s, sp, V) CONST char *s; char **sp; void *V;
+ #else
+! strtopQ(CONST char *s, char **sp, void *V)
+ #endif
+ {
+--- 58,64 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtopQ(s, sp, V) CONST char *s; char **sp; void *V;
+ #else
+! gdtoa__strtopQ(CONST char *s, char **sp, void *V)
+ #endif
+ {
+***************
+*** 73,77 ****
+ ULong *L = (ULong*)V;
+
+! k = strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+--- 73,77 ----
+ ULong *L = (ULong*)V;
+
+! k = gdtoa__strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+diff -P -C 2 -r gdtoa/strtopx.c gdtoa-new/strtopx.c
+*** gdtoa/strtopx.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtopx.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 60,66 ****
+ int
+ #ifdef KR_headers
+! strtopx(s, sp, V) CONST char *s; char **sp; void *V;
+ #else
+! strtopx(CONST char *s, char **sp, void *V)
+ #endif
+ {
+--- 60,66 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtopx(s, sp, V) CONST char *s; char **sp; void *V;
+ #else
+! gdtoa__strtopx(CONST char *s, char **sp, void *V)
+ #endif
+ {
+***************
+*** 75,79 ****
+ UShort *L = (UShort*)V;
+
+! k = strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+--- 75,79 ----
+ UShort *L = (UShort*)V;
+
+! k = gdtoa__strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+diff -P -C 2 -r gdtoa/strtopxL.c gdtoa-new/strtopxL.c
+*** gdtoa/strtopxL.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtopxL.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 56,62 ****
+ int
+ #ifdef KR_headers
+! strtopxL(s, sp, V) CONST char *s; char **sp; void *V;
+ #else
+! strtopxL(CONST char *s, char **sp, void *V)
+ #endif
+ {
+--- 56,62 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtopxL(s, sp, V) CONST char *s; char **sp; void *V;
+ #else
+! gdtoa__strtopxL(CONST char *s, char **sp, void *V)
+ #endif
+ {
+***************
+*** 71,75 ****
+ ULong *L = (ULong*)V;
+
+! k = strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+--- 71,75 ----
+ ULong *L = (ULong*)V;
+
+! k = gdtoa__strtodg(s, sp, &fpi, &exp, bits);
+ switch(k & STRTOG_Retmask) {
+ case STRTOG_NoNumber:
+diff -P -C 2 -r gdtoa/strtord.c gdtoa-new/strtord.c
+*** gdtoa/strtord.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtord.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 77,83 ****
+ int
+ #ifdef KR_headers
+! strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d;
+ #else
+! strtord(CONST char *s, char **sp, int rounding, double *d)
+ #endif
+ {
+--- 77,83 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d;
+ #else
+! gdtoa__strtord(CONST char *s, char **sp, int rounding, double *d)
+ #endif
+ {
+***************
+*** 94,98 ****
+ fpi = &fpi1;
+ }
+! k = strtodg(s, sp, fpi, &exp, bits);
+ ULtod((ULong*)d, bits, exp, k);
+ return k;
+--- 94,98 ----
+ fpi = &fpi1;
+ }
+! k = gdtoa__strtodg(s, sp, fpi, &exp, bits);
+ ULtod((ULong*)d, bits, exp, k);
+ return k;
+diff -P -C 2 -r gdtoa/strtordd.c gdtoa-new/strtordd.c
+*** gdtoa/strtordd.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtordd.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 179,185 ****
+ int
+ #ifdef KR_headers
+! strtordd(s, sp, rounding, dd) CONST char *s; char **sp; int rounding; double *dd;
+ #else
+! strtordd(CONST char *s, char **sp, int rounding, double *dd)
+ #endif
+ {
+--- 179,185 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtordd(s, sp, rounding, dd) CONST char *s; char **sp; int rounding; double *dd;
+ #else
+! gdtoa__strtordd(CONST char *s, char **sp, int rounding, double *dd)
+ #endif
+ {
+***************
+*** 200,204 ****
+ fpi = &fpi1;
+ }
+! k = strtodg(s, sp, fpi, &exp, bits);
+ ULtodd((ULong*)dd, bits, exp, k);
+ return k;
+--- 200,204 ----
+ fpi = &fpi1;
+ }
+! k = gdtoa__strtodg(s, sp, fpi, &exp, bits);
+ ULtodd((ULong*)dd, bits, exp, k);
+ return k;
+diff -P -C 2 -r gdtoa/strtorf.c gdtoa-new/strtorf.c
+*** gdtoa/strtorf.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtorf.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 73,79 ****
+ int
+ #ifdef KR_headers
+! strtorf(s, sp, rounding, f) CONST char *s; char **sp; int rounding; float *f;
+ #else
+! strtorf(CONST char *s, char **sp, int rounding, float *f)
+ #endif
+ {
+--- 73,79 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtorf(s, sp, rounding, f) CONST char *s; char **sp; int rounding; float *f;
+ #else
+! gdtoa__strtorf(CONST char *s, char **sp, int rounding, float *f)
+ #endif
+ {
+***************
+*** 90,94 ****
+ fpi = &fpi1;
+ }
+! k = strtodg(s, sp, fpi, &exp, bits);
+ ULtof((ULong*)f, bits, exp, k);
+ return k;
+--- 90,94 ----
+ fpi = &fpi1;
+ }
+! k = gdtoa__strtodg(s, sp, fpi, &exp, bits);
+ ULtof((ULong*)f, bits, exp, k);
+ return k;
+diff -P -C 2 -r gdtoa/strtorQ.c gdtoa-new/strtorQ.c
+*** gdtoa/strtorQ.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtorQ.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 99,105 ****
+ int
+ #ifdef KR_headers
+! strtorQ(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+ #else
+! strtorQ(CONST char *s, char **sp, int rounding, void *L)
+ #endif
+ {
+--- 99,105 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtorQ(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+ #else
+! gdtoa__strtorQ(CONST char *s, char **sp, int rounding, void *L)
+ #endif
+ {
+***************
+*** 116,120 ****
+ fpi = &fpi1;
+ }
+! k = strtodg(s, sp, fpi, &exp, bits);
+ ULtoQ((ULong*)L, bits, exp, k);
+ return k;
+--- 116,120 ----
+ fpi = &fpi1;
+ }
+! k = gdtoa__strtodg(s, sp, fpi, &exp, bits);
+ ULtoQ((ULong*)L, bits, exp, k);
+ return k;
+diff -P -C 2 -r gdtoa/strtorx.c gdtoa-new/strtorx.c
+*** gdtoa/strtorx.c 2000-11-01 22:34:18.000000000 -0600
+--- gdtoa-new/strtorx.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 96,102 ****
+ int
+ #ifdef KR_headers
+! strtorx(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+ #else
+! strtorx(CONST char *s, char **sp, int rounding, void *L)
+ #endif
+ {
+--- 96,102 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtorx(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+ #else
+! gdtoa__strtorx(CONST char *s, char **sp, int rounding, void *L)
+ #endif
+ {
+***************
+*** 113,117 ****
+ fpi = &fpi1;
+ }
+! k = strtodg(s, sp, fpi, &exp, bits);
+ ULtox((UShort*)L, bits, exp, k);
+ return k;
+--- 113,117 ----
+ fpi = &fpi1;
+ }
+! k = gdtoa__strtodg(s, sp, fpi, &exp, bits);
+ ULtox((UShort*)L, bits, exp, k);
+ return k;
+diff -P -C 2 -r gdtoa/strtorxL.c gdtoa-new/strtorxL.c
+*** gdtoa/strtorxL.c 2000-11-01 22:31:40.000000000 -0600
+--- gdtoa-new/strtorxL.c 2007-08-06 16:26:02.000000000 -0500
+***************
+*** 90,96 ****
+ int
+ #ifdef KR_headers
+! strtorxL(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+ #else
+! strtorxL(CONST char *s, char **sp, int rounding, void *L)
+ #endif
+ {
+--- 90,96 ----
+ int
+ #ifdef KR_headers
+! gdtoa__strtorxL(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L;
+ #else
+! gdtoa__strtorxL(CONST char *s, char **sp, int rounding, void *L)
+ #endif
+ {
+***************
+*** 107,111 ****
+ fpi = &fpi1;
+ }
+! k = strtodg(s, sp, fpi, &exp, bits);
+ ULtoxL((ULong*)L, bits, exp, k);
+ return k;
+--- 107,111 ----
+ fpi = &fpi1;
+ }
+! k = gdtoa__strtodg(s, sp, fpi, &exp, bits);
+ ULtoxL((ULong*)L, bits, exp, k);
+ return k;
Modified: mlton/trunk/runtime/gen/basis-ffi.def
===================================================================
--- mlton/trunk/runtime/gen/basis-ffi.def 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/gen/basis-ffi.def 2007-08-06 21:48:33 UTC (rev 5827)
@@ -848,7 +848,7 @@
Real32.equal = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t * Real32.t -> Bool.t
Real32.fetch = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t ref -> Real32.t
Real32.frexp = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t * C_Int.t ref -> Real32.t
-Real32.gdtoa = _import : Real32.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
+Real32.gdtoa = _import : Real32.t * C_Int.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
Real32.ldexp = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t * C_Int.t -> Real32.t
Real32.le = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t * Real32.t -> Bool.t
Real32.lt = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t * Real32.t -> Bool.t
@@ -874,7 +874,7 @@
Real32.round = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t -> Real32.t
Real32.signBit = _import : Real32.t -> C_Int.t
Real32.store = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t ref * Real32.t -> unit
-Real32.strto = _import : NullString8.t -> Real32.t
+Real32.strto = _import : NullString8.t * C_Int.t -> Real32.t
Real32.sub = _import MLTON_CODEGEN_STATIC_INLINE : Real32.t * Real32.t -> Real32.t
Real64.Math.acos = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t -> Real64.t
Real64.Math.asin = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t -> Real64.t
@@ -901,7 +901,7 @@
Real64.equal = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t * Real64.t -> Bool.t
Real64.fetch = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t ref -> Real64.t
Real64.frexp = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t * C_Int.t ref -> Real64.t
-Real64.gdtoa = _import : Real64.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
+Real64.gdtoa = _import : Real64.t * C_Int.t * C_Int.t * C_Int.t * C_Int.t ref -> C_String.t
Real64.ldexp = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t * C_Int.t -> Real64.t
Real64.le = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t * Real64.t -> Bool.t
Real64.lt = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t * Real64.t -> Bool.t
@@ -927,7 +927,7 @@
Real64.round = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t -> Real64.t
Real64.signBit = _import : Real64.t -> C_Int.t
Real64.store = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t ref * Real64.t -> unit
-Real64.strto = _import : NullString8.t -> Real64.t
+Real64.strto = _import : NullString8.t * C_Int.t -> Real64.t
Real64.sub = _import MLTON_CODEGEN_STATIC_INLINE : Real64.t * Real64.t -> Real64.t
Word16.add = _import MLTON_CODEGEN_STATIC_INLINE : Word16.t * Word16.t -> Word16.t
Word16.andb = _import MLTON_CODEGEN_STATIC_INLINE : Word16.t * Word16.t -> Word16.t
Modified: mlton/trunk/runtime/gen/basis-ffi.h
===================================================================
--- mlton/trunk/runtime/gen/basis-ffi.h 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/gen/basis-ffi.h 2007-08-06 21:48:33 UTC (rev 5827)
@@ -751,7 +751,7 @@
MLTON_CODEGEN_STATIC_INLINE Bool_t Real32_equal(Real32_t,Real32_t);
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_fetch(Ref(Real32_t));
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_frexp(Real32_t,Ref(C_Int_t));
-C_String_t Real32_gdtoa(Real32_t,C_Int_t,C_Int_t,Ref(C_Int_t));
+C_String_t Real32_gdtoa(Real32_t,C_Int_t,C_Int_t,C_Int_t,Ref(C_Int_t));
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_ldexp(Real32_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real32_le(Real32_t,Real32_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real32_lt(Real32_t,Real32_t);
@@ -794,7 +794,7 @@
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_round(Real32_t);
C_Int_t Real32_signBit(Real32_t);
MLTON_CODEGEN_STATIC_INLINE void Real32_store(Ref(Real32_t),Real32_t);
-Real32_t Real32_strto(NullString8_t);
+Real32_t Real32_strto(NullString8_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Real32_t Real32_sub(Real32_t,Real32_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_abs(Real64_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_add(Real64_t,Real64_t);
@@ -804,7 +804,7 @@
MLTON_CODEGEN_STATIC_INLINE Bool_t Real64_equal(Real64_t,Real64_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_fetch(Ref(Real64_t));
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_frexp(Real64_t,Ref(C_Int_t));
-C_String_t Real64_gdtoa(Real64_t,C_Int_t,C_Int_t,Ref(C_Int_t));
+C_String_t Real64_gdtoa(Real64_t,C_Int_t,C_Int_t,C_Int_t,Ref(C_Int_t));
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_ldexp(Real64_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real64_le(Real64_t,Real64_t);
MLTON_CODEGEN_STATIC_INLINE Bool_t Real64_lt(Real64_t,Real64_t);
@@ -847,7 +847,7 @@
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_round(Real64_t);
C_Int_t Real64_signBit(Real64_t);
MLTON_CODEGEN_STATIC_INLINE void Real64_store(Ref(Real64_t),Real64_t);
-Real64_t Real64_strto(NullString8_t);
+Real64_t Real64_strto(NullString8_t,C_Int_t);
MLTON_CODEGEN_STATIC_INLINE Real64_t Real64_sub(Real64_t,Real64_t);
C_Errno_t(C_Int_t) Socket_accept(C_Sock_t,Array(Word8_t),Ref(C_Socklen_t));
extern const C_Int_t Socket_AF_INET;
Modified: mlton/trunk/runtime/gen/basis-ffi.sml
===================================================================
--- mlton/trunk/runtime/gen/basis-ffi.sml 2007-08-06 21:25:04 UTC (rev 5826)
+++ mlton/trunk/runtime/gen/basis-ffi.sml 2007-08-06 21:48:33 UTC (rev 5827)
@@ -914,7 +914,7 @@
val equal = _import "Real32_equal" : Real32.t * Real32.t -> Bool.t;
val fetch = _import "Real32_fetch" : (Real32.t) ref -> Real32.t;
val frexp = _import "Real32_frexp" : Real32.t * (C_Int.t) ref -> Real32.t;
-val gdtoa = _import "Real32_gdtoa" : Real32.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
+val gdtoa = _import "Real32_gdtoa" : Real32.t * C_Int.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
val ldexp = _import "Real32_ldexp" : Real32.t * C_Int.t -> Real32.t;
val le = _import "Real32_le" : Real32.t * Real32.t -> Bool.t;
val lt = _import "Real32_lt" : Real32.t * Real32.t -> Bool.t;
@@ -960,7 +960,7 @@
val round = _import "Real32_round" : Real32.t -> Real32.t;
val signBit = _import "Real32_signBit" : Real32.t -> C_Int.t;
val store = _import "Real32_store" : (Real32.t) ref * Real32.t -> unit;
-val strto = _import "Real32_strto" : NullString8.t -> Real32.t;
+val strto = _import "Real32_strto" : NullString8.t * C_Int.t -> Real32.t;
val sub = _import "Real32_sub" : Real32.t * Real32.t -> Real32.t;
end
structure Real64 =
@@ -974,7 +974,7 @@
val equal = _import "Real64_equal" : Real64.t * Real64.t -> Bool.t;
val fetch = _import "Real64_fetch" : (Real64.t) ref -> Real64.t;
val frexp = _import "Real64_frexp" : Real64.t * (C_Int.t) ref -> Real64.t;
-val gdtoa = _import "Real64_gdtoa" : Real64.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
+val gdtoa = _import "Real64_gdtoa" : Real64.t * C_Int.t * C_Int.t * C_Int.t * (C_Int.t) ref -> C_String.t;
val ldexp = _import "Real64_ldexp" : Real64.t * C_Int.t -> Real64.t;
val le = _import "Real64_le" : Real64.t * Real64.t -> Bool.t;
val lt = _import "Real64_lt" : Real64.t * Real64.t -> Bool.t;
@@ -1020,7 +1020,7 @@
val round = _import "Real64_round" : Real64.t -> Real64.t;
val signBit = _import "Real64_signBit" : Real64.t -> C_Int.t;
val store = _import "Real64_store" : (Real64.t) ref * Real64.t -> unit;
-val strto = _import "Real64_strto" : NullString8.t -> Real64.t;
+val strto = _import "Real64_strto" : NullString8.t * C_Int.t -> Real64.t;
val sub = _import "Real64_sub" : Real64.t * Real64.t -> Real64.t;
end
structure Socket =
More information about the MLton-commit
mailing list