change FFI `_float' to coerce to Racket double-precision flonum

This commit is contained in:
Matthew Flatt 2011-01-31 19:33:07 -07:00
parent 6293933a69
commit ff0a591b7b
3 changed files with 9 additions and 5 deletions

View File

@ -141,8 +141,12 @@ to be in range.}
[_double* ctype?])]{
The @scheme[_float] and @scheme[_double] types represent the
corresponding C types. The type @scheme[_double*] that implicitly
coerces any real number to a C @cpp{double}.}
corresponding C types. Both single- and double-precision Racket
numbers are accepted for conversion via both @scheme[_float] and
@scheme[_double], while both @scheme[_float] and @scheme[_double]
coerce C values to double-precision Racket numbers.
The type @scheme[_double*]
coerces any Racket real number to a C @cpp{double}.}
@; ------------------------------------------------------------

View File

@ -677,7 +677,7 @@ Scheme_Object *utf16_pointer_to_ucs4_string(unsigned short *utf)
* Predicate: SCHEME_FLOATP(<Scheme>)
* Scheme->C: SCHEME_FLOAT_VAL(<Scheme>)
* S->C offset: 0
* C->Scheme: scheme_make_float(<C>)
* C->Scheme: scheme_make_double(<C>)
*/
#define FOREIGN_double (15)
@ -1306,7 +1306,7 @@ static Scheme_Object *C2SCHEME(Scheme_Object *type, void *src,
case FOREIGN_ufixint: return scheme_make_integer_from_unsigned(REF_CTYPE(Tuint32));
case FOREIGN_fixnum: return scheme_make_integer(REF_CTYPE(intptr_t));
case FOREIGN_ufixnum: return scheme_make_integer_from_unsigned(REF_CTYPE(uintptr_t));
case FOREIGN_float: return scheme_make_float(REF_CTYPE(float));
case FOREIGN_float: return scheme_make_double(REF_CTYPE(float));
case FOREIGN_double: return scheme_make_double(REF_CTYPE(double));
case FOREIGN_doubleS: return scheme_make_double(REF_CTYPE(double));
case FOREIGN_bool: return (REF_CTYPE(int)?scheme_true:scheme_false);

View File

@ -640,7 +640,7 @@ Scheme_Object *utf16_pointer_to_ucs4_string(unsigned short *utf)
@(defctype* '(ufixnum "umzintptr")
"uintptr_t" "INT" "UINT" "integer_from_unsigned")
@(defctype* 'float "float" "FLOAT" "FLOAT" "float")
@(defctype* 'float "float" "FLOAT" "FLOAT" "double")
@(defctype* 'double "double" "FLOAT" "FLOAT" "double")
@;