develooper Front page | perl.perl5.porters | Postings from August 2012

Re: RFC: pack()ing long words

Thread Previous | Thread Next
From:
David Cantrell
Date:
August 13, 2012 15:35
Subject:
Re: RFC: pack()ing long words
Message ID:
50298134.5010707@cantrell.org.uk
On 13/08/2012 20:32, demerphq wrote:
> On 13 August 2012 20:31, Leon Timmermans <fawaka@gmail.com> wrote:
>> On Mon, Aug 13, 2012 at 8:16 PM, David Cantrell <david@cantrell.org.uk> wrote:
>>> I haven't looked at the source (and am somewhat
>>> terrified to do so TBH) but I can see that getting a bit tricky.
>>
>> pp_pack.c is where you need to be. It's rather full of "tricky".
> 
> And that is the diplomatic way to put it. :-)

I shouldn't have looked, but I did.  It is dark and full of terrors, and
I want my mummy.

Thankfully, all I'm asking for right now is that the syntax be defined,
so that I can go ahead and implement it in my module, and make sure I
use the same magic letter as pack() will do if pack/unpack ever sprout
this tentacle in the future.  So if people agree that this is a good
thing to do, all that actually needs patching for now is the
documentation, something like ...

    x  A null byte (a.k.a ASCII NUL, "\000", chr(0))
    X  Back up a byte.
  +
  + Y  NOT YET IMPLEMENTED.  This syntax is reserved for a word of
  +    an arbitrary number of bits.  The number of bits is
  +    specified as a base ten number in {braces}, eg Y{40} for
  +    a forty bit (or five byte) word.
  +
    @  Null-fill or truncate to absolute position, counted from the
       start of the innermost ()-group.
    .  Null-fill or truncate to absolute position specified by
       the value.

-- 
David Cantrell | http://www.cantrell.org.uk/david

Eye have a spelling chequer / It came with my pea sea
It planely marques four my revue / Miss Steaks eye kin knot sea.
Eye strike a quay and type a word / And weight for it to say
Weather eye am wrong oar write / It shows me strait a weigh.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About