1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . W C H _ C O N --
9 -- Copyright (C) 2005-2009, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
34 package body System.WCh_Con is
36 ----------------------------
37 -- Get_WC_Encoding_Method --
38 ----------------------------
40 function Get_WC_Encoding_Method (C : Character) return WC_Encoding_Method is
42 for Method in WC_Encoding_Method loop
43 if C = WC_Encoding_Letters (Method) then
48 raise Constraint_Error;
49 end Get_WC_Encoding_Method;
51 function Get_WC_Encoding_Method (S : String) return WC_Encoding_Method is
55 elsif S = "upper" then
57 elsif S = "shift_jis" then
58 return WCEM_Shift_JIS;
63 elsif S = "brackets" then
66 raise Constraint_Error;
68 end Get_WC_Encoding_Method;
70 --------------------------
71 -- Is_Start_Of_Encoding --
72 --------------------------
74 function Is_Start_Of_Encoding
76 EM : WC_Encoding_Method) return Boolean
79 return (EM in WC_Upper_Half_Encoding_Method
80 and then Character'Pos (C) >= 16#80#)
81 or else (EM in WC_ESC_Encoding_Method and then C = ASCII.ESC);
82 end Is_Start_Of_Encoding;