OSDN Git Service

2007-04-20 Vincent Celier <celier@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-2007, 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. However we do
96    --  not complain about this obsolescence, since in practice it is necessary
97    --  to use these routines when creating code that is intended ro run in
98    --  either Ada 95 or Ada 2005 mode.
99
100    function Is_Character (Item : Wide_Character) return Boolean;
101    function Is_String    (Item : Wide_String)    return Boolean;
102
103    ------------------------------------------------------
104    -- Conversions between Wide_Character and Character --
105    ------------------------------------------------------
106
107    --  Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions
108    --  and are considered obsolete in Ada.Characters.Handling. However we do
109    --  not complain about this obsolescence, since in practice it is necessary
110    --  to use these routines when creating code that is intended ro run in
111    --  either Ada 95 or Ada 2005 mode.
112
113    function To_Character
114      (Item       : Wide_Character;
115       Substitute : Character := ' ') return Character;
116
117    function To_String
118      (Item       : Wide_String;
119       Substitute : Character := ' ') return String;
120
121    function To_Wide_Character
122      (Item : Character) return Wide_Character;
123
124    function To_Wide_String
125      (Item : String) return Wide_String;
126
127 private
128    pragma Inline (Is_Control);
129    pragma Inline (Is_Graphic);
130    pragma Inline (Is_Letter);
131    pragma Inline (Is_Lower);
132    pragma Inline (Is_Upper);
133    pragma Inline (Is_Basic);
134    pragma Inline (Is_Digit);
135    pragma Inline (Is_Hexadecimal_Digit);
136    pragma Inline (Is_Alphanumeric);
137    pragma Inline (Is_Special);
138    pragma Inline (To_Lower);
139    pragma Inline (To_Upper);
140    pragma Inline (To_Basic);
141    pragma Inline (Is_ISO_646);
142    pragma Inline (Is_Character);
143    pragma Inline (To_Character);
144    pragma Inline (To_Wide_Character);
145
146 end Ada.Characters.Handling;