1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 ------------------------------------------------------------------------------
36 pragma Elaborate_Body (Csets);
38 -- This package contains character tables for the various character
39 -- sets that are supported for source representation. Character and
40 -- string literals are not affected, only identifiers. For each set,
41 -- the table in this package gives the mapping of letters to their
42 -- upper case equivalent. Each table thus provides the information
43 -- for building the table used to fold lower case to upper case, and
44 -- also the table of flags showing which characters are allowed in
47 type Translate_Table is array (Character) of Character;
48 -- Type used to describe translate tables
50 type Char_Array_Flags is array (Character) of Boolean;
51 -- Type used for character attribute arrays. Note that we deliberately
52 -- do NOT pack this table, since we don't want the extra overhead of
53 -- accessing a packed bit string.
55 -----------------------------------------------
56 -- Character Tables For Current Compilation --
57 -----------------------------------------------
60 -- Routine to initialize following character tables, whose content depends
61 -- on the character code being used to represent the source program. In
62 -- particular, the use of the upper half of the 8-bit code set varies.
63 -- The character set in use is specified by the value stored in
64 -- Opt.Identifier_Character_Set, which has the following settings:
66 -- '1' Latin-1 (ISO-8859-1)
67 -- '2' Latin-2 (ISO-8859-2)
68 -- '3' Latin-3 (ISO-8859-3)
69 -- '4' Latin-4 (ISO-8859-4)
70 -- '5' Latin-5 (ISO-8859-5, Cyrillic)
71 -- 'p' IBM PC (code page 437)
72 -- '8' IBM PC (code page 850)
73 -- '9' Latin-9 (ISO-9959-9)
74 -- 'f' Full upper set (all distinct)
75 -- 'n' No upper characters (Ada/83 rules)
76 -- 'w' Latin-1 plus wide characters also allowed
78 function Is_Upper_Case_Letter (C : Character) return Boolean;
79 pragma Inline (Is_Upper_Case_Letter);
80 -- Determine if character is upper case letter
82 function Is_Lower_Case_Letter (C : Character) return Boolean;
83 pragma Inline (Is_Lower_Case_Letter);
84 -- Determine if character is lower case letter
86 Fold_Upper : Translate_Table;
87 -- Table to fold lower case identifier letters to upper case
89 Fold_Lower : Translate_Table;
90 -- Table to fold upper case identifier letters to lower case
92 Identifier_Char : Char_Array_Flags;
93 -- This table has True entries for all characters that can legally appear
94 -- in identifiers, including digits, the underline character, all letters
95 -- including upper and lower case and extended letters (as controlled by
96 -- the setting of Opt.Identifier_Character_Set, left bracket for brackets
97 -- notation wide characters and also ESC if wide characters are permitted
98 -- in identifiers using escape sequences starting with ESC.