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,c35edbbda4c7f58f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: Frank Piron Newsgroups: comp.lang.ada Subject: Re: Conditional compilation in Ada? Date: Wed, 17 Nov 2004 11:02:47 +0100 Organization: 1&1 Internet AG Message-ID: References: NNTP-Posting-Host: p508b4aef.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Trace: online.de 1100685775 32294 80.139.74.239 (17 Nov 2004 10:02:55 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Wed, 17 Nov 2004 10:02:55 +0000 (UTC) User-Agent: Opera7.23/Win32 M2 build 3227 Xref: g2news1.google.com comp.lang.ada:6247 Date: 2004-11-17T11:02:47+01:00 List-Id: Am Tue, 16 Nov 2004 19:30:39 +0100 schrieb jtg : > I am using Ada for many years now, but recently > I stumbled upon a problem I cannot solve: I need > some kind of conditional preprocessing, which is > commonly used in C programs: > > #ifdef CONDITION > (some source code) > #else > (other source code) > #endif > > How to achieve it with Ada? We had another problem concerning conditional compilation: In a project containing roundabout 30 packages, we wanted to switch on and off debugging messages for each package individually and for certain levels (application defined messages, exceptions, include callback procedures from the GUI part, ...). We tried with gnatprep but found it not suitable for this task. Finally we defined a certain "comment syntax" for the messages and a debug.conf file format. Then we wrote an "adaprep" for our purposes which read the debug.conf - where you can switch on and off debugging for each package (procedure/function) and set a level - and then modifies the sources. The resulting sources with debugging messages are copied to a separate code tree and built. Sounds complicated but is done now with few commands. The whole thing works fine for us, but compiling a new "debug version" may take some time ... Frank Piron