1223695Sdfr------------------------------------------------------------------------------
2223695Sdfr--                                                                          --
3223695Sdfr--                         GNAT RUN-TIME COMPONENTS                         --
4223695Sdfr--                                                                          --
5223695Sdfr--                       S Y S T E M . W C H _ W T S                        --
6223695Sdfr--                                                                          --
7223695Sdfr--                                 S p e c                                  --
8223695Sdfr--                                                                          --
9223695Sdfr--          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
10223695Sdfr--                                                                          --
11223695Sdfr-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12223695Sdfr-- terms of the  GNU General Public License as published  by the Free Soft- --
13223695Sdfr-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14223695Sdfr-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15223695Sdfr-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16223695Sdfr-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
17223695Sdfr--                                                                          --
18223695Sdfr-- As a special exception under Section 7 of GPL version 3, you are granted --
19223695Sdfr-- additional permissions described in the GCC Runtime Library Exception,   --
20223695Sdfr-- version 3.1, as published by the Free Software Foundation.               --
21223695Sdfr--                                                                          --
22223695Sdfr-- You should have received a copy of the GNU General Public License and    --
23223695Sdfr-- a copy of the GCC Runtime Library Exception along with this program;     --
24223695Sdfr-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25223695Sdfr-- <http://www.gnu.org/licenses/>.                                          --
26223695Sdfr--                                                                          --
27223695Sdfr-- GNAT was originally developed  by the GNAT team at  New York University. --
28223695Sdfr-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29223695Sdfr--                                                                          --
30223695Sdfr------------------------------------------------------------------------------
31223695Sdfr
32223695Sdfr--  This package contains the routine used to convert wide strings and wide
33223695Sdfr--  wide strings to strings for use by wide and wide wide character attributes
34223695Sdfr--  (value, image etc.) and also by the numeric IO subpackages of
35223695Sdfr--  Ada.Text_IO.Wide_Text_IO and Ada.Text_IO.Wide_Wide_Text_IO.
36223695Sdfr
37223695Sdfrwith System.WCh_Con;
38223695Sdfr
39268932Sjhbpackage System.WCh_WtS is
40268932Sjhb   pragma Pure;
41268932Sjhb
42268932Sjhb   function Wide_String_To_String
43268932Sjhb     (S  : Wide_String;
44268932Sjhb      EM : System.WCh_Con.WC_Encoding_Method) return String;
45268932Sjhb   --  This routine simply takes its argument and converts it to a string,
46242935Sneel   --  using the internal compiler escape sequence convention (defined in
47239073Sae   --  package Widechar) to translate characters that are out of range
48268932Sjhb   --  of type String. In the context of the Wide_Value attribute, the
49268932Sjhb   --  argument is the original attribute argument, and the result is used
50241164Sae   --  in a call to the corresponding Value attribute function. If the method
51223695Sdfr   --  for encoding is a shift-in, shift-out convention, then it is assumed
52223695Sdfr   --  that normal (non-wide character) mode holds at the start and end of
53223695Sdfr   --  the result string. EM indicates the wide character encoding method.
54223695Sdfr   --  Note: in the WCEM_Brackets case, we only use the brackets encoding
55223695Sdfr   --  for characters greater than 16#FF#. The lowest index of the returned
56223695Sdfr   --  String is equal to S'First.
57223695Sdfr
58223695Sdfr   function Wide_Wide_String_To_String
59223695Sdfr     (S  : Wide_Wide_String;
60223695Sdfr      EM : System.WCh_Con.WC_Encoding_Method) return String;
61223695Sdfr   --  Same processing, except for Wide_Wide_String
62223695Sdfr
63223695Sdfrend System.WCh_WtS;
64223695Sdfr