public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* ada/10738: Ada library: Only English letters are converted in Enumeration_IO.
@ 2003-05-11  2:56 bjorn_persson
  0 siblings, 0 replies; only message in thread
From: bjorn_persson @ 2003-05-11  2:56 UTC (permalink / raw)
  To: gcc-gnats

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2451 bytes --]


>Number:         10738
>Category:       ada
>Synopsis:       Ada library: Only English letters are converted in Enumeration_IO.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 11 02:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     bjorn_persson@sverige.nu
>Release:        3.2.3 and earlier, also snapshot 3.3-20030508
>Organization:
>Environment:
Redhat 7.2, Pentium 3
>Description:
As a workaround for some unspecified problem, Ada.Text_IO.Enumeration_Aux contains its own To_Lower and To_Upper functions that replace those in Ada.Characters.Handling. The replacements only work for English letters, causing ugly output from Ada.Text_IO.Enumeration_IO.Put (and possibly also causing problems when reading enumeration literals).
>How-To-Repeat:
Compile and run this program. It should write in only lowercase letters, but writes the non-English letters in uppercase (characters 214 and 197 instead of 246 and 229).

   with Ada.Text_IO; use Ada.Text_IO;
   procedure Enum_Case_Test is
      type Swedish is (ombudsman, orientering, smörgåsbord);
       package Swedish_IO is new Ada.Text_IO.Enumeration_IO(Swedish);
   begin
      Swedish_IO.Put(Item => smörgåsbord, Set => Lower_Case);
      New_Line;
   end Enum_Case_Test;
>Fix:
The real fix is of course to eliminate the need for the workaround, but until then this patch should make the package follow the standard:

--- gcc-3.2.3/gcc/ada/a-tienau.adb.old	Sat May  4 05:27:28 2002
+++ gcc-3.2.3/gcc/ada/a-tienau.adb	Sun May 11 02:44:31 2003
@@ -281,7 +281,9 @@
 
    function To_Lower (C : Character) return Character is
    begin
-      if C in 'A' .. 'Z' then
+      if C in 'A' .. 'Z' or else
+         C in Character'Val (192) .. Character'Val (214) or else
+         C in Character'Val (216) .. Character'Val (222) then
          return Character'Val (Character'Pos (C) + 32);
       else
          return C;
@@ -290,7 +292,9 @@
 
    function To_Upper (C : Character) return Character is
    begin
-      if C in 'a' .. 'z' then
+      if C in 'a' .. 'z' or else
+         C in Character'Val (224) .. Character'Val (246) or else
+         C in Character'Val (248) .. Character'Val (254) then
          return Character'Val (Character'Pos (C) - 32);
       else
          return C;
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-11  2:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-11  2:56 ada/10738: Ada library: Only English letters are converted in Enumeration_IO bjorn_persson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).