public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bjorn_persson@sverige.nu
To: gcc-gnats@gcc.gnu.org
Subject: ada/10738: Ada library: Only English letters are converted in Enumeration_IO.
Date: Sun, 11 May 2003 02:56:00 -0000	[thread overview]
Message-ID: <20030511024722.8797.qmail@sources.redhat.com> (raw)

[-- 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:


                 reply	other threads:[~2003-05-11  2:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030511024722.8797.qmail@sources.redhat.com \
    --to=bjorn_persson@sverige.nu \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).