Roman, this looks good.
I think one good test of your abstractions would be to parse JPEG Exif
with some MakerNotes. IIRC, you have to things like read a value that
is an offset from some other position (from top of file, start of
header, current position...), to follow linked lists, and to have
conditionals.
Another test would be getting video metadata out of popular video stream
and container formats. This would also be very useful for working with
video files.
Some documentation references are here:
http://www.neilvandyke.org/racket-mediafile/#%28part._.Content_.Types%29
I didn't come up with a generalized high-level abstraction, but looks
like you're on your way to doing it better than I did.
Neil V.
Roman Klochkov wrote at 06/15/2014 02:42 PM:
I've written universal library for parsing binary files or their parts
into Racket objects.
You may install it with 'raco pkg install binary-class'. This library
has verbose documentation and easy syntax.
You simply describe your data in terms of class fields and load the
object from the file.
I've written parsers for MP3 ID3 tags (binary-class-mp3 package) and
DBF files (binary-class-dbf package, no docs yet, only Readme at
https://github.com/Kalimehtar/binary-class-dbf). You may treat them as
usage examples for the library.
Please, give me feedback. Maybe I can do something better, or maybe
somebody write another file format to the library.
--
Roman Klochkov
____________________
Racket Users list:
http://lists.racket-lang.org/users