OSDN Git Service

2007-04-20 Vincent Celier <celier@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / csets.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                                C S E T S                                 --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
10 --                                                                          --
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 2,  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.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 package Csets is
35    pragma Elaborate_Body;
36
37    --  This package contains character tables for the various character
38    --  sets that are supported for source representation. Character and
39    --  string literals are not affected, only identifiers. For each set,
40    --  the table in this package gives the mapping of letters to their
41    --  upper case equivalent. Each table thus provides the information
42    --  for building the table used to fold lower case to upper case, and
43    --  also the table of flags showing which characters are allowed in
44    --  identifiers.
45
46    type Translate_Table is array (Character) of Character;
47    --  Type used to describe translate tables
48
49    type Char_Array_Flags is array (Character) of Boolean;
50    --  Type used for character attribute arrays. Note that we deliberately
51    --  do NOT pack this table, since we don't want the extra overhead of
52    --  accessing a packed bit string.
53
54    ----------------------------------------------
55    -- Character Tables For Current Compilation --
56    ----------------------------------------------
57
58    procedure Initialize;
59    --  Routine to initialize following character tables, whose content depends
60    --  on the character code being used to represent the source program. In
61    --  particular, the use of the upper half of the 8-bit code set varies.
62    --  The character set in use is specified by the value stored in
63    --  Opt.Identifier_Character_Set, which has the following settings:
64
65    --    '1'  Latin-1 (ISO-8859-1)
66    --    '2'  Latin-2 (ISO-8859-2)
67    --    '3'  Latin-3 (ISO-8859-3)
68    --    '4'  Latin-4 (ISO-8859-4)
69    --    '5'  Latin-5 (ISO-8859-5, Cyrillic)
70    --    'p'  IBM PC  (code page 437)
71    --    '8'  IBM PC  (code page 850)
72    --    '9'  Latin-9 (ISO-9959-9)
73    --    'f'  Full upper set (all distinct)
74    --    'n'  No upper characters (Ada/83 rules)
75    --    'w'  Latin-1 plus wide characters also allowed
76
77    function Is_Upper_Case_Letter (C : Character) return Boolean;
78    pragma Inline (Is_Upper_Case_Letter);
79    --  Determine if character is upper case letter
80
81    function Is_Lower_Case_Letter (C : Character) return Boolean;
82    pragma Inline (Is_Lower_Case_Letter);
83    --  Determine if character is lower case letter
84
85    Fold_Upper : Translate_Table;
86    --  Table to fold lower case identifier letters to upper case
87
88    Fold_Lower : Translate_Table;
89    --  Table to fold upper case identifier letters to lower case
90
91    Identifier_Char : Char_Array_Flags;
92    --  This table has True entries for all characters that can legally appear
93    --  in identifiers, including digits, the underline character, all letters
94    --  including upper and lower case and extended letters (as controlled by
95    --  the setting of Opt.Identifier_Character_Set, left bracket for brackets
96    --  notation wide characters and also ESC if wide characters are permitted
97    --  in identifiers using escape sequences starting with ESC.
98
99 end Csets;