Handbook Glossary
factorcode.org
heap-size ( name -- size )


Vocabulary
alien.c-types

Inputs
namea c-type-name


Outputs
sizean integer


Word description
Outputs the number of bytes needed for a heap-allocated value of this C type.

Examples
USING: alien alien.c-types prettyprint ; int heap-size .
4


Errors
Throws a no-c-type error if the type does not exist.

Definition
IN: alien.c-types

GENERIC: heap-size ( name -- size )


Methods
USING: accessors alien.c-types ;

M: abstract-c-type heap-size size>> ;


USING: alien.arrays alien.c-types arrays kernel math sequences ;

M: array heap-size unclip [ array-length ] [ heap-size ] bi* * ;


USING: alien.c-types kernel ;

M: c-type-name heap-size
[ lookup-c-type ] call \ heap-size execute ;


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

M: enum-c-type heap-size
[ base-type>> ] call \ heap-size execute ;


USING: alien.arrays alien.c-types kernel ;

M: string-type heap-size drop void* heap-size ;