From: "Robert C. Leif" <rleif@rleif.com>
Subject: Character Sets
Date: Tue, 26 Nov 2002 13:41:48 -0800
Date: 2002-11-26T13:41:48-08:00 [thread overview]
Message-ID: <mailman.1038346922.19153.comp.lang.ada@ada.eu.org> (raw)
From: Bob Leif
I am trying to test if a character is not in the Latin_1 character set.
I choose the Euro because it is in Latin_9 and not in Latin_1. I tested
the function Ada.Strings.Maps.Is_In. It returns that the Euro_Sign is in
the Latin_1 character set. What have I done wrong?
My test program, which compiled and executed under GNAT 3.15p under
Windows XP, produced:
------------------------Starting Test-----------------------
Is_In_Character_Set is TRUE
------------------------Ending Test-----------------------
The test program is as follows:
---------------------------------------------------------
with Ada.Text_Io;
with Ada.Io_Exceptions;
with Ada.Exceptions;
with Ada.Strings;
with Ada.Strings.Maps;
with Ada.Characters.Latin_1;
with Ada.Characters.Latin_9;
procedure Char_Sets_Test is
------------------Table of Contents-------------
package T_Io renames Ada.Text_Io;
package Str_Maps renames Ada.Strings.Maps;
package Latin_1 renames Ada.Characters.Latin_1;
package Latin_9 renames Ada.Characters.Latin_9;
subtype Character_Set_Type is Str_Maps.Character_Set;
-----------------End Table of Contents-------------
Latin_1_Range : constant Str_Maps.Character_Range
:= (Low => Latin_1.Nul, High => Latin_1.Lc_Y_Diaeresis);
Latin_1_Char_Set : Character_Set_Type :=
Str_Maps.To_Set (Span => Latin_1_Range);
--Standard for Ada '95
Is_In_Character_Set : Boolean := False;
---------------------------------------------
begin--Bd_W_Char_Sets_Test
T_Io.Put_Line("-----------------------Starting
Test--------------------);
---------------------------------------------
--Test Character_Sets
Is_In_Character_Set:=Ada.Strings.Maps.Is_In (
Element => Latin_9.Euro_Sign,
Set => Latin_1_Char_Set);
T_Io.Put_Line("Is_In_Character_Set is " & Boolean'Image
(Is_In_Character_Set));
---------------------------------------------
---------------------------------------------
T_Io.Put_Line("-----------------------Ending
Test----------------------);
exception
when A: Ada.Io_Exceptions.Status_Error =>
T_io.Put_Line("Status_Error in Char_Sets_Test.");
T_Io.Put_Line(Ada.Exceptions.Exception_Information(A));
when O: others =>
T_Io.Put_Line("Others_Error in Char_Sets_Test.");
T_Io.Put_Line(Ada.Exceptions.Exception_Information(O));
end Char_Sets_Test;
next reply other threads:[~2002-11-26 21:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-26 21:41 Robert C. Leif [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-11-27 9:00 Character Sets Grein, Christoph
2002-11-28 17:53 Robert C. Leif
2002-11-29 12:28 ` Georg Bauhaus
2002-12-02 18:28 ` Stephen Leake
2002-12-03 2:45 ` Robert C. Leif
2002-12-03 13:33 ` Robert A Duff
2002-12-03 15:32 ` Juanma Barranquero
2002-12-04 0:49 ` Robert C. Leif
2002-12-14 3:27 ` David Starner
2002-12-14 22:53 ` Vadim Godunko
2002-12-15 3:46 ` David Starner
2002-12-15 23:26 ` Robert C. Leif
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox