}
}
}
+
+DEFINE_PRIMITIVE ("C-PEEK-BYTES", Prim_peek_bytes, 5, 5, 0)
+{
+ /* Copy, from ALIEN+OFFSET, COUNT bytes to STRING[START..]. */
+
+ PRIMITIVE_HEADER (5);
+ CHECK_ARG (4, STRING_P);
+ {
+ const void * src = (ALIEN_ADDRESS_LOC (void *));
+ int count = (UNSIGNED_FIXNUM_ARG (3));
+ SCM string = (ARG_REF (4));
+ int index = arg_index_integer (5, (STRING_LENGTH (string)));
+ void * dest = STRING_LOC (string, index);
+ memcpy (dest, src, count);
+ }
+ PRIMITIVE_RETURN (UNSPECIFIC);
+}
\f
#define C_POKER(type, value_arg_ref) \
{ \
}
PRIMITIVE_RETURN (UNSPECIFIC);
}
+
+DEFINE_PRIMITIVE ("C-POKE-BYTES", Prim_poke_bytes, 5, 5, 0)
+{
+ /* Copy to ALIEN+OFFSET COUNT bytes from STRING[START]. */
+
+ PRIMITIVE_HEADER (5);
+ CHECK_ARG (4, STRING_P);
+ {
+ void * dest = (ALIEN_ADDRESS_LOC (void *));
+ int count = (UNSIGNED_FIXNUM_ARG (3));
+ SCM string = (ARG_REF (4));
+ int index = arg_index_integer (5, (STRING_LENGTH (string)));
+ const void * src = STRING_LOC (string, index);
+ memcpy (dest, src, count);
+ }
+ PRIMITIVE_RETURN (UNSPECIFIC);
+}
\f
/* Malloc/Free. */
(+ (* (%alien/high-bits alien) (radix))
(%alien/low-bits alien)))
+(define (%set-alien/address! alien address)
+ (let ((qr (integer-divide address (radix))))
+ (set-%alien/high-bits! alien (integer-divide-quotient qr))
+ (set-%alien/low-bits! alien (integer-divide-remainder qr))))
+
(declare (integrate-operator copy-alien-address!))
(define (copy-alien-address! alien source)
(if (not (eq? alien source))
(error:bad-range-argument afunc 'alien-function-cache!))
(set-%alien-function/band-id! afunc band-id))))
-(define (c-peek-cstring alien)
+(define-integrable (c-peek-cstring alien)
((ucode-primitive c-peek-cstring 2) alien 0))
-(define (c-peek-cstring! alien)
+(define-integrable (c-peek-cstring! alien)
((ucode-primitive c-peek-cstring! 2) alien 0))
-(define (c-peek-cstringp alien)
+(define-integrable (c-peek-cstringp alien)
((ucode-primitive c-peek-cstringp 2) alien 0))
-(define (c-peek-cstringp! alien)
+(define-integrable (c-peek-cstringp! alien)
((ucode-primitive c-peek-cstringp! 2) alien 0))
-(define (c-poke-pointer dest alien)
+(define-integrable (c-peek-bytes alien offset count buffer start)
+ ((ucode-primitive c-peek-bytes 5) alien offset count buffer start))
+
+(define-integrable (c-poke-pointer dest alien)
;; Sets the pointer at the alien DEST to point to the ALIEN.
((ucode-primitive c-poke-pointer 3) dest 0 alien))
(guarantee-string string 'C-POKE-STRING)
((ucode-primitive c-poke-string! 3) alien 0 string))
+(define-integrable (c-poke-bytes alien offset count buffer start)
+ ((ucode-primitive c-poke-bytes 5) alien offset count buffer start))
+
(define (c-enum-name value enum-name constants)
enum-name
(let loop ((consts constants))