6 Miscellaneous Support
procedure
(list->cblock lst type [expect-length]) → cpointer?
lst : list? type : ctype? expect-length : (or/c exact-nonnegative-integer? #f) = #f
If expect-length is not #f and not the same as (length lst), then an exception is raised instead of allocating memory.
procedure
(vector->cblock vec type [expect-length]) → cpointer?
vec : vector? type : ctype? expect-length : (or/c exact-nonnegative-integer? #f) = #f
procedure
(vector->cpointer vec) → cpointer?
vec : vector?
procedure
(flvector->cpointer flvec) → cpointer?
flvec : flvector?
procedure
(saved-errno new-value) → void? new-value : exact-integer?
Changed in version 6.4.0.9 of package base: Added the one-argument variant.
procedure
(lookup-errno sym) → (or/c exact-integer? #f)
sym : symbol?
The recognized symbols currently consist of the 81 codes defined by IEEE Std 1003.1, 2013 Edition (also known as POSIX.1), including 'EINTR, 'EEXIST, and 'EAGAIN.
Changed in version 6.6.0.5 of package base: Relaxed the contract and added support for more symbols.
The conversion is roughly equivalent to
(let ([p (malloc from-type)]) (ptr-set! p from-type v) (ptr-ref p to-type))
If v is a cpointer, (cpointer-gcable? v) is true, and from-type and to-type are both based on _pointer or _gcpointer, then from-type is implicitly converted with _gcable to ensure that the result cpointer is treated as referring to memory that is managed by the garbage collector.
If v is a pointer with an offset component (e.g., from ptr-add), (cpointer-gcable? v) is true, and the result is a cpointer, then the result pointer has the same offset component as v. If (cpointer-gcable? v) is false, then any offset is folded into the pointer base for the result.
procedure
(cblock->list cblock type length) → list?
cblock : any/c type : ctype? length : exact-nonnegative-integer?
procedure
(cblock->vector cblock type length) → vector?
cblock : any/c type : ctype? length : exact-nonnegative-integer?