I never intended it to be a standalone package, mainly because, for it to
be useful, I'd have to generalize a lot of stuff and add a lot of
features.  If someone else wanted to though...

On Fri, Sep 18, 2015 at 4:05 PM, Patrick O'Leary <[email protected]>
wrote:

> On Thursday, September 17, 2015 at 8:23:01 PM UTC-5, Tom Breloff wrote:
>>
>> I have an alternative to StrPack.jl here:
>> https://github.com/tbreloff/CTechCommon.jl/blob/master/src/macros.jl.
>> If you have a type that mimics a c-struct, you can create like:
>>
>> @packedStruct immutable MyStruct
>>   field1::UInt8
>>   field2::Byte
>> end
>>
>> and it creates some methods: read, reinterpret, etc which can convert raw
>> bytes into the immutable type.
>>
>> I've only used it on very specific types of data, but it may work for you.
>>
>
> This looks like a nice simple alternative. I haven't touched StrPack in a
> long time, but I believe the analogous StrPack syntax is:
>
> @struct type MyStruct
>   field1::UInt8
>   field2::Byte
> end, align_packed
>
> Though since these are both 1-byte fields, there wouldn't be any padding
> under the default strategy anyways.
>
> I'm not sure if this works with immutables--someone may have contributed
> that? Maintainer neglect of StrPack is acknowledged :D Have you considered
> possibly spinning your simplified version into its own package, Tom?
>
> StrPack is/was pretty ambitious; I wanted to be able to get down to
> bit-level unpacking, with the goal of being able to parse a Novatel
> RANGECMP log (http://www.novatel.com/assets/Documents/Bulletins/apn031.pdf)
> entirely with an annotated type declaration. I'd still like to do this, but
> it's been hard to find the motivation to work on it. (There's a branch up
> on the repository which pushes towards this, but the work is incomplete.)
>
> The manual alternative Stefan proposes is definitely a good option,
> especially if this is a one-off structure.
>

Reply via email to