BE-STRUCT:
Alien endian-aware types
Prev:LE-STRUCT:
Next:LE-PACKED-STRUCT:


Vocabulary
alien.endian

Word description
Defines a struct where endian-unaware types become big-endian types. Note that endian-aware types will override the big-endianness of this struct declaration; little-endian types will stay little-endian. On big-endian platforms, the endian-unaware types will not change since they are the correct endianness already.
! When run on a big-endian platform, this struct should prettyprint the same as defined ! The output of this example is from a little-endian platform USE: alien.endian BE-STRUCT: s1 { a int } { b le32 } ; \ s1 see
USING: alien.c-types alien.endian classes.struct ; IN: scratchpad STRUCT: s1 { a be32 initial: 0 } { b le32 initial: 0 } ;


Definition
USING: classes.struct.private endian ;

IN: alien.endian

SYNTAX: BE-STRUCT:
parse-struct-definition big-endian
define-endian-struct-class ;