lookup-c-type ( name -- c-type )
Factor documentation > Factor handbook > C library interface > Passing data between Factor and C > C type specifiers
Prev:TYPEDEF:
Next:Primitive C types


Vocabulary
alien.c-types

Inputs and outputs
namea c-type-name
c-typea c-type


Word description
Looks up a C type by name.

Errors
Throws a no-c-type error if the type does not exist, or the word is not a C type.

Definition
IN: alien.c-types

GENERIC: lookup-c-type ( name -- c-type ) foldable flushable


Methods
USING: alien.c-types arrays ;

M: array lookup-c-type ;


USING: accessors alien.c-types alien.c-types.private kernel ;

M: pointer lookup-c-type
[ \ void* lookup-c-type ] dip
to>> dup primitive-pointer-type?
[ drop ] [ (pointer-c-type) ] if ;


USING: alien.arrays alien.c-types ;

M: string-type lookup-c-type ;


USING: alien.c-types classes.struct ;

M: struct-c-type lookup-c-type ;


USING: alien.c-types kernel words ;

M: word lookup-c-type
dup "c-type" word-prop resolve-typedef
[ ] [ no-c-type ] ?if ;