From: sjw <simon.j.wright@mac.com>
Subject: Re: Conditional Compilation in Ada
Date: Mon, 29 Jun 2009 04:42:44 -0700 (PDT)
Date: 2009-06-29T04:42:44-07:00 [thread overview]
Message-ID: <768c8117-d8af-4a04-b27e-2e74b69c1e8b@y17g2000yqn.googlegroups.com> (raw)
In-Reply-To: 5618a901-6b05-4a60-8362-7821261da50b@f19g2000yqo.googlegroups.com
On Jun 29, 12:10 pm, Pablo <pablit...@gmail.com> wrote:
> Hi, does someone know how to make conditional compilation in Ada with
> Scenarios? Say, I need to hide from compilation a part of an Ada code
> in some Scenario mode.
When you say 'scenario' do you mean a GPS scenario? If not, you will
have to tell us more...
The normal way of dealing with this problem is to put the alternate
codes in different directories and adjust the compiler's source path
to pick up the appropriate file.
package body Target is
..
function Get_Position (At_Time : Time) return Position is separate;
..
then (with GNAT) the separate body will be target-get_position.adb. If
your scenarios are Real and Simulated, make subdirectories Real/ and
Simulated/ and place an appropriate implementation in each. Your GPR
might then look like
type Environment is ("Real", "Simulated");
Env : Environment := external ("ENVIRONMENT");
case Env is
when "Real" => Env_Path = "Real";
when "Simulated" => Env_Path = "Simulated";
end case;
for Source_Dirs use ..... & Env_Path;
(I haven't tested this particular example ...)
next prev parent reply other threads:[~2009-06-29 11:42 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 [this message]
2009-06-29 12:01 ` Chrono
2009-06-29 12:30 ` Dmitry A. Kazakov
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