[racket] Binary class: general approach to binary data parsing and writing

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Mon Jun 16 02:39:03 EDT 2014

 > read a value that 
is an offset from some other position (from top of file, start of 
header, current position...)

It is possible. In my DBF file parser I have goto-bof and goto-record. I'll think about generalization/standartization for it.

> to follow linked lists

Not yet understand, how linked list is implemented in file. Will read sources of racket-mediafile.

> and to have conditionals.

It is the main goal of binary-class. One may select type of next field, depending on the value of previous field, or even change class of all object, depending of some field value. It is showed in ID3 parser, where ID3v2.3 and ID3v2.2 selected by tag in the header.

>  http://www.neilvandyke.org/racket-mediafile/#%28part._.Content_.Types%29

I'll try to port racket-media to my binary-class library.

Sun, 15 Jun 2014 21:59:24 -0400 от Neil Van Dyke <neil at neilvandyke.org>:
>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
>


-- 
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140616/ada30d51/attachment.html>

Posted on the users mailing list.