>c-array ( seq c-type -- array ) - Factor Documentation

>c-array ( seq c-type -- array )


Vocabulary
alien .data

Inputs
seq a sequence
c-type a C type


Outputs
array a byte-array


Word description
Outputs a freshly allocated byte-array whose elements are C type values from the given sequence.

Notes
The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the specialized-arrays vocabulary for details on the underlying sequence type constructed.

Errors
Throws an error if the type does not exist, the necessary specialized array vocabulary is not loaded, or the requested size is negative.

Examples
USING: alien.c-types alien.data prettyprint ; { 1.0 2.0 3.0 } alien.c-types:float >c-array .
float-array{ 1.0 2.0 3.0 }


Definition
IN: alien.data

GENERIC: >c-array ( seq c-type -- array )


Methods
USING: alien.c-types alien.data kernel ;

M: pointer >c-array drop void* >c-array ;


USING: alien.data kernel sequences words ;

M: word >c-array c-array-type new clone-like ; inline

AltStyle によって変換されたページ (->オリジナル) /