aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/lib-util.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2010-06-14 13:01:07 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-14 15:01:07 +0200
commit7eaa7cdf7da806ba900237e34eb11fd580039da3 (patch)
tree098473a5e47938dcfa8b53ff687d42c7e5548626 /gcc/ada/lib-util.adb
parent3a13e78582d1be59cd9e5ecb24f8f1c355261648 (diff)
downloadgcc-7eaa7cdf7da806ba900237e34eb11fd580039da3.zip
gcc-7eaa7cdf7da806ba900237e34eb11fd580039da3.tar.gz
gcc-7eaa7cdf7da806ba900237e34eb11fd580039da3.tar.bz2
ali.adb (Scan_ALI): Implement reading and storing of N lines
2010-06-14 Robert Dewar <dewar@adacore.com> * ali.adb (Scan_ALI): Implement reading and storing of N lines (Known_ALI_Lines): Add entry for 'N' (notes) * ali.ads (Notes): New table to store Notes information * alloc.ads: Add entries for Notes table * lib-util.adb (Write_Info_Int): New procedure (Write_Info_Slit): New procedure (Write_Info_Uint): New procedure * lib-util.ads (Write_Info_Int): New procedure (Write_Info_Slit): New procedure (Write_Info_Uint): New procedure * lib-writ.adb (Write_Unit_Information): Output N (notes) lines * lib-writ.ads: Update documentation for N (Notes) lines * lib.adb (Store_Note): New procedure * lib.ads (Notes): New table (Store_Note): New procedure * sem_prag.adb: Call Store_Note for affected pragmas From-SVN: r160736
Diffstat (limited to 'gcc/ada/lib-util.adb')
-rw-r--r--gcc/ada/lib-util.adb72
1 files changed, 69 insertions, 3 deletions
diff --git a/gcc/ada/lib-util.adb b/gcc/ada/lib-util.adb
index 77b0efc..e6af023 100644
--- a/gcc/ada/lib-util.adb
+++ b/gcc/ada/lib-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, 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- --
@@ -25,6 +25,7 @@
with Hostparm;
with Osint.C; use Osint.C;
+with Stringt; use Stringt;
package body Lib.Util is
@@ -39,7 +40,7 @@ package body Lib.Util is
Info_Buffer_Col : Natural := 1;
-- Column number of next character to be written.
- -- Can be different from Info_Buffer_Len + 1
+ -- Can be different from Info_Buffer_Len + 1.
-- because of tab characters written by Write_Info_Tab.
---------------------
@@ -133,6 +134,23 @@ package body Lib.Util is
procedure Write_Info_Initiate (Key : Character) renames Write_Info_Char;
+ --------------------
+ -- Write_Info_Int --
+ --------------------
+
+ procedure Write_Info_Int (N : Int) is
+ begin
+ if N >= 0 then
+ Write_Info_Nat (N);
+
+ -- Negative numbers, use Write_Info_Uint to avoid problems with largest
+ -- negative number.
+
+ else
+ Write_Info_Uint (UI_From_Int (N));
+ end if;
+ end Write_Info_Int;
+
---------------------
-- Write_Info_Name --
---------------------
@@ -169,6 +187,45 @@ package body Lib.Util is
Write_Info_Char (Character'Val (N mod 10 + Character'Pos ('0')));
end Write_Info_Nat;
+ ---------------------
+ -- Write_Info_Slit --
+ ---------------------
+
+ procedure Write_Info_Slit (S : String_Id) is
+ C : Character;
+
+ begin
+ Write_Info_Str ("""");
+
+ for J in 1 .. String_Length (S) loop
+ C := Get_Character (Get_String_Char (S, J));
+
+ if C in Character'Val (16#20#) .. Character'Val (16#7E#)
+ and then C /= '{'
+ then
+ Write_Info_Char (C);
+
+ if C = '"' then
+ Write_Info_Char (C);
+ end if;
+
+ else
+ declare
+ Hex : constant array (0 .. 15) of Character :=
+ "0123456789ABCDEF";
+
+ begin
+ Write_Info_Char ('{');
+ Write_Info_Char (Hex (Character'Pos (C) / 16));
+ Write_Info_Char (Hex (Character'Pos (C) mod 16));
+ Write_Info_Char ('}');
+ end;
+ end if;
+ end loop;
+
+ Write_Info_Char ('"');
+ end Write_Info_Slit;
+
--------------------
-- Write_Info_Str --
--------------------
@@ -225,7 +282,16 @@ package body Lib.Util is
Info_Buffer_Len := 0;
Info_Buffer_Col := 1;
-
end Write_Info_Terminate;
+ ---------------------
+ -- Write_Info_Uint --
+ ---------------------
+
+ procedure Write_Info_Uint (N : Uint) is
+ begin
+ UI_Image (N, Decimal);
+ Write_Info_Str (UI_Image_Buffer (1 .. UI_Image_Length));
+ end Write_Info_Uint;
+
end Lib.Util;