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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d3037f71d9d26da1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-10 13:41:47 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!newspeer1.nwr.nac.net!colt.net!pop-news-1.colt-telecom.nl!newsgate.cistron.nl!binary.news.xs4all.nl!skynet.be!skynet.be!louie!tjb!not-for-mail Sender: lbrenta@lbrenta Newsgroups: comp.lang.ada Subject: Re: Preprocessor functionality equivalent ideas needed References: From: Ludovic Brenta User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Date: 10 Dec 2003 22:41:44 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: 81.241.25.221 X-Trace: 1071092506 reader3.news.skynet.be 5487 81.241.25.221:54029 X-Complaints-To: usenet-abuse@skynet.be Xref: archiver1.google.com comp.lang.ada:3336 Date: 2003-12-10T22:41:44+01:00 List-Id: "Greg Milford" writes: > Hello > > I checked the FAQ for this group and did not get an answer to this. I know > Ada does not have a preprocessor, so how should I go about maintaining > changes to a common code base that needs to be built under two different > configurations? > > Am I left with using Global variables or has a better method been used? I > am new to Ada so be kind :) > > Greg GNAT does have a preprocessor called gnatprep, but it is not part of the language standard. If you cannot or won't use it, the usual way to deal with configuration management issues such as you describe is to write two or more different bodies for a single package specification, and let the build scripts (Makefiles or such) compile one or the other for each particular configuration. Of course, you'll want to isolate all configuration-dependent stuff into a separate package which you keep as small as possible; this is usual software engineering practice. There are various ways to achieve this. For example, assume you have: a.ads the package specification a1.adb package body for target 1 a2.adb package body for target 2 Your makefiles could select one of the *.adb files and symlink it to a.adb; then the compiler finds the proper file and compiles it. This is in fact the approach used by GNAT itself. Another approach could be to simulate a preprocessor with sed or perl scripts. HTH -- Ludovic Brenta.