diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2008-04-08 08:55:45 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2008-04-08 08:55:45 +0200 |
commit | 9147cc0be70d7bcee6ad47ed11834f71ff161e99 (patch) | |
tree | 851050a48accd468d77483acd2c44acaa2876cca /gcc/ada/s-stratt.adb | |
parent | 7f8b32d5413ad3e2b1a6f67f15a778c72d1c14f7 (diff) | |
download | gcc-9147cc0be70d7bcee6ad47ed11834f71ff161e99.tar.gz |
s-strxdr.adb, [...] (Block_IO_OK): New subprogram.
2008-04-08 Hristian Kirtchev <kirtchev@adacore.com>
* s-strxdr.adb, s-stratt.ads, s-stratt.adb (Block_IO_OK): New
subprogram.
Add new subtype S_WWC, unchecked conversion routines From_WWC and
To_WWC.
(I_WWC, O_WWC): New routines for input and output of
Wide_Wide_Character.
From-SVN: r134052
Diffstat (limited to 'gcc/ada/s-stratt.adb')
-rw-r--r-- | gcc/ada/s-stratt.adb | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/gcc/ada/s-stratt.adb b/gcc/ada/s-stratt.adb index ebfd22cf3e0..757fad6e173 100644 --- a/gcc/ada/s-stratt.adb +++ b/gcc/ada/s-stratt.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2008, 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- -- @@ -74,6 +74,7 @@ package body System.Stream_Attributes is subtype S_SU is SEA (1 .. (UST.Short_Unsigned'Size + SU - 1) / SU); subtype S_U is SEA (1 .. (UST.Unsigned'Size + SU - 1) / SU); subtype S_WC is SEA (1 .. (Wide_Character'Size + SU - 1) / SU); + subtype S_WWC is SEA (1 .. (Wide_Wide_Character'Size + SU - 1) / SU); -- Unchecked conversions from the elementary type to the stream type @@ -94,6 +95,7 @@ package body System.Stream_Attributes is function From_SU is new UC (UST.Short_Unsigned, S_SU); function From_U is new UC (UST.Unsigned, S_U); function From_WC is new UC (Wide_Character, S_WC); + function From_WWC is new UC (Wide_Wide_Character, S_WWC); -- Unchecked conversions from the stream type to elementary type @@ -114,6 +116,16 @@ package body System.Stream_Attributes is function To_SU is new UC (S_SU, UST.Short_Unsigned); function To_U is new UC (S_U, UST.Unsigned); function To_WC is new UC (S_WC, Wide_Character); + function To_WWC is new UC (S_WWC, Wide_Wide_Character); + + ----------------- + -- Block_IO_OK -- + ----------------- + + function Block_IO_OK return Boolean is + begin + return True; + end Block_IO_OK; ---------- -- I_AD -- @@ -461,6 +473,24 @@ package body System.Stream_Attributes is end if; end I_WC; + ----------- + -- I_WWC -- + ----------- + + function I_WWC (Stream : not null access RST) return Wide_Wide_Character is + T : S_WWC; + L : SEO; + + begin + Ada.Streams.Read (Stream.all, T, L); + + if L < T'Last then + raise Err; + else + return To_WWC (T); + end if; + end I_WWC; + ---------- -- W_AD -- ---------- @@ -665,4 +695,16 @@ package body System.Stream_Attributes is Ada.Streams.Write (Stream.all, T); end W_WC; + ----------- + -- W_WWC -- + ----------- + + procedure W_WWC + (Stream : not null access RST; Item : Wide_Wide_Character) + is + T : constant S_WWC := From_WWC (Item); + begin + Ada.Streams.Write (Stream.all, T); + end W_WWC; + end System.Stream_Attributes; |