lua-users home
lua-l archive

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


It's been a while, but vstruct isn't dead, only sleeping - while I
rewrite the parser from the ground up, and then rewrite pack() and
unpack() twice. And now it awakens, with the first beta of 1.1 ready to
go live. Bear in mind that THIS IS A BETA; I've subjected it to various
tests, including Sanooj's test suite generator of doom, but there's
bound to be something I've missed.

	What is it?
A library for packing and unpacking binary data, not unlike lhf's lpack
or Roberto's struct library. It sacrifices performance for flexibility
and portability.

	What's changed since 1.0?
- parser was completely rewritten. This is unlikely to make much
difference to most users; it's almost completely compatible with the 1.0
parser.
- bitpack support (eg, multiple 4-bit ints packed into one larger one) added
- read and write buffering are now performed where possible, drastically
improving performance when operating on files
- source for generated pack/unpack functions is now available to the caller
- an actual interface for adding new pack/unpack formats
- bytes-read/written reporting was removed, but should be back in before
it leaves beta

	Why use it?
- read and write support for signed and unsigned integers, fixed point
rationals, fixed-length, null-terminated, null-padded & counted strings,
skipping and padding, booleans, floats, bitmasks, and bitfields
- unpack/pack from/to strings, files, or anything that supports
file-like :read/:write/:seek operations
- any type can be any byte-aligned width - 24-bit integers? booleans
stored as uint32_ts? 128-bit masks? No problem.
- supports naming, grouping and repetition of fields (and groups, nested
arbitrarily deep). You can specify the structure of the data in the
format string and get back a table with conveniently named fields (and
possibly subtables); and then you can unpack an array of 10,000 of them
just by putting "10000 *" on the front - and pass the same table to
pack() to write it back to disk.
- written entirely in Lua, and thus very portable and easy to extend.

	Why NOT use it?
- written entirely in Lua, and thus slower and more memory-hungry than C
equivalents

	Where is it?
Homepage, such as it is:
	http://www.funkyhorror.net/toxicfrog/projects/vstruct/
Git repository:
	http://github.com/ToxicFrog/vstruct
Latest version download:
	http://github.com/ToxicFrog/vstruct/archives/v1.1b1