diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-06-27 12:43:32 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-21 03:22:51 -0400 |
commit | 38aca14a437d9adefe9d7f526aafa53a8e868749 (patch) | |
tree | c9c6289088cb9c4ef4ff485a3fcaa9c2af0733f3 /gcc/ada/libgnat/a-wtinio.adb | |
parent | 4cd2e6f249e55c810c0414572807face97d88f07 (diff) | |
download | gcc-38aca14a437d9adefe9d7f526aafa53a8e868749.zip gcc-38aca14a437d9adefe9d7f526aafa53a8e868749.tar.gz gcc-38aca14a437d9adefe9d7f526aafa53a8e868749.tar.bz2 |
[Ada] Support of the Ada.Text_IO hierarchy for 128-bit types
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add a-llltio, a-lllwti,
a-lllzti and remove a-timoau, a-wtmoau and a-ztmoau.
(GNATRTL_128BIT_PAIRS): Add a-tiinio.adb, a-timoio.adb, a-wtinio.adb,
a-wtmoio.adb, a-ztinio.adb and a-ztmoio.adb.
* impunit.adb (Non_Imp_File_Names_95): Add a-llltio, a-lllwti and
a-lllzti.
* krunch.ads: Document trick for Ada.Long_Long_Long_Integer_*_IO.
* krunch.adb (Krunch): Add trick for Ada.Long_Long_Long_Integer_*_IO.
* libgnat/a-llltio.ads: Instantiate Ada.Text_IO.Integer_IO.
* libgnat/a-lllwti.ads: Instantiate Ada.Wide_Text_IO.Integer_IO.
* libgnat/a-lllzti.ads: Instantiate Ada.Wide_Wide_Text_IO.Integer_IO.
* libgnat/a-tigeau.ads (Load_Integer): New procedure.
* libgnat/a-tigeau.adb (Load_Integer): Likewise.
* libgnat/a-tiinau.ads, libgnat/a-tiinau.adb: Change to generic
package.
* libgnat/a-tiinio.adb: Instantiate it.
* libgnat/a-tiinio__128.adb: Likewise.
* libgnat/a-timoau.ads, libgnat/a-timoau.adb: Change to generic
package.
* libgnat/a-timoio.adb: Instantiate it.
* libgnat/a-timoio__128.adb: Likewise.
* libgnat/a-wtgeau.ads (Load_Integer): New procedure.
* libgnat/a-wtgeau.adb (Load_Integer): Likewise.
* libgnat/a-wtinau.ads, libgnat/a-wtinau.adb: Change to generic
package.
* libgnat/a-wtinio.adb: Instantiate it.
* libgnat/a-wtinio__128.adb: Likewise.
* libgnat/a-wtmoau.ads, libgnat/a-wtmoau.adb: Change to generic
package.
* libgnat/a-wtmoio.adb: Instantiate it.
* libgnat/a-wtmoio__128.adb: Likewise.
* libgnat/a-ztgeau.ads (Load_Integer): New procedure.
* libgnat/a-ztgeau.adb (Load_Integer): Likewise.
* libgnat/a-ztinau.ads, libgnat/a-ztinau.adb: Change to generic
package.
* libgnat/a-ztinio.adb: Instantiate it.
* libgnat/a-ztinio__128.adb: Likewise.
* libgnat/a-ztmoau.ads, libgnat/a-ztmoau.adb: Change to generic
package.
* libgnat/a-ztmoio.adb: Instantiate it.
* libgnat/a-ztmoio__128.adb: Likewise.
Diffstat (limited to 'gcc/ada/libgnat/a-wtinio.adb')
-rw-r--r-- | gcc/ada/libgnat/a-wtinio.adb | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/gcc/ada/libgnat/a-wtinio.adb b/gcc/ada/libgnat/a-wtinio.adb index bc03227..a3f666e 100644 --- a/gcc/ada/libgnat/a-wtinio.adb +++ b/gcc/ada/libgnat/a-wtinio.adb @@ -30,11 +30,35 @@ ------------------------------------------------------------------------------ with Ada.Wide_Text_IO.Integer_Aux; +with System.Img_BIU; use System.Img_BIU; +with System.Img_Int; use System.Img_Int; +with System.Img_LLB; use System.Img_LLB; +with System.Img_LLI; use System.Img_LLI; +with System.Img_LLW; use System.Img_LLW; +with System.Img_WIU; use System.Img_WIU; +with System.Val_Int; use System.Val_Int; +with System.Val_LLI; use System.Val_LLI; with System.WCh_Con; use System.WCh_Con; with System.WCh_WtS; use System.WCh_WtS; package body Ada.Wide_Text_IO.Integer_IO is + package Aux_Int is new + Ada.Wide_Text_IO.Integer_Aux + (Integer, + Scan_Integer, + Set_Image_Integer, + Set_Image_Width_Integer, + Set_Image_Based_Integer); + + package Aux_LLI is new + Ada.Wide_Text_IO.Integer_Aux + (Long_Long_Integer, + Scan_Long_Long_Integer, + Set_Image_Long_Long_Integer, + Set_Image_Width_Long_Long_Integer, + Set_Image_Based_Long_Long_Integer); + Need_LLI : constant Boolean := Num'Base'Size > Integer'Size; -- Throughout this generic body, we distinguish between the case where type -- Integer is acceptable, and where a Long_Long_Integer is needed. This @@ -44,8 +68,6 @@ package body Ada.Wide_Text_IO.Integer_IO is subtype TFT is Ada.Wide_Text_IO.File_Type; -- File type required for calls to routines in Aux - package Aux renames Ada.Wide_Text_IO.Integer_Aux; - --------- -- Get -- --------- @@ -55,11 +77,16 @@ package body Ada.Wide_Text_IO.Integer_IO is Item : out Num; Width : Field := 0) is + -- We depend on a range check to get Data_Error + + pragma Unsuppress (Range_Check); + pragma Unsuppress (Overflow_Check); + begin if Need_LLI then - Aux.Get_LLI (TFT (File), Long_Long_Integer (Item), Width); + Aux_LLI.Get (TFT (File), Long_Long_Integer (Item), Width); else - Aux.Get_Int (TFT (File), Integer (Item), Width); + Aux_Int.Get (TFT (File), Integer (Item), Width); end if; exception @@ -79,6 +106,11 @@ package body Ada.Wide_Text_IO.Integer_IO is Item : out Num; Last : out Positive) is + -- We depend on a range check to get Data_Error + + pragma Unsuppress (Range_Check); + pragma Unsuppress (Overflow_Check); + S : constant String := Wide_String_To_String (From, WCEM_Upper); -- String on which we do the actual conversion. Note that the method -- used for wide character encoding is irrelevant, since if there is @@ -87,9 +119,9 @@ package body Ada.Wide_Text_IO.Integer_IO is begin if Need_LLI then - Aux.Gets_LLI (S, Long_Long_Integer (Item), Last); + Aux_LLI.Gets (S, Long_Long_Integer (Item), Last); else - Aux.Gets_Int (S, Integer (Item), Last); + Aux_Int.Gets (S, Integer (Item), Last); end if; exception @@ -108,9 +140,9 @@ package body Ada.Wide_Text_IO.Integer_IO is is begin if Need_LLI then - Aux.Put_LLI (TFT (File), Long_Long_Integer (Item), Width, Base); + Aux_LLI.Put (TFT (File), Long_Long_Integer (Item), Width, Base); else - Aux.Put_Int (TFT (File), Integer (Item), Width, Base); + Aux_Int.Put (TFT (File), Integer (Item), Width, Base); end if; end Put; @@ -132,9 +164,9 @@ package body Ada.Wide_Text_IO.Integer_IO is begin if Need_LLI then - Aux.Puts_LLI (S, Long_Long_Integer (Item), Base); + Aux_LLI.Puts (S, Long_Long_Integer (Item), Base); else - Aux.Puts_Int (S, Integer (Item), Base); + Aux_Int.Puts (S, Integer (Item), Base); end if; for J in S'Range loop |