OSDN Git Service

* gimplify.c (gimplify_type_sizes) [POINTER_TYPE, REFERENCE_TYPE]:
[pf3gnuchains/gcc-fork.git] / gcc / ada / stringt.adb
index 84817a9..0a5fbb2 100644 (file)
@@ -6,9 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                            $Revision$
---                                                                          --
---          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -18,8 +16,8 @@
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- As a special exception,  if other files  instantiate  generics from this --
 -- unit, or you link  this unit with other files  to produce an executable, --
@@ -29,7 +27,7 @@
 -- covered by the  GNU Public License.                                      --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -357,15 +355,19 @@ package body Stringt is
 
    procedure Write_Char_Code (Code : Char_Code) is
 
-      procedure Write_Hex_Byte (J : Natural);
-      --  Write single hex digit
+      procedure Write_Hex_Byte (J : Char_Code);
+      --  Write single hex byte (value in range 0 .. 255) as two digits
 
-      procedure Write_Hex_Byte (J : Natural) is
-         Hexd : String := "0123456789abcdef";
+      --------------------
+      -- Write_Hex_Byte --
+      --------------------
 
+      procedure Write_Hex_Byte (J : Char_Code) is
+         Hexd : constant array (Char_Code range 0 .. 15) of Character :=
+                  "0123456789abcdef";
       begin
-         Write_Char (Hexd (J / 16 + 1));
-         Write_Char (Hexd (J mod 16 + 1));
+         Write_Char (Hexd (J / 16));
+         Write_Char (Hexd (J mod 16));
       end Write_Hex_Byte;
 
    --  Start of processing for Write_Char_Code
@@ -378,11 +380,19 @@ package body Stringt is
          Write_Char ('[');
          Write_Char ('"');
 
+         if Code > 16#FF_FFFF# then
+            Write_Hex_Byte (Code / 2 ** 24);
+         end if;
+
+         if Code > 16#FFFF# then
+            Write_Hex_Byte ((Code / 2 ** 16) mod 256);
+         end if;
+
          if Code > 16#FF# then
-            Write_Hex_Byte (Natural (Code / 256));
+            Write_Hex_Byte ((Code / 256) mod 256);
          end if;
 
-         Write_Hex_Byte (Natural (Code mod 256));
+         Write_Hex_Byte (Code mod 256);
          Write_Char ('"');
          Write_Char (']');
       end if;