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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f890526de6a8a218 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!news.glorb.com!koehntopp.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news.informatik.uni-stuttgart.de!not-for-mail From: Stefan Bellon Newsgroups: comp.lang.ada Subject: Re: How to detect OS type and version? Date: Thu, 13 Oct 2005 20:37:28 +0200 Organization: Bauhaus Software Technologies Message-ID: <20051013203728.2322138f@pscube.informatik.uni-stuttgart.de> References: <20051013115001.60b6a695@pscube.informatik.uni-stuttgart.de> NNTP-Posting-Host: pscube.informatik.uni-stuttgart.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: inf2.informatik.uni-stuttgart.de 1129228648 13957 129.69.217.201 (13 Oct 2005 18:37:28 GMT) X-Complaints-To: usenet@news.informatik.uni-stuttgart.de NNTP-Posting-Date: 13 Oct 2005 18:37:28 GMT X-Newsreader: Sylpheed-Claws 1.9.14 (GTK+ 2.6.10; i486-pc-linux-gnu) Xref: g2news1.google.com comp.lang.ada:5605 Date: 2005-10-13T18:37:28+00:00 List-Id: Jeffrey R. Carter wrote: > Stefan Bellon wrote: >=20 > > What we are doing is this: We configure our project for the target > > operating system and during that configuration, a small file with > > content similar to the following is generated: > >=20 > > separate (Bauhaus.OS) > > function Get_OS return String is > > begin > > return "GNU/Linux"; > > end Get_OS; >=20 > Is there some reason you're using String rather than an enumerated > type? Nothing more than historical reasons. In some files where OS specific code resides, we have something like the following on package level: Is_MSWindows : constant Boolean :=3D Get_OS =3D "Windows"; We hope that GNAT can optimize enough to propagate the Boolean constant and only include the active configuration in a case like if Is_MSWindows then Do_It_The_MSWindows_Way; else Do_It_The_UNIX_Way; end if; But yes, making it an enumeration is a neater solution (done now). --=20 Dipl.-Inf. Stefan Bellon Bauhaus Software Technologies | TTI GmbH TGZ Softwareanalysen c/o ISTE Tel.: +49 711 78 16 221 | Universit=E4tsstra=DFe 38 Fax.: +49 711 78 16 380 | 70569 Stuttgart