Re: RFC 246 (v1) pack/unpack uncontrovercial enhancements

2000-09-18 Thread Chaim Frenkel

How about a Base64 to match with uuencode?

chaim

 "PRL" == Perl6 RFC Librarian [EMAIL PROTECTED] writes:

PRL =head1 ABSTRACT

PRL This RFC proposes simple enhancements to templates of pack/unpack builtins.
PRL These enhancements do not change the spirit of how pack/unpack is used.
PRL The semantic is enhanced as much as possible under this constaint.

PRL Additional changes to pack/unpack are listed in other proposals.


-- 
Chaim FrenkelNonlinear Knowledge, Inc.
[EMAIL PROTECTED]   +1-718-236-0183



RFC 246 (v1) pack/unpack uncontrovercial enhancements

2000-09-17 Thread Perl6 RFC Librarian

This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

pack/unpack uncontrovercial enhancements

=head1 VERSION

  Maintainer: Ilya Zakharevich [EMAIL PROTECTED]
  Date: 16 September 2000
  Mailing List: [EMAIL PROTECTED]
  Number: 246
  Version: 1
  Status: Developing

=head1 ABSTRACT

This RFC proposes simple enhancements to templates of pack/unpack builtins.
These enhancements do not change the spirit of how pack/unpack is used.
The semantic is enhanced as much as possible under this constaint.

Additional changes to pack/unpack are listed in other proposals.

=head1 DESCRIPTION

The following additional constructs are allowed in pack()/unpack() TEMPLATEs:

=over 8

=item C, and C;

denotes the same as whitespace.

=item C[4]

denotes the same as C4, as in C'i[4] S[4]'.

=item C[TEMPLATE]

denotes the same as C[$LEN]; here $LEN is the length taken by the data
described by the template:  C$LEN = length pack TEMPLATE, @something
(as far as it does not depend on @something, so CA* is prohibited).
This multiplier makes sense for byte-oriented types only.  For example,
the middle part of C'C[32] C[L8] C[64]' will extract Ithe substring which
consists of 8 packed longs.  Similarly, C'C[32] x[L8] C[64]' will skip
this substring.

=item Cx!LEN

skip to offset divisible by CLEN.  For example, C'x![L]' will align
to a long-compatible boundary.

=item CW

a BER encoded double.

=item Cw!

a BER encoded "length", in other words, an integer encoded as BER lengths are.

=item C(TEMPLATE)

a group.  May take a repeatition count either as C(Ns)33 or as CN/(Ns).

=item CTEMPLATE1//TEMLATE2

On unpack(): CTEMPLATE1 extracts a number.  This number specifies the number
of following bytes which the TEMPLATE2 should be applied to.  (The difference
with CTEMPLATE1/(TEMLATE2) is that in the latter case the number extracted
by CTEMPLATE1 is not the number of bytes, but the repetition count.)
During pack(), makes the opposite operation.

For example,

  pack 'n//(A[4] C*)', 'a', 9..14

does the same as

  pack 'n A[4] C*', 10, 'a', 9..14

(this is especially useful with the grouping proposals introduced in a
future RFC).

=item quad-formats

should work on 32-bit architectures too, using doubles instead (with a
possible precision loss).

=back

=head1 MIGRATION ISSUES

None.

=head1 IMPLEMENTATION

Straightforward.

=head1 REFERENCES

RFC142: Enhanced Pack/Unpack