From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 A5F73BC57 for ; Wed, 18 Aug 2010 23:12:44 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjMCAH/pa0zRVdQ0kGdsb2JhbACgTggVAQEBAQkJDAcRAx+II54UiReCE4Y/LohUAQEDBYUyBIlt X-IronPort-AV: E=Sophos;i="4.56,229,1280700000"; d="scan'208";a="55762990" Received: from mail-vw0-f52.google.com ([209.85.212.52]) by mail3-smtp-sop.national.inria.fr with ESMTP; 18 Aug 2010 23:12:44 +0200 Received: by vws14 with SMTP id 14so1139543vws.39 for ; Wed, 18 Aug 2010 14:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=au+ATnoyRhzrO7tpJf+VDH3MrAKlkIk9kI/oE8l/tTE=; b=BJKcJ4JpthQc/y17ezdkzZM2VkMDhKEKNPumdRe1RiJaH4nRJAj2M1YksgICgqR68U vYL2JFC+nv51Q+cDIvtNui0DZMXIp63mGJs02ZphGbYOHt0V+YkrX0eOCAJhClSDBSk4 vB07Pdqd7zmvnmaeEsXT3VQ0xzq7KT+VRK8WY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=GS8jPAzuEDkZo50g5wQuqA7mP7OEf5zM7Hsxh7DyUNC3nfHCEDOG8aws5RsqCurz2g S0NM2siikWbV+yltO9KuZXXq9bmSWpGqYemEPZczG5Bz+3FqQ/lgN4Gq9zgfYx+vSheg NpsUabEDrZ4v8IHjkSp+aAfNSOHZsWIp/1gNQ= MIME-Version: 1.0 Received: by 10.220.87.70 with SMTP id v6mr5243086vcl.226.1282165963097; Wed, 18 Aug 2010 14:12:43 -0700 (PDT) Received: by 10.220.186.201 with HTTP; Wed, 18 Aug 2010 14:12:43 -0700 (PDT) Date: Wed, 18 Aug 2010 23:12:43 +0200 Message-ID: Subject: [Caml-list] [ANN] cowboy and cowboy/glib preview, C binding generation framework From: Adrien To: Caml Mailing List Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; bindings:01 bindings:01 ocaml:01 structs:01 parser:01 cpp:01 annotations:01 'int:01 'int:01 ocaml:01 cowboy:98 cowboy:98 git:98 git:98 preprocessor:01 Hi, I am pleased to announce a preview release of cowboy, a framework for the generation of C bindings. It is currently used to generate bindings for glib-based libraries. It's not a magical binding writer however: work is still needed in order to create bindings. But it can ease their generation, help avoid regular expression stunts and allow writing the generator in ocaml. It provides an access to the list of a library's functions, enums, structs... Yohann Padioleau's yacfe[2] C/C++/Java parser actually does most of the work. It can "parse" cpp (the preprocessor kind), giving access to valuable human-readable information. The code in cowboy takes yacfe's output and simplifies it: dropping function's implementation and only keeping names and prototypes. It also keeps comments which often (doxygen, gtk-doc...) contain annotations to tell an 'int array' from an 'out parameter', both being 'int*' in C. Cowboy also provides a few helper functions and a sort of templates for META, OCamlMakefile and OASIS files. Currently, cowboy is used to generate bindings to glib-based libraries (webkit-gtk is almost ready, others will follow). However it is not to be used for everything. Stating the obvious, it is only interesting when automation is worth it. If the library is not big enough or if its API does not follow a set of conventions, writing bindings by hand will be easier. In any case, do not hesitate to ask me: on the mailing-list, through private e-mail, or on IRC (freenode network, #ocaml or #ocaml-fr channels, which I'm always connected to). PS: Some have seen and might remember "ocaml-gir" which did a similar job: cowboy has a more general scope and is also easier to work with (gobject-introspection is very complex and under-documented, and it's ... weird). PS2: I am aware that cowboy is unevenly documented. If you start anything, again, do not hesitate to ask me. [1] http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=cowboy/cowboy.git (use the "snapshot" feature to download) [2] http://padator.org/software-yacfe.php (see doc/yacfe on how to install it!) --- Adrien Nader