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,edafb2ab7e8839bc X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.in2p3.fr!in2p3.fr!proxad.net!proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Char type verification From: Georg Bauhaus In-Reply-To: <1163628033.606530.190550@i42g2000cwa.googlegroups.com> References: <1163628033.606530.190550@i42g2000cwa.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-Id: <1163627827.1632.10.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Date: Wed, 15 Nov 2006 22:57:07 +0100 NNTP-Posting-Date: 15 Nov 2006 23:54:23 CET NNTP-Posting-Host: 22425eca.newsspool1.arcor-online.net X-Trace: DXC=LANT55>gA:ho7QcPOVc_Z@3l3i>eSkHDY@ORbV On Wed, 2006-11-15 at 14:00 -0800, KE wrote: > Hi > > Assume that I have the following C code: > > #include > > #define uchar unsigned char > > > static uchar UCASE[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; This is the character range 'A' .. 'Z'. You can simply write c in 'A' .. 'Z' in any Boolean context where c is of type Character. Or use Ada.Characters.Handling.Is_Upper(c), if you want to include characters outside 7bit ASCII. The C type char, which IIRC might start at -127 or at 0, has an implementation defined representation, and is a bit vague. The Ada standard frowns upon vague things, hence Ada's character type does not have theses issues. OTOH, for interfacing with C, look at the standard package Interfaces.C. For more general uses, there are standard packages Ada.Strings.Maps, Ada.Strings.Maps.Constants, Ada.Characters.Handling, and Ada.Characters.Latin_1. There are all kinds of character predicates and translation subprograms. There are variants for Wide_Character, covering the BMP of ISO 10646. Ada 2005, in addition supports Unicode and related subprograms.