annotate gcc/ada/exp_imgv.ads @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- E X P _ I M G V --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 2000-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- Expand routines for Image, Value and Width attributes. These are the
kono
parents:
diff changeset
27 -- attributes that make use of enumeration type image tables.
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 with Types; use Types;
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 package Exp_Imgv is
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 procedure Build_Enumeration_Image_Tables (E : Entity_Id; N : Node_Id);
kono
parents:
diff changeset
34 -- Build the enumeration image tables for E, which is an enumeration
kono
parents:
diff changeset
35 -- base type. The node N is the point in the tree where the resulting
kono
parents:
diff changeset
36 -- declarations are to be inserted.
kono
parents:
diff changeset
37 --
kono
parents:
diff changeset
38 -- The form of the tables generated is as follows:
kono
parents:
diff changeset
39 --
kono
parents:
diff changeset
40 -- xxxS : string := "chars";
kono
parents:
diff changeset
41 -- xxxI : array (0 .. N) of Natural_8/16/32 := (1, n, .., n);
kono
parents:
diff changeset
42 --
kono
parents:
diff changeset
43 -- Here xxxS is a string obtained by concatenating all the names
kono
parents:
diff changeset
44 -- of the enumeration literals in sequence, representing any wide
kono
parents:
diff changeset
45 -- characters according to the current wide character encoding
kono
parents:
diff changeset
46 -- method, and with all letters forced to upper case.
kono
parents:
diff changeset
47 --
kono
parents:
diff changeset
48 -- The array xxxI is an array of ones origin indexes to the start
kono
parents:
diff changeset
49 -- of each name, with one extra entry at the end, which is the index
kono
parents:
diff changeset
50 -- to the character just past the end of the last literal, i.e. it is
kono
parents:
diff changeset
51 -- the length of xxxS + 1. The element type is the shortest of the
kono
parents:
diff changeset
52 -- possible types that will hold all the values.
kono
parents:
diff changeset
53 --
kono
parents:
diff changeset
54 -- For example, for the type
kono
parents:
diff changeset
55 --
kono
parents:
diff changeset
56 -- type x is (hello,'!',goodbye);
kono
parents:
diff changeset
57 --
kono
parents:
diff changeset
58 -- the generated tables would consist of
kono
parents:
diff changeset
59 --
kono
parents:
diff changeset
60 -- xxxS : String := "hello'!'goodbye";
kono
parents:
diff changeset
61 -- xxxI : array (0 .. 3) of Natural_8 := (1, 6, 9, 16);
kono
parents:
diff changeset
62 --
kono
parents:
diff changeset
63 -- Here Natural_8 is used since 16 < 2**(8-1)
kono
parents:
diff changeset
64 --
kono
parents:
diff changeset
65 -- If the entity E needs the tables constructing, the necessary
kono
parents:
diff changeset
66 -- declarations are constructed, and the fields Lit_Strings and
kono
parents:
diff changeset
67 -- Lit_Indexes of E are set to point to the corresponding entities.
kono
parents:
diff changeset
68 -- If no tables are needed (E is not a user defined enumeration
kono
parents:
diff changeset
69 -- root type, or pragma Discard_Names is in effect, then the
kono
parents:
diff changeset
70 -- declarations are not constructed, and the fields remain Empty.
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 procedure Expand_Image_Attribute (N : Node_Id);
kono
parents:
diff changeset
73 -- This procedure is called from Exp_Attr to expand an occurrence of the
kono
parents:
diff changeset
74 -- attribute Image.
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 procedure Expand_Wide_Image_Attribute (N : Node_Id);
kono
parents:
diff changeset
77 -- This procedure is called from Exp_Attr to expand an occurrence of the
kono
parents:
diff changeset
78 -- attribute Wide_Image.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 procedure Expand_Wide_Wide_Image_Attribute (N : Node_Id);
kono
parents:
diff changeset
81 -- This procedure is called from Exp_Attr to expand an occurrence of the
kono
parents:
diff changeset
82 -- attribute Wide_Wide_Image.
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 procedure Expand_Value_Attribute (N : Node_Id);
kono
parents:
diff changeset
85 -- This procedure is called from Exp_Attr to expand an occurrence of the
kono
parents:
diff changeset
86 -- attribute Value.
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 type Atype is (Normal, Wide, Wide_Wide);
kono
parents:
diff changeset
89 -- Type of attribute in call to Expand_Width_Attribute
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal);
kono
parents:
diff changeset
92 -- This procedure is called from Exp_Attr to expand an occurrence of the
kono
parents:
diff changeset
93 -- attributes Width (Attr = Normal), or Wide_Width (Attr Wide), or
kono
parents:
diff changeset
94 -- Wide_Wide_Width (Attr = Wide_Wide).
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 end Exp_Imgv;