slot>endian-slot ( endian slot -- endian-slot )


Vocabulary
alien.endian

Definition
USING: alien.c-types arrays combinators kernel sequences ;

IN: alien.endian

: slot>endian-slot ( endian slot -- endian-slot )
dup array?
[ first2 [ slot>endian-slot ] dip 2array ] [
{
{ [ dup char = ] [ 2drop char ] }
{ [ dup uchar = ] [ 2drop uchar ] }
{ [ dup short = ] [ { le16 be16 } endian-slot ] }
{ [ dup ushort = ] [ { ule16 ube16 } endian-slot ] }
{ [ dup int = ] [ { le32 be32 } endian-slot ] }
{ [ dup uint = ] [ { ule32 ube32 } endian-slot ] }
{ [ dup longlong = ] [ { le64 be64 } endian-slot ] }
{
[ dup ulonglong = ]
[ { ule64 ube64 } endian-slot ]
}
{ [ dup endian-c-type? ] [ nip ] }
[ unsupported-endian-type ]
} cond
] if ;