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