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: a07f3367d7,a1ef1443958f8b1e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!83.128.0.11.MISMATCH!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!news.swapon.de!eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Ada-Python binding Date: Sat, 08 May 2010 00:24:11 +0200 Organization: A noiseless patient Spider Message-ID: <87iq6zz6yc.fsf@ludovic-brenta.org> References: <29e8c624-74fb-4a92-9ead-aa3cf1cecda6@o14g2000yqb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Fri, 7 May 2010 22:24:13 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="yFGFjXWDRII/0KbrIhbhvw"; logging-data="3687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18y3hQV/2qbC5eAajFRqeog" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:M5xtxx6aH8dE6adxksrxMbl+5hY= sha1:J2O6DF1od+dldtmGWRXXMfZh6O8= Xref: g2news2.google.com comp.lang.ada:11408 Date: 2010-05-08T00:24:11+02:00 List-Id: Maciej Sobczak writes on comp.lang.ada: > Hello, > > The following article might be of interest to programmers practicing > mixed-language development: > > http://www.inspirel.com/articles/Ada_Python_Binding.html > > This article builds on the various bits and pieces of knowledge that I > needed to collect in order to proceed with one of my projects. > Hopefully it will be useful for others as well. > > All comments are welcome. The GNAT Programming Studio uses this technique extensively. Indeed, Python is not only the scripting language for GPS but also the language in which parts of GPS are written. GPS exposes a rich API to the Python scripts and plug-ins. You can have a look at the relevant part of the GPS sources here: [1] http://libre2.adacore.com/viewvc/trunk/gps/gnatlib/src/python [2] http://libre2.adacore.com/viewvc/trunk/gps/python [3] http://libre2.adacore.com/viewvc/trunk/gps/share/library [4] http://libre2.adacore.com/viewvc/trunk/gps/share/plug-ins [1] is part of what AdaCore want to turn into a reusable library; currently the sources are still "hidden" inside the GPS source tree. This is, essentially, an Ada-Python binding that allows not only to call Ada subprograms from Python but also to launch a Python interpreter and execute scripts from within an Ada program. [2] loads the Python interpreter into GPS for to execute plug-ins and user-defined initialization scripts written in Python. [3] contains a library of reusable components written in Python, for use in plug-ins or user-defined scripts. [4] contains the plug-ins written in Python. Most of the modules of GPS export an API to these plug-ins; the code that does that is scattered in the rest of the source tree. HTH -- Ludovic Brenta.