Imported GNU Classpath 0.90
[official-gcc.git] / gcc / ada / exp_imgv.ads
blob54d4528d3d25caa1a6461a0e357a0023efd1cf05
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- E X P _ I M G V --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2000-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 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- Expand routines for Image, Value and Width attributes. These are the
28 -- attributes that make use of enumeration type image tables.
30 with Types; use Types;
32 package Exp_Imgv is
34 procedure Build_Enumeration_Image_Tables (E : Entity_Id; N : Node_Id);
35 -- Build the enumeration image tables for E, which is an enumeration
36 -- base type. The node N is the point in the tree where the resulting
37 -- declarations are to be inserted.
39 -- The form of the tables generated is as follows:
41 -- xxxS : string := "chars";
42 -- xxxI : array (0 .. N) of Natural_8/16/32 := (1, n, .., n);
44 -- Here xxxS is a string obtained by concatenating all the names
45 -- of the enumeration literals in sequence, representing any wide
46 -- characters according to the current wide character encoding
47 -- method, and with all letters forced to upper case.
49 -- The array xxxI is an array of ones origin indexes to the start
50 -- of each name, with one extra entry at the end, which is the index
51 -- to the character just past the end of the last literal, i.e. it is
52 -- the length of xxxS + 1. The element type is the shortest of the
53 -- possible types that will hold all the values.
55 -- For example, for the type
57 -- type x is (hello,'!',goodbye);
59 -- the generated tables would consist of
61 -- xxxS : String := "hello'!'goodbye";
62 -- xxxI : array (0 .. 3) of Natural_8 := (1, 6, 9, 16);
64 -- Here Natural_8 is used since 16 < 2**(8-1)
66 -- If the entity E needs the tables constructing, the necessary
67 -- declarations are constructed, and the fields Lit_Strings and
68 -- Lit_Indexes of E are set to point to the corresponding entities.
69 -- If no tables are needed (E is not a user defined enumeration
70 -- root type, or pragma Discard_Names is in effect, then the
71 -- declarations are not constructed, and the fields remain Empty.
73 procedure Expand_Image_Attribute (N : Node_Id);
74 -- This procedure is called from Exp_Attr to expand an occurrence
75 -- of the attribute Image.
77 procedure Expand_Value_Attribute (N : Node_Id);
78 -- This procedure is called from Exp_Attr to expand an occurrence
79 -- of the attribute Value.
81 type Atype is (Normal, Wide, Wide_Wide);
82 -- Type of attribute in call to Expand_Width_Attribute
84 procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal);
85 -- This procedure is called from Exp_Attr to expand an occurrence of the
86 -- attributes Width (Attr = Normal), or Wide_Width (Attr Wide), or
87 -- Wide_Wide_Width (Attr = Wide_Wide).
89 end Exp_Imgv;