aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-wchcnv.ads
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/s-wchcnv.ads')
-rw-r--r--gcc/ada/s-wchcnv.ads37
1 files changed, 28 insertions, 9 deletions
diff --git a/gcc/ada/s-wchcnv.ads b/gcc/ada/s-wchcnv.ads
index 65180ca2a57..e0bde89604a 100644
--- a/gcc/ada/s-wchcnv.ads
+++ b/gcc/ada/s-wchcnv.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 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- --
@@ -31,24 +31,23 @@
-- --
------------------------------------------------------------------------------
--- This package contains generic subprograms used for converting between
--- sequences of Character and Wide_Character. All access to wide character
--- sequences is isolated in this unit.
-
-- This unit may be used directly from an application program by providing
-- an appropriate WITH, and the interface can be expected to remain stable.
with System.WCh_Con;
package System.WCh_Cnv is
-pragma Pure (WCh_Cnv);
+ pragma Pure (WCh_Cnv);
+
+ type UTF_32_Code is range 0 .. 16#7FFF_FFFF#;
+ for UTF_32_Code'Size use 32;
+ -- Range of allowed UTF-32 encoding values
generic
with function In_Char return Character;
function Char_Sequence_To_Wide_Char
- (C : Character;
- EM : System.WCh_Con.WC_Encoding_Method)
- return Wide_Character;
+ (C : Character;
+ EM : System.WCh_Con.WC_Encoding_Method) return Wide_Character;
-- C is the first character of a sequence of one or more characters which
-- represent a wide character sequence. Calling the function In_Char for
-- additional characters as required, Char_To_Wide_Char returns the
@@ -57,6 +56,16 @@ pragma Pure (WCh_Cnv);
-- sequence for the given encoding method.
generic
+ with function In_Char return Character;
+ function Char_Sequence_To_UTF_32
+ (C : Character;
+ EM : System.WCh_Con.WC_Encoding_Method) return UTF_32_Code;
+ -- This is similar to the above, but the function returns a code from
+ -- the full UTF_32 code set, which covers the full range of possible
+ -- values in Wide_Wide_Character. The result can be converted to
+ -- Wide_Wide_Character form using Wide_Wide_Character'Val.
+
+ generic
with procedure Out_Char (C : Character);
procedure Wide_Char_To_Char_Sequence
(WC : Wide_Character;
@@ -66,4 +75,14 @@ pragma Pure (WCh_Cnv);
-- Constraint_Error is raised if the given wide character value is
-- not a valid value for the given encoding method.
+ generic
+ with procedure Out_Char (C : Character);
+ procedure UTF_32_To_Char_Sequence
+ (Val : UTF_32_Code;
+ EM : System.WCh_Con.WC_Encoding_Method);
+ -- This is similar to the above, but the input value is a code from the
+ -- full UTF_32 code set, which covers the full range of possible values
+ -- in Wide_Wide_Character. To convert a Wide_Wide_Character value, the
+ -- caller can use Wide_Wide_Character'Pos in the call.
+
end System.WCh_Cnv;