From: Matt Birkholz Date: Wed, 2 Mar 2016 23:22:40 +0000 (-0700) Subject: microcode/pruxffi.c: Pass flovecs as double*, not SCHEME_OBJECT*. X-Git-Tag: mit-scheme-pucked-9.2.12~261^2~75^2~18 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=ff86945ce014be52e2430b5c47ef2799dc728233;p=mit-scheme.git microcode/pruxffi.c: Pass flovecs as double*, not SCHEME_OBJECT*. This reduces the need for adapter code, but assumes Scheme's flonums are doubles. The convenience functions flovec_loc and flovec_ref are thus made superfluous. --- diff --git a/src/microcode/pruxffi.c b/src/microcode/pruxffi.c index f6c3ca54e..e03abe33b 100644 --- a/src/microcode/pruxffi.c +++ b/src/microcode/pruxffi.c @@ -837,7 +837,7 @@ arg_pointer (int argn) if (is_alien (arg)) return (alien_address (arg)); if (FLONUM_P (arg)) - return ((void *) (OBJECT_ADDRESS (arg))); + return ((void *) (MEMORY_LOC ((arg), 1))); error_wrong_type_arg (argn); /*NOTREACHED*/ @@ -1046,24 +1046,12 @@ empty_list (void) } int -flovec_length (SCM vector) +flovec_length (double *first) { - return (FLOATING_VECTOR_LENGTH (vector)); -} - -double* -flovec_loc (SCM vector) -{ - return (FLOATING_VECTOR_LOC (vector, 0)); -} + /* FIRST must be the first double in a flonum/flovec. */ -double -flovec_ref (SCM vector, int index) -{ - int len = FLOATING_VECTOR_LENGTH (vector); - if (0 <= index && index < len) - return (FLOATING_VECTOR_REF (vector, index)); - error_external_return (); + SCM vector = MAKE_POINTER_OBJECT (TC_BIG_FLONUM, (((SCM *)first) - 1)); + return (FLOATING_VECTOR_LENGTH (vector)); } DEFINE_PRIMITIVE ("OUTF-ERROR", Prim_outf_error, 1, 1, 0) diff --git a/src/microcode/pruxffi.h b/src/microcode/pruxffi.h index 9f999ad8b..a78b2a02f 100644 --- a/src/microcode/pruxffi.h +++ b/src/microcode/pruxffi.h @@ -90,9 +90,7 @@ extern void* pointer_value (void); extern void check_number_of_args (int num); extern SCM unspecific (void); extern SCM empty_list (void); -extern int flovec_length (SCM vector); -extern double* flovec_loc (SCM vector); -extern double flovec_ref (SCM vector, int index); +extern int flovec_length (double *first); #ifndef MIT_SCHEME /* Do not include in the microcode, just shims. */ extern SCM cons (SCM car, SCM cdr);