comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Conditional Compilation in Ada
Date: Mon, 29 Jun 2009 14:30:11 +0200
Date: 2009-06-29T14:26:58+02:00	[thread overview]
Message-ID: <3pau3xsfpxdu$.50285z8b2fu.dlg@40tude.net> (raw)
In-Reply-To: 942d7aa6-a93b-45a3-b250-9398e2754af7@y17g2000yqn.googlegroups.com

On Mon, 29 Jun 2009 05:01:35 -0700 (PDT), Chrono wrote:

> Yes, I mean a GPS scenario. In my case it is a bit difficult to put
> files in a different folder for each scenario, due to I need to lead
> with a some thousands of files project.

But surely not all of them are scenario dependent.

> I used to have a solution with
> included a prepost compilation, a script launched before the unit
> compilation which turned up some part of the code to a commented one,
> so in "real" compilation, that part would not be compilated. I have a
> feeling that GPS has some way to do this without external scripts, a
> more ellegant solution, maybe using some compilation directives.
> My last implementation included some like this:

with Machine_Dependent_Constants;

> package body My_Package is
>   procedure Calculate_Data (My_Variable : out Some_Type) is
>   begin
>     --# if TARGET
>     MY_Variable = 1;

My_Variable :=  Machine_Dependent_Constants.My_Package_Constant;

>     --# end If TARGET
> 
>     --# if HOST
>     MY_Variable = 2;
>     --# end If HOST
>   end Calculate_Data;
> end My_Package;

You make a subdirectory for each platform and put a corresponding
implementation of Machine_Dependent_Constants.ads there. Then you go as
Simon have suggested.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-06-29 12:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-29 11:10 Conditional Compilation in Ada Pablo
2009-06-29 11:42 ` sjw
2009-06-29 12:01   ` Chrono
2009-06-29 12:30     ` Dmitry A. Kazakov [this message]
2009-06-29 12:15   ` sjw
2009-06-29 18:00     ` Chrono
2009-06-29 20:02       ` sjw
2009-06-30 10:41         ` Chrono
2009-06-29 20:13       ` Robert A Duff
2009-06-30 15:39 ` Per Sandberg
2009-06-30 17:03   ` Chrono
2009-06-30 20:09   ` sjw
2009-06-30 20:15   ` sjw
2009-07-01 16:20     ` Per Sandberg
2009-07-01  0:18 ` anon
replies disabled

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