OSDN Git Service

2006-10-31 Ed Schonberg <schonberg@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-chahan.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --              A D A . C H A R A C T E R S . H A N D L I N G               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the  contents of the part following the private keyword. --
14 --                                                                          --
15 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
16 -- terms of the  GNU General Public License as published  by the Free Soft- --
17 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
18 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
21 -- for  more details.  You should have  received  a copy of the GNU General --
22 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
23 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
24 -- Boston, MA 02110-1301, USA.                                              --
25 --                                                                          --
26 -- As a special exception,  if other files  instantiate  generics from this --
27 -- unit, or you link  this unit with other files  to produce an executable, --
28 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
29 -- covered  by the  GNU  General  Public  License.  This exception does not --
30 -- however invalidate  any other reasons why  the executable file  might be --
31 -- covered by the  GNU Public License.                                      --
32 --                                                                          --
33 -- GNAT was originally developed  by the GNAT team at  New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
35 --                                                                          --
36 ------------------------------------------------------------------------------
37
38 package Ada.Characters.Handling is
39    pragma Preelaborate;
40    pragma Pure_05;
41    --  In accordance with Ada 2005 AI-362
42
43    ----------------------------------------
44    -- Character Classification Functions --
45    ----------------------------------------
46
47    function Is_Control           (Item : Character) return Boolean;
48    function Is_Graphic           (Item : Character) return Boolean;
49    function Is_Letter            (Item : Character) return Boolean;
50    function Is_Lower             (Item : Character) return Boolean;
51    function Is_Upper             (Item : Character) return Boolean;
52    function Is_Basic             (Item : Character) return Boolean;
53    function Is_Digit             (Item : Character) return Boolean;
54    function Is_Decimal_Digit     (Item : Character) return Boolean
55      renames Is_Digit;
56    function Is_Hexadecimal_Digit (Item : Character) return Boolean;
57    function Is_Alphanumeric      (Item : Character) return Boolean;
58    function Is_Special           (Item : Character) return Boolean;
59
60    ---------------------------------------------------
61    -- Conversion Functions for Character and String --
62    ---------------------------------------------------
63
64    function To_Lower (Item : Character) return Character;
65    function To_Upper (Item : Character) return Character;
66    function To_Basic (Item : Character) return Character;
67
68    function To_Lower (Item : String) return String;
69    function To_Upper (Item : String) return String;
70    function To_Basic (Item : String) return String;
71
72    ----------------------------------------------------------------------
73    -- Classifications of and Conversions Between Character and ISO 646 --
74    ----------------------------------------------------------------------
75
76    subtype ISO_646 is
77      Character range Character'Val (0) .. Character'Val (127);
78
79    function Is_ISO_646 (Item : Character) return Boolean;
80    function Is_ISO_646 (Item : String)    return Boolean;
81
82    function To_ISO_646
83      (Item       : Character;
84       Substitute : ISO_646 := ' ') return ISO_646;
85
86    function To_ISO_646
87      (Item       : String;
88       Substitute : ISO_646 := ' ') return String;
89
90    ------------------------------------------------------
91    -- Classifications of Wide_Character and Characters --
92    ------------------------------------------------------
93
94    --  Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions
95    --  and are considered obsolete in Ada.Characters.Handling. We deal with
96    --  this by using the special Ada_05 form of pragma Obsolescent which is
97    --  only active in Ada_05 mode.
98
99    function Is_Character (Item : Wide_Character) return Boolean;
100    pragma Obsolescent
101      ("(Ada 2005) use Ada.Characters.Conversions.Is_Character", Ada_05);
102
103    function Is_String (Item : Wide_String) return Boolean;
104    pragma Obsolescent
105      ("(Ada 2005) use Ada.Characters.Conversions.Is_String", Ada_05);
106
107    ------------------------------------------------------
108    -- Conversions between Wide_Character and Character --
109    ------------------------------------------------------
110
111    --  Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions
112    --  and are considered obsolete in Ada.Characters.Handling. We deal with
113    --  this by using the special Ada_05 form of pragma Obsolescent which is
114    --  only active in Ada_05 mode.
115
116    function To_Character
117      (Item       : Wide_Character;
118       Substitute : Character := ' ') return Character;
119    pragma Obsolescent
120      ("(Ada 2005) use Ada.Characters.Conversions.To_Character", Ada_05);
121
122    function To_String
123      (Item       : Wide_String;
124       Substitute : Character := ' ') return String;
125    pragma Obsolescent
126      ("(Ada 2005) use Ada.Characters.Conversions.To_String", Ada_05);
127
128    function To_Wide_Character
129      (Item : Character) return Wide_Character;
130    pragma Obsolescent
131      ("(Ada 2005) use Ada.Characters.Conversions.To_Wide_Character", Ada_05);
132
133    function To_Wide_String
134      (Item : String)return Wide_String;
135    pragma Obsolescent
136      ("(Ada 2005) use Ada.Characters.Conversions.To_Wide_String", Ada_05);
137
138 private
139    pragma Inline (Is_Control);
140    pragma Inline (Is_Graphic);
141    pragma Inline (Is_Letter);
142    pragma Inline (Is_Lower);
143    pragma Inline (Is_Upper);
144    pragma Inline (Is_Basic);
145    pragma Inline (Is_Digit);
146    pragma Inline (Is_Hexadecimal_Digit);
147    pragma Inline (Is_Alphanumeric);
148    pragma Inline (Is_Special);
149    pragma Inline (To_Lower);
150    pragma Inline (To_Upper);
151    pragma Inline (To_Basic);
152    pragma Inline (Is_ISO_646);
153    pragma Inline (Is_Character);
154    pragma Inline (To_Character);
155    pragma Inline (To_Wide_Character);
156
157 end Ada.Characters.Handling;