lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Miles Bader wrote:
> Duck <duck@roaming.ath.cx> writes:
>> Roberto's small but useful 'struct' library, here:
>> 
>> http://www.inf.puc-rio.br/~roberto/struct/struct.c
> 
> My that does look handy!
> 
> I was just thinking about trying to parse some binary files using
> lpeg, but wasn't quite sure how I was going to deal with floats etc..
> "struct.c" looks like it would be just the rhint. 
> 
> Roberto, care to put a minimal copyright/license statement in the
> header 
> comment, just to make it easier for us all to steal ?   :-)

I was just about to need that kind of library, the timing of this thread
is perfect for me.

I won't need it in my current project, but I noticed that struct,
contrary to lpack, doesn't have a way to capture a size_t sized integer.
On some platform, especially Windows x64, the long is 32bits only, while
the size_t is 64bits. It would be a nice addition to struct.

On the other hand, lpack has the opposite problem for size+string
matching. On Windows x64, 'p', 'P' and 'a' match a string with a
prefixed sized of respectively 8 (unsigned char), 16 (unsigned short)
and 64bits (size_t). It would be handy to have a string matching pattern
which uses 'unsigned int' as a size type.