Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Operators for Int64 and Int32
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Adrien <camaradetux@g...>
Subject: Re: [Caml-list] Operators for Int64 and Int32
2008/4/4, Erik de Castro Lopo <mle+ocaml@mega-nerd.com>:
> Richard Jones wrote:
>
> > I know that libsndfile is written in C, but I'd be interested to know
> > how much bitmatch
> > (http://et.redhat.com/~rjones/bitmatch/html/Bitmatch.html) might or
> > might not make a putative OCaml version easier to write.
>
> The hard bit has almost nothing to do with programming language
> and almost everything to do with WAVE (and AIFF and all the other
> formats) being extremely poorly and/or loosely specified, with
> over 100 data encoding variants and dozens of broken implementations
> in the field.
>
> Very early in the libsndfile development process I came up with
> a good way of packing and unpacking the headers (ie effectively
> the same  functionality as bitmatch) and everything has been
> built on top of that.
>
> Erik
>

I have to complain too about RIFF which is the format for the wave
container which is usually used for pcm. I, with two friends have been
working on a project involving sound and we needed to decode wave
files (to get their Fourier transform). I too have written a parsing
library. It took me some time to get the idea right but in the end, it
boiled down to six or seven lines of code.
However, writing the format description has been a real nightmare : I
found three different documents, started to implement from one which
turned out to be incomplete and incorrect, then moved on to the second
which too had problem (though less) and only the third, which was by
far the most complex of the three and complained about the format all
the time, gave me a proper reference.

But if you want the worst of the worst, have a look at the
edonkey-emule protocol. It's basically a reversed-engineered protocol
made for mldonkey, reused in emule, modified in the most inconsistent
way by tens of people pretending to keep backward compatibility with
clients that can't connect anymore to the network.
I tried to implement this but completely gave up after several days
without writing anything useful.
And by the way, I wanted to congratulate the mldonkey devels who
managed to implement these protocols (with the best algorithms too ;)
).


As for my library (I'm sure someone will ask about it), it is
basically used like Bitmatch. When I saw the Bitmatch release, I
translated Richard's examples to my library. I took me a few minutes.
It would benefit from some sugar but I don't know camlp4 (yet).

If you want you can have a look at the examples here :
http://ocaml.yaxm.org/wiki/doku.php?id=binary_parse#examples
I'll probably make some release this week-end if I find enough time (I
already have to get a new ID card as mine has just been stolen).


 ---

Adrien Nader