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