OSDN Git Service

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