manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.6.6.2 Manipulating Bytevectors

Bytevectors can be created, copied, and analyzed with the following procedures and C functions.

Scheme Procedure: make-bytevector len [fill]
C Function: scm_make_bytevector (len, fill)
C Function: scm_c_make_bytevector (size_t len)

Return a new bytevector of len bytes. Optionally, if fill is given, fill it with fill; fill must be in the range [-128,255].

Scheme Procedure: bytevector? obj
C Function: scm_bytevector_p (obj)

Return true if obj is a bytevector.

C Function: int scm_is_bytevector (SCM obj)

Equivalent to scm_is_true (scm_bytevector_p (obj)).

Scheme Procedure: bytevector-length bv
C Function: scm_bytevector_length (bv)

Return the length in bytes of bytevector bv.

C Function: size_t scm_c_bytevector_length (SCM bv)

Likewise, return the length in bytes of bytevector bv.

Scheme Procedure: bytevector=? bv1 bv2
C Function: scm_bytevector_eq_p (bv1, bv2)

Return is bv1 equals to bv2—i.e., if they have the same length and contents.

Scheme Procedure: bytevector-fill! bv fill
C Function: scm_bytevector_fill_x (bv, fill)

Fill bytevector bv with fill, a byte.

Scheme Procedure: bytevector-copy! source source-start target target-start len
C Function: scm_bytevector_copy_x (source, source_start, target, target_start, len)

Copy len bytes from source into target, starting reading from source-start (a positive index within source) and start writing at target-start. It is permitted for the source and target regions to overlap.

Scheme Procedure: bytevector-copy bv
C Function: scm_bytevector_copy (bv)

Return a newly allocated copy of bv.

C Function: scm_t_uint8 scm_c_bytevector_ref (SCM bv, size_t index)

Return the byte at index in bytevector bv.

C Function: 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.

C Macro: size_t SCM_BYTEVECTOR_LENGTH (bv)

Return the length in bytes of bytevector bv.

C Macro: signed char * SCM_BYTEVECTOR_CONTENTS (bv)

Return a pointer to the contents of bytevector bv.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.