Change use to type-based pool allocator in
[official-gcc.git] / gcc / ada / exp_imgv.ads
blob27b2452ab4ebf523e4b4c8231925418185201f46
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-2007, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 -- Expand routines for Image, Value and Width attributes. These are the
27 -- attributes that make use of enumeration type image tables.
29 with Types; use Types;
31 package Exp_Imgv is
33 procedure Build_Enumeration_Image_Tables (E : Entity_Id; N : Node_Id);
34 -- Build the enumeration image tables for E, which is an enumeration
35 -- base type. The node N is the point in the tree where the resulting
36 -- declarations are to be inserted.
38 -- The form of the tables generated is as follows:
40 -- xxxS : string := "chars";
41 -- xxxI : array (0 .. N) of Natural_8/16/32 := (1, n, .., n);
43 -- Here xxxS is a string obtained by concatenating all the names
44 -- of the enumeration literals in sequence, representing any wide
45 -- characters according to the current wide character encoding
46 -- method, and with all letters forced to upper case.
48 -- The array xxxI is an array of ones origin indexes to the start
49 -- of each name, with one extra entry at the end, which is the index
50 -- to the character just past the end of the last literal, i.e. it is
51 -- the length of xxxS + 1. The element type is the shortest of the
52 -- possible types that will hold all the values.
54 -- For example, for the type
56 -- type x is (hello,'!',goodbye);
58 -- the generated tables would consist of
60 -- xxxS : String := "hello'!'goodbye";
61 -- xxxI : array (0 .. 3) of Natural_8 := (1, 6, 9, 16);
63 -- Here Natural_8 is used since 16 < 2**(8-1)
65 -- If the entity E needs the tables constructing, the necessary
66 -- declarations are constructed, and the fields Lit_Strings and
67 -- Lit_Indexes of E are set to point to the corresponding entities.
68 -- If no tables are needed (E is not a user defined enumeration
69 -- root type, or pragma Discard_Names is in effect, then the
70 -- declarations are not constructed, and the fields remain Empty.
72 procedure Expand_Image_Attribute (N : Node_Id);
73 -- This procedure is called from Exp_Attr to expand an occurrence
74 -- of the attribute Image.
76 procedure Expand_Wide_Image_Attribute (N : Node_Id);
77 -- This procedure is called from Exp_Attr to expand an occurrence
78 -- of the attribute Wide_Image.
80 procedure Expand_Wide_Wide_Image_Attribute (N : Node_Id);
81 -- This procedure is called from Exp_Attr to expand an occurrence
82 -- of the attribute Wide_Wide_Image.
84 procedure Expand_Value_Attribute (N : Node_Id);
85 -- This procedure is called from Exp_Attr to expand an occurrence
86 -- of the attribute Value.
88 type Atype is (Normal, Wide, Wide_Wide);
89 -- Type of attribute in call to Expand_Width_Attribute
91 procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal);
92 -- This procedure is called from Exp_Attr to expand an occurrence of the
93 -- attributes Width (Attr = Normal), or Wide_Width (Attr Wide), or
94 -- Wide_Wide_Width (Attr = Wide_Wide).
96 end Exp_Imgv;