home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
gnat-2.06-src.tgz
/
tar.out
/
fsf
/
gnat
/
ada
/
s-imgwch.adb
< prev
next >
Wrap
Text File
|
1996-09-28
|
3KB
|
69 lines
-----------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . I M G _ W C H A R --
-- --
-- B o d y --
-- --
-- $Revision: 1.11 $ --
-- --
-- Copyright (c) 1992,1993,1994,1995 NYU, All Rights Reserved --
-- --
-- The GNAT library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU Library General Public License as published by --
-- the Free Software Foundation; either version 2, or (at your option) any --
-- later version. The GNAT library is distributed in the hope that it will --
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- Library General Public License for more details. You should have --
-- received a copy of the GNU Library General Public License along with --
-- the GNAT library; see the file COPYING.LIB. If not, write to the Free --
-- Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
with System.Img_Char; use System.Img_Char;
with System.WCh_Con; use System.WCh_Con;
with System.WCh_WtS; use System.Wch_WtS;
package body System.Img_WChar is
--------------------------
-- Image_Wide_Character --
--------------------------
function Image_Wide_Character
(V : Wide_Character;
EM : WC_Encoding_Method)
return String
is
Val : constant Natural := Wide_Character'Pos (V);
WS : Wide_String (1 .. 3);
begin
-- If in range of standard character, use standard character routine
if Val < 16#80#
or else (Val <= 16#FF#
and then (EM = WCEM_Hex or else EM = WCEM_None))
then
return Image_Character (Character'Val (Val));
-- Otherwise return an appropriate escape sequence (i.e. one matching
-- the convention implemented by Scn.Wide_Char). The easiest thing is
-- to build a wide string for the result, and then use the Wide_Value
-- function to build the resulting String.
else
WS (1) := ''';
WS (2) := V;
WS (3) := ''';
return Wide_String_To_String (WS, EM);
end if;
end Image_Wide_Character;
end System.Img_WChar;