Bytevectors can be created, copied, and analyzed with the following procedures and C functions.
Return a new bytevector of len bytes. Optionally, if fill is given, fill it with fill; fill must be in the range [-128,255].
Return true if obj is a bytevector.
int
scm_is_bytevector (SCM obj)
¶Equivalent to scm_is_true (scm_bytevector_p (obj))
.
Return the length in bytes of bytevector bv.
size_t
scm_c_bytevector_length (SCM bv)
¶Likewise, return the length in bytes of bytevector bv.
Return #t
if bv1 equals bv2—i.e., if they have the same
length and contents.
Fill positions [start ... end) of bytevector bv with byte fill. start defaults to 0 and end defaults to the length of bv.11
Copy len bytes from source into target, starting reading from source-start (an index index within source) and writing at target-start.
It is permitted for the source and target regions to overlap. In that case, copying takes place as if the source is first copied into a temporary bytevector and then into the destination.
Return a newly allocated copy of bv.
scm_t_uint8
scm_c_bytevector_ref (SCM bv, size_t index)
¶Return the byte at index in bytevector bv.
void
scm_c_bytevector_set_x (SCM bv, size_t index, scm_t_uint8 value)
¶Set the byte at index in bv to value.
Low-level C macros are available. They do not perform any type-checking; as such they should be used with care.
size_t
SCM_BYTEVECTOR_LENGTH (bv)
¶Return the length in bytes of bytevector bv.
signed char *
SCM_BYTEVECTOR_CONTENTS (bv)
¶Return a pointer to the contents of bytevector bv.
R6RS only defines (bytevector-fill! bv
fill)
. Arguments start and end are a Guile extension
(cf. vector-fill!
,
string-fill!
).