[% setvar title pack/unpack C-like enhancements %]
Note: these documents may be out of date. Do not use as reference! |
To see what is currently happening visit http://www.perl6.org/
pack/unpack C-like enhancements
Maintainer: Ilya Zakharevich <ilya@math.ohio-state.edu> Date: 16 September 2000 Mailing List: perl6-language-data@perl.org Number: 247 Version: 1 Status: Developing
This RFC proposes C-like syntactic sugar to templates of pack/unpack.
An alternative style of type specifiers is allowed in pack()/unpack()
TEMPLATEs. This style is used in the parts of the TEMPLATE enclosed
in braces, as in '{ C_STYLE_TEMPLATE }'
. Optionally, if TEMPLATE
starts with 'struct {'
(with possible intervening whitespace and comments)
struct
is ignored.
When this style is in scope, then
32
are prohibited, use [32]
instead;struct {TEMPLATE}
should be used instead of (TEMPLATE)
for grouping;int
/char
/short
/long
/long long
should be used. They may be
preceeded by unsigned
/signed
/native
/little-endian
/big-endian
,
(native
being the default). The type string
should be used instead
of a
, with modifiers byte
/utf8
if needed.ignore
may be used to replace 'x'
. aligh(LEN)
may be used as a
prefix to replace 'x!LEN'
;
I8
/I16
/I32
/U8
/U16
/U32
can be used too;int_8
(sp?) etc. can be used too;[]
should be used instead of *
, as in '{ int[4]; short[] }'
;[]
, it should start with sizeof
, as
in '{ string[ sizeof long ] }'
which is equivalent to a[L]
.None.
Straightforward.
RFC 142: Enhanced Pack/Unpack
RFC 246: pack/unpack uncontrovercial enhancements