caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Adrien <camaradetux@gmail.com>
To: Joel Reymont <joelr1@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] replacing swig
Date: Thu, 6 Jan 2011 14:15:07 +0100	[thread overview]
Message-ID: <AANLkTimL0wcjMV1xMSD9=ReCozeKr7-US0+6fqqG=Sme@mail.gmail.com> (raw)
In-Reply-To: <D4168DAA-A60E-481A-B4C1-7E8252B619CD@gmail.com>

Hi,

You need annotations in the code. There's just no way to guess this.
And you'd have to guess for out-parameters too, and maybe also
"ownership" (who will have to free the object), and length of arrays
(end delimiters)...


For an overview of which kind of info you want, see:
  http://live.gnome.org/GObjectIntrospection/Annotations


As you'll see, there is a project named gobject-introspection: the
annotations in comments around functions are parsed and an XML file is
created.
I started a project named "ocaml-gir" to take advantage of that and,
really didn't enjoy working with it. I've actually stopped developping
it completely: I've even emptied git HEAD so people are less likely to
use it.
Working with a bad tool outputting bad data wasn't a lot of fun.

I then started "cowboy"[1] which uses yacfe to parse source files,
simplifies its output a bit and then parses the gobject annotations to
create bindings. It's possible to do do that for non-gobject projects
too.
There should be more info in the announcement from a few months
ago[2]. I've had no time to spend on the documentation unfortunately
but if you need help/details, I'll help (although, not before
saturday).


You might also want to look at qtcaml[3]. It interfaces with gccxml
and it should also be possible to use this interface and only write an
"adapter" like you'd do with cowboy.


Whatever you do, unless you have a magic wand, you will need
annotations and a "regular" interface: it should follow a set of
standards/rules. If you have troubles remembering the interface, how
could you make a computer understand it?
Changing the interface of the project won't be possible usually but
adding annotations upstream shouldn't be a problem. It might take time
but you'll probably get help from the project members.


[1] http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=cowboy/cowboy.git;a=summary
[2] http://caml.inria.fr/pub/ml-archives/caml-list/2010/08/9b3412eabe356c5740441fb017d84911.en.html
[3] http://qt-caml.crapulion.org/trac


Regards,

Adrien Nader

On 06/01/2011, Joel Reymont <joelr1@gmail.com> wrote:
> Suppose you are writing a SWIG replacement based on gccxml, gcc plugins,
> etc.
>
> How would you figure out if the user meant char** as a pointer to a string
> vs an array of characters?
>
> SWIG handles this with typemaps. Does this mean that whatever replaces SWIG
> would also require a typemap DSL?
>
> ---
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
>
>
>
>
>
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>

      parent reply	other threads:[~2011-01-06 13:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 12:20 Joel Reymont
2011-01-06 12:31 ` [Caml-list] " Joel Reymont
2011-01-06 13:15 ` Adrien [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimL0wcjMV1xMSD9=ReCozeKr7-US0+6fqqG=Sme@mail.gmail.com' \
    --to=camaradetux@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).