1
------------------------------------------------------------------------------
3
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
5
-- A S I S . D A T A _ D E C O M P O S I T I O N . D E B U G --
9
-- Copyright (c) 1995-1999, Free Software Foundation, Inc. --
11
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
12
-- under terms of the GNU General Public License as published by the Free --
13
-- Software Foundation; either version 2, or (at your option) any later --
14
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
15
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
16
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
17
-- Public License for more details. You should have received a copy of the --
18
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
19
-- COPYING. If not, write to the Free Software Foundation, 59 Temple Place --
20
-- - Suite 330, Boston, MA 02111-1307, USA. --
22
-- As a special exception, if other files instantiate generics from this --
23
-- unit, or you link this unit with other files to produce an executable, --
24
-- this unit does not by itself cause the resulting executable to be --
25
-- covered by the GNU General Public License. This exception does not --
26
-- however invalidate any other reasons why the executable file might be --
27
-- covered by the GNU Public License. --
29
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
30
-- Software Engineering Laboratory of the Swiss Federal Institute of --
31
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
32
-- Scientific Research Computer Center of Moscow State University (SRCC --
33
-- MSU), Russia, with funding partially provided by grants from the Swiss --
34
-- National Science Foundation and the Swiss Academy of Engineering --
35
-- Sciences. ASIS-for-GNAT is now maintained by Ada Core Technologies Inc --
36
-- (http://www.gnat.com). --
38
------------------------------------------------------------------------------
40
with Ada.Characters.Handling; use Ada.Characters.Handling;
42
with Asis.Elements; use Asis.Elements;
43
with Asis.Declarations; use Asis.Declarations;
45
with A4G.A_Output; use A4G.A_Output;
48
with Asis.Data_Decomposition.Aux;
49
with Asis.Data_Decomposition.Set_Get;
52
package body Asis.Data_Decomposition.Debug is
54
LT : String renames A4G.A_Types.ASIS_Line_Terminator;
56
-----------------------
57
-- Local subprograms --
58
-----------------------
60
procedure Rec_Comp_Debug_String (RC : in Record_Component);
61
procedure Arr_Comp_Debug_String (AC : in Array_Component);
62
-- Form the Content of the Debug_Buffer
64
---------------------------
65
-- Arr_Comp_Debug_String --
66
---------------------------
68
procedure Arr_Comp_Debug_String (AC : in Array_Component) is
69
Parent_Type_Image : String_Ptr;
71
Debug_Buffer_Len := 0;
73
Add ("This is a Nil Record Component");
78
new String'(To_String (Debug_Image (AC.Parent_Array_Type)));
80
Debug_Buffer_Len := 0;
84
Add ("Parent_Array_Type");
86
Add (Parent_Type_Image.all);
87
Free (Parent_Type_Image);
91
Add ("Parent_Component_Name: ");
92
if Is_Nil (AC.Parent_Component_Name) then
95
Add (To_String (Defining_Name_Image (AC.Parent_Component_Name)));
99
if AC.Is_Record_Comp then
100
Add (">>> IS RECORD");
102
elsif AC.Is_Array_Comp then
103
Add (">>> IS ARRAY");
108
Add (ASIS_Natural'Image (AC.Position));
112
Add (ASIS_Natural'Image (AC.First_Bit));
116
Add (ASIS_Natural'Image (AC.Last_Bit));
120
Add (ASIS_Natural'Image (AC.Size));
124
Add (ASIS_Natural'Image (AC.Dimension));
127
for I in 1 .. AC.Dimension loop
129
Add (ASIS_Natural'Image (I));
131
Add (ASIS_Natural'Image (AC.Length (I)));
136
end Arr_Comp_Debug_String;
142
function Debug_Image (RC : in Record_Component) return Wide_String is
145
Rec_Comp_Debug_String (RC);
147
return To_Wide_String (
148
LT & "Record Component Debug_Image: " & LT &
149
Debug_Buffer (1 .. Debug_Buffer_Len));
157
function Debug_Image (AC : in Array_Component) return Wide_String is
160
Arr_Comp_Debug_String (AC);
162
return To_Wide_String (
163
LT & "Array Component Debug_Image: " & LT &
164
Debug_Buffer (1 .. Debug_Buffer_Len));
168
---------------------------
169
-- Rec_Comp_Debug_String --
170
---------------------------
172
procedure Rec_Comp_Debug_String (RC : in Record_Component) is
173
Parent_Type_Image : String_Ptr;
176
Debug_Buffer_Len := 0;
179
Add ("This is a Nil Record Component");
184
new String'(To_String (Debug_Image (RC.Parent_Record_Type)));
186
Debug_Buffer_Len := 0;
190
Add ("Parent_Record_Type");
192
Add (Parent_Type_Image.all);
193
Free (Parent_Type_Image);
197
Add ("Component_Name: ");
198
Add (To_String (Defining_Name_Image (RC.Component_Name)));
201
if RC.Is_Record_Comp then
202
Add (">>> IS RECORD");
204
elsif RC.Is_Array_Comp then
205
Add (">>> IS ARRAY");
211
Add (ASIS_Natural'Image (RC.Position));
215
Add (ASIS_Natural'Image (RC.First_Bit));
219
Add (ASIS_Natural'Image (RC.Last_Bit));
223
Add (ASIS_Natural'Image (RC.Size));
226
end Rec_Comp_Debug_String;
228
---------------------------
229
-- Is_Derived_From_Array --
230
----------------------------
231
function Is_Derived_From_Array (TD : Element) return Boolean renames
232
Asis.Data_Decomposition.Aux.Is_Derived_From_Array;
234
----------------------------
235
-- Is_Derived_From_Record --
236
-----------------------------
237
function Is_Derived_From_Record (TD : Element) return Boolean renames
238
Asis.Data_Decomposition.Aux.Is_Derived_From_Record;
240
function Dimension (Comp : Array_Component) return ASIS_Natural renames
241
Asis.Data_Decomposition.Set_Get.Dimension;
243
-- function Linear_Index
244
-- (Inds : Dimension_Indexes;
246
-- Ind_Lengths : Dimention_Length;
247
-- Conv : Convention_Id := Convention_Ada)
248
-- return Asis.ASIS_Natural
249
-- renames Asis.Data_Decomposition.Aux.Linear_Index;
251
-- function De_Linear_Index
252
-- (Index : Asis.ASIS_Natural;
254
-- Ind_Lengths : Dimention_Length;
255
-- Conv : Convention_Id := Convention_Ada)
256
-- return Dimension_Indexes
257
-- renames Asis.Data_Decomposition.Aux.De_Linear_Index;
259
end Asis.Data_Decomposition.Debug;
b'\\ No newline at end of file'