From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id EE55EBBCA for ; Fri, 4 Apr 2008 19:58:04 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAKYI9kfAXQIm/2dsb2JhbACmCoV8 X-IronPort-AV: E=Sophos;i="4.25,605,1199660400"; d="scan'208";a="11085508" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 04 Apr 2008 19:58:04 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m34Hw347015644 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 4 Apr 2008 19:58:04 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUBAH8J9kfRVaKyc2dsb2JhbACRTQEMAwQFCRSUDYV8 X-IronPort-AV: E=Sophos;i="4.25,605,1199660400"; d="scan'208";a="24615028" Received: from el-out-1112.google.com ([209.85.162.178]) by mail4-smtp-sop.national.inria.fr with ESMTP; 04 Apr 2008 19:58:03 +0200 Received: by el-out-1112.google.com with SMTP id o28so144986ele.2 for ; Fri, 04 Apr 2008 10:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=P0WF1tcIWmwg3+4k4t/nfzyoDP+ZXpNj5Opr4+ymvxg=; b=TgcIa/kV8SX1yJ7RlbXtUJFB8fw8k4ByYlr8eU8NJOGLD4qj5heqibc1bBT8Qvuf3MdlW4A/0U9oGSW+ZhtONzj39agZPwVov+kkvtdWvSBiFg82fAJclnNZg6ES/Q9VXZHHX+5DINRmNJTgI6ggz1DHHCqQBV3hs2pElkOVDUo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=KJ1UwN0D9LUzV9gBMdIvv8PB4D/EcQLcopmbErPVWYVS+utOmz4Go7Xd0o67CxBJ4A1vhC+41CYbgeqC0zZ3ir1cQde4J/GK3ks2QvJmH2rHJc6uNa56jzcGnLBXk1Q0AwyYpdHWGlCUP8fCkXQc/FJR/YEOQ0ZUv64DmSKLNcQ= Received: by 10.140.192.9 with SMTP id p9mr711015rvf.193.1207331880103; Fri, 04 Apr 2008 10:58:00 -0700 (PDT) Received: by 10.140.131.10 with HTTP; Fri, 4 Apr 2008 10:58:00 -0700 (PDT) Message-ID: <666572260804041058hdf6e6aclf52cc8a1ee812090@mail.gmail.com> Date: Fri, 4 Apr 2008 19:58:00 +0200 From: Adrien To: caml-list@inria.fr Subject: Re: [Caml-list] Operators for Int64 and Int32 In-Reply-To: <20080404124729.460bc323.mle+ocaml@mega-nerd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <906164100804030708p3e2788a0p29b69f4d46600622@mail.gmail.com> <20080404071729.154e130e.mle+ocaml@mega-nerd.com> <20080403221704.GA31402@annexia.org> <20080404124729.460bc323.mle+ocaml@mega-nerd.com> X-Miltered: at discorde with ID 47F66C2B.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 variants:01 unpacking:01 complained:01 mldonkey:01 mldonkey:01 translated:01 camlp:01 wiki:01 emule:98 wrote:01 parsing:01 caml-list:01 int:01 2008/4/4, Erik de Castro Lopo : > 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