comp.lang.ada
 help / color / mirror / Atom feed
From: Chrono <pablittto@gmail.com>
Subject: Re: Conditional Compilation in Ada
Date: Tue, 30 Jun 2009 10:03:35 -0700 (PDT)
Date: 2009-06-30T10:03:35-07:00	[thread overview]
Message-ID: <df6408db-5a1f-44b7-988f-9c51e9fc10c8@g1g2000yqh.googlegroups.com> (raw)
In-Reply-To: t8r2m.42414$Rq.21470@newsfe15.ams2

On 30 jun, 12:39, Per Sandberg <per.sandb...@bredband.net> wrote:
> 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.
>
>

LOL!! It was exactly what I wanted!! Thanks very much, Per.



  reply	other threads:[~2009-06-30 17:03 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
2009-06-30 17:03   ` Chrono [this message]
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