comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: SWIG backend for Ada
Date: Tue, 26 Oct 2004 00:26:10 GMT
Date: 2004-10-26T00:26:10+00:00	[thread overview]
Message-ID: <pan.2004.10.26.00.26.16.172172@linuxchip.demon.co.uk.uk.uk> (raw)
In-Reply-To: 417CCFA5.50506@mailinator.com

On Mon, 25 Oct 2004 12:04:21 +0200, Alex R. Mosteo wrote:

> Dr. Adrian Wrigley wrote:
...
>> Now I look at it again, I think this would be a really excellent
>> project for Ada and Ada users!
> 
> Indeed. One of the big lacks of Ada is a fully operative tool like SWIG. 
> If open source projects which use SWIG to provide python, java and other 
> bindings start including Ada ones, coupled with the 3.4 gcc-ada, will 
> significally increase Ada awareness.

I see an Ada backend to SWIG as being another way of geting Ada
exposure closer the mainstream.  I think of the GtkAda and Glade UI
builder as bringing similar benefits.  We need tools and approaches
which integrate rather than alienate the mainstream.

> All my tries at using c2ada have been unsuccesful. The first problem is 
> obtaining the latest version, which seems not to be hosted anywhere. 

I didn't get very far myself either :(

I had a closer look at SWIG, and built myself a simple Ada binding
generator demo, based around the (obsolescent) 1.1p5 source.  It was very
simple to output correct function and procedure declarations, and
variables with appropriate pragma imports. But getting proper type
declarations, enumerations macro/functions and additional #includes looked
much more involved.

The 1.3 version is completely different - the project looks like
it has been rewritten mainly in C (from the original C++).

There is a Felix bindings generator discussed on the mailing list,
which looks like it is semanticly similar to an Ada specification.
Maybe this would be a good starting point?  There's also a
Modula3 interface generator, which might help (being another
compiled language with Pascal inspired syntax).

I suggested in my previous message that I'd like to see a thin bindings
generator as a standard part of the build process with Gnat.  It is
clear that this won't always be able to be completely automatic.
Somehow you need to work out which types and functions go into
which specifications when there are several header files each using
other header files, with some in common.  And then you need to
resolve the confusion in C between pointers, arrays, out and in
out parameters, and pass by reference.  But I think it can be done
well enough to beat the labour/bug intensive approach currently
necessitated.

At the moment, I only have time to dabble in projects like this, but
if I get inspired and make progress, I'll drop a note in this group!
-- 
Adrian




  reply	other threads:[~2004-10-26  0:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-23  9:58 SWIG backend for Ada Florian Weimer
2004-10-23 11:23 ` Marius Amado Alves
2004-10-23 11:36   ` Florian Weimer
2004-10-23 13:37 ` Dr. Adrian Wrigley
2004-10-25 10:04   ` Alex R. Mosteo
2004-10-26  0:26     ` Dr. Adrian Wrigley [this message]
2004-10-23 18:42 ` Guillaume Foliard
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox