From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,34bcb430c7809d79 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!newspeer1-win.ntli.net!newsfe3-win.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: SWIG backend for Ada User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada References: <87oeitbvsf.fsf@deneb.enyo.de> <417CCFA5.50506@mailinator.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Tue, 26 Oct 2004 00:26:10 GMT NNTP-Posting-Host: 81.100.88.147 X-Complaints-To: http://www.ntlworld.com/netreport X-Trace: newsfe3-win.ntli.net 1098750370 81.100.88.147 (Tue, 26 Oct 2004 01:26:10 BST) NNTP-Posting-Date: Tue, 26 Oct 2004 01:26:10 BST Organization: ntl Cablemodem News Service Xref: g2news1.google.com comp.lang.ada:5701 Date: 2004-10-26T00:26:10+00:00 List-Id: 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