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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,80155a886d197693 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!y17g2000yqn.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: Conditional Compilation in Ada Date: Mon, 29 Jun 2009 04:42:44 -0700 (PDT) Organization: http://groups.google.com Message-ID: <768c8117-d8af-4a04-b27e-2e74b69c1e8b@y17g2000yqn.googlegroups.com> References: <5618a901-6b05-4a60-8362-7821261da50b@f19g2000yqo.googlegroups.com> NNTP-Posting-Host: 82.20.239.89 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1246275765 11483 127.0.0.1 (29 Jun 2009 11:42:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 29 Jun 2009 11:42:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y17g2000yqn.googlegroups.com; posting-host=82.20.239.89; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.18 (KHTML, like Gecko) Version/4.0.1 Safari/530.18,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6709 Date: 2009-06-29T04:42:44-07:00 List-Id: On Jun 29, 12:10=A0pm, 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. 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 :=3D external ("ENVIRONMENT"); case Env is when "Real" =3D> Env_Path =3D "Real"; when "Simulated" =3D> Env_Path =3D "Simulated"; end case; for Source_Dirs use ..... & Env_Path; (I haven't tested this particular example ...)