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-2010, 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 3,  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.                                     --
21--                                                                          --
22-- As a special exception under Section 7 of GPL version 3, you are granted --
23-- additional permissions described in the GCC Runtime Library Exception,   --
24-- version 3.1, as published by the Free Software Foundation.               --
25--                                                                          --
26-- You should have received a copy of the GNU General Public License and    --
27-- a copy of the GCC Runtime Library Exception along with this program;     --
28-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
29-- <http://www.gnu.org/licenses/>.                                          --
30--                                                                          --
31-- GNAT was originally developed  by the GNAT team at  New York University. --
32-- Extensive contributions were provided by Ada Core Technologies Inc.      --
33--                                                                          --
34------------------------------------------------------------------------------
35
36package Ada.Characters.Handling is
37   pragma Preelaborate;
38   pragma Pure_05;
39   --  In accordance with Ada 2005 AI-362
40
41   ----------------------------------------
42   -- Character Classification Functions --
43   ----------------------------------------
44
45   function Is_Control           (Item : Character) return Boolean;
46   function Is_Graphic           (Item : Character) return Boolean;
47   function Is_Letter            (Item : Character) return Boolean;
48   function Is_Lower             (Item : Character) return Boolean;
49   function Is_Upper             (Item : Character) return Boolean;
50   function Is_Basic             (Item : Character) return Boolean;
51   function Is_Digit             (Item : Character) return Boolean;
52   function Is_Decimal_Digit     (Item : Character) return Boolean
53     renames Is_Digit;
54   function Is_Hexadecimal_Digit (Item : Character) return Boolean;
55   function Is_Alphanumeric      (Item : Character) return Boolean;
56   function Is_Special           (Item : Character) return Boolean;
57
58   ---------------------------------------------------
59   -- Conversion Functions for Character and String --
60   ---------------------------------------------------
61
62   function To_Lower (Item : Character) return Character;
63   function To_Upper (Item : Character) return Character;
64   function To_Basic (Item : Character) return Character;
65
66   function To_Lower (Item : String) return String;
67   function To_Upper (Item : String) return String;
68   function To_Basic (Item : String) return String;
69
70   ----------------------------------------------------------------------
71   -- Classifications of and Conversions Between Character and ISO 646 --
72   ----------------------------------------------------------------------
73
74   subtype ISO_646 is
75     Character range Character'Val (0) .. Character'Val (127);
76
77   function Is_ISO_646 (Item : Character) return Boolean;
78   function Is_ISO_646 (Item : String)    return Boolean;
79
80   function To_ISO_646
81     (Item       : Character;
82      Substitute : ISO_646 := ' ') return ISO_646;
83
84   function To_ISO_646
85     (Item       : String;
86      Substitute : ISO_646 := ' ') return String;
87
88   ------------------------------------------------------
89   -- Classifications of Wide_Character and Characters --
90   ------------------------------------------------------
91
92   --  Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions
93   --  and are considered obsolete in Ada.Characters.Handling. However we do
94   --  not complain about this obsolescence, since in practice it is necessary
95   --  to use these routines when creating code that is intended to run in
96   --  either Ada 95 or Ada 2005 mode.
97
98   --  We do however have to flag these if the pragma No_Obsolescent_Features
99   --  restriction is active (see Restrict.Check_Obsolescent_2005_Entity).
100
101   function Is_Character (Item : Wide_Character) return Boolean;
102   function Is_String    (Item : Wide_String)    return Boolean;
103
104   ------------------------------------------------------
105   -- Conversions between Wide_Character and Character --
106   ------------------------------------------------------
107
108   --  Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions
109   --  and are considered obsolete in Ada.Characters.Handling. However we do
110   --  not complain about this obsolescence, since in practice it is necessary
111   --  to use these routines when creating code that is intended to run in
112   --  either Ada 95 or Ada 2005 mode.
113
114   --  We do however have to flag these if the pragma No_Obsolescent_Features
115   --  restriction is active (see Restrict.Check_Obsolescent_2005_Entity).
116
117   function To_Character
118     (Item       : Wide_Character;
119      Substitute : Character := ' ') return Character;
120
121   function To_String
122     (Item       : Wide_String;
123      Substitute : Character := ' ') return String;
124
125   function To_Wide_Character
126     (Item : Character) return Wide_Character;
127
128   function To_Wide_String
129     (Item : String) return Wide_String;
130
131private
132   pragma Inline (Is_Control);
133   pragma Inline (Is_Graphic);
134   pragma Inline (Is_Letter);
135   pragma Inline (Is_Lower);
136   pragma Inline (Is_Upper);
137   pragma Inline (Is_Basic);
138   pragma Inline (Is_Digit);
139   pragma Inline (Is_Hexadecimal_Digit);
140   pragma Inline (Is_Alphanumeric);
141   pragma Inline (Is_Special);
142   pragma Inline (To_Lower);
143   pragma Inline (To_Upper);
144   pragma Inline (To_Basic);
145   pragma Inline (Is_ISO_646);
146   pragma Inline (Is_Character);
147   pragma Inline (To_Character);
148   pragma Inline (To_Wide_Character);
149
150end Ada.Characters.Handling;
151