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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,da3af210412d89fd X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!kanaga.switch.ch!switch.ch!news.grnet.gr!newsfd02.forthnet.gr!not-for-mail From: Christos Chryssochoidis Newsgroups: comp.lang.ada Subject: Re: Range types Date: Mon, 22 Oct 2007 00:28:55 +0300 Organization: FORTHnet S.A., Atthidon 4, GR-17671 Kalithea, Greece, Tel: +30 2109559000, Fax: +30 2109559333, url: http://www.forthnet.gr Message-ID: <471BC497.5060601@gmail.com> References: <1192994157.867598@athprx04> <471bb318$0$27835$39db0f71@news.song.fi> NNTP-Posting-Host: athprx04.forthnet.gr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: athprx02.forthnet.gr 1193002143 16724 193.92.150.70 (21 Oct 2007 21:29:03 GMT) X-Complaints-To: abuse@forthnet.gr NNTP-Posting-Date: Sun, 21 Oct 2007 21:29:03 +0000 (UTC) To: Niklas Holsti User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) In-Reply-To: <471bb318$0$27835$39db0f71@news.song.fi> Cache-Post-Path: newsfd02!unknown@acro.ath.forthnet.gr Xref: g2news2.google.com comp.lang.ada:2531 Date: 2007-10-22T00:28:55+03:00 List-Id: Niklas Holsti wrote: > > Christos Chryssochoidis wrote: >> Hi, >> >> I have a question regarding the range types in Ada. Is there any way >> to specify that a type is, say, the values 1..100 and additionally the >> values 150..200? > > Brief answer: sorry, no. You cannot leave gaps in the range of numeric > types. > > You could define an enumeration type with 151 literals and write a > "representation clause" for this type that would force the compiler to > use the values 1 .. 100 as the internal representation of the first 100 > literals and the values 150 .. 200 as the internal representation of the > last 51 literals. This would override the the default internal > representation that uses the values 0 .. 150 in order. But you could not > do direct arithmetic (plus, minus, ...) on such a type because those > operations are not predefined for enumeration types. > > Perhaps you could explain why you need a type with a gap? > I would like to define a subtype of Wide_Character for a program that processes (unicode) text. This type would represent the Greek letters. Greek letters in Unicode, with all their diacritics, are located in two separate ranges: 0370 - 03D7 and 1F00 - 1FFF. That's 360 characters to write in an enumeration... Since gaps are not allowed in ranges, I 'm thinking instead of defining such a type, to define a function that would accept a Wide_Character as argument and return a boolean value indicating whether the given Wide_Character falls in the ranges of the Greek characters. Thanks very much, C.C.