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,da3af210412d89fd X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Range types Date: Mon, 22 Oct 2007 09:23:01 +0200 Organization: Jacob's private Usenet server Message-ID: References: <1192994157.867598@athprx04> <471bb318$0$27835$39db0f71@news.song.fi> <471BC497.5060601@gmail.com> NNTP-Posting-Host: taasingegade.news.jacob-sparre.dk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: jacob-sparre.dk 1193037796 29565 85.82.239.166 (22 Oct 2007 07:23:16 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 22 Oct 2007 07:23:16 +0000 (UTC) User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:2drUkgvqJBY6wkjyBJ4Y3wlEP0w= Xref: g2news2.google.com comp.lang.ada:2537 Date: 2007-10-22T09:23:01+02:00 List-Id: Christos Chryssochoidis wrote: > I would like to define a subtype of Wide_Character for a program > that processes (unicode) text. This type would represent the Greek > letters. This sounds like what enumerated types are for. You could do it like this: type Faroese_Letter is ('a', 'A', 'b', 'B', 'd', 'D', '�', '�', 'e', 'E', [...], 'y', 'Y', '�', '�', '�', '�', '�', '�'); -- optional representation clause function To_Wide_Wide_Character (Item : in Faroese_Letter) return Wide_Wide_Character; function To_Faroese_Letter (Item : in Wide_Wide_Character) return Faroese_Letter; The conversion functions could make use of representation clauses, "Image" and "Value" functions, or tables. > 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. This could be done very simply using Ada.Strings.Maps. How you should do it depends strongly on what you actually need your Greek_Letter type for. Greetings, Jacob -- "Only Hogwarts students really need spellcheckers" -- An anonymous RISKS reader