comp.lang.ada
 help / color / mirror / Atom feed
From: Per Sandberg <per.sandberg@bredband.net>
Subject: Re: Conditional Compilation in Ada
Date: Tue, 30 Jun 2009 17:39:20 +0200
Date: 2009-06-30T17:39:20+02:00	[thread overview]
Message-ID: <t8r2m.42414$Rq.21470@newsfe15.ams2> (raw)
In-Reply-To: <5618a901-6b05-4a60-8362-7821261da50b@f19g2000yqo.googlegroups.com>

After all discussions her are a solution for conditinal compilation 
using GNAT:
------------------------------------------------
project Fools is
    type Dumb_Type is ("""JustStupid""", """Idiot""", """Fool""");
    Dumb : Dumb_Type := external ("DUMB", """Fool""");

    package Compiler is
       for Default_Switches ("ada") use
         ("-gnateDDUMB=" & Dumb);
    end Compiler;
end Fools ;
------------------------------------------------
package Fools  is
#if DUMB= """Idiot""" then
    a : Integer := 100;
#else
    a : integer := 20;
#end if;
    b : constant String := $DUMB;
end Fools ;
------------------------------------------------
with ada.Text_IO;
procedure Fools.main is
begin
    Ada.Text_IO.Put_Line(B & " -> "&a'img);
end Fools.main;
------------------------------------------------
/Ugly but it works
/Per


Pablo 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.



  parent reply	other threads:[~2009-06-30 15:39 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
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 [this message]
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