1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Aspects
; use Aspects
;
27 with Atree
; use Atree
;
28 with Casing
; use Casing
;
29 with Csets
; use Csets
;
30 with Debug
; use Debug
;
31 with Einfo
; use Einfo
;
32 with Fname
; use Fname
;
34 with Namet
; use Namet
;
35 with Nlists
; use Nlists
;
37 with Output
; use Output
;
38 with Rtsfind
; use Rtsfind
;
39 with Sem_Eval
; use Sem_Eval
;
40 with Sem_Util
; use Sem_Util
;
41 with Sinfo
; use Sinfo
;
42 with Sinput
; use Sinput
;
43 with Sinput
.D
; use Sinput
.D
;
44 with Snames
; use Snames
;
45 with Stand
; use Stand
;
46 with Stringt
; use Stringt
;
47 with Uintp
; use Uintp
;
48 with Uname
; use Uname
;
49 with Urealp
; use Urealp
;
51 package body Sprint
is
52 Current_Source_File
: Source_File_Index
;
53 -- Index of source file whose generated code is being dumped
55 Dump_Node
: Node_Id
:= Empty
;
56 -- This is set to the current node, used for printing line numbers. In
57 -- Debug_Generated_Code mode, Dump_Node is set to the current node
58 -- requiring Sloc fixup, until Set_Debug_Sloc is called to set the proper
59 -- value. The call clears it back to Empty.
61 Debug_Sloc
: Source_Ptr
;
62 -- Sloc of first byte of line currently being written if we are
63 -- generating a source debug file.
65 Dump_Original_Only
: Boolean;
66 -- Set True if the -gnatdo (dump original tree) flag is set
68 Dump_Generated_Only
: Boolean;
69 -- Set True if the -gnatdG (dump generated tree) debug flag is set
70 -- or for Print_Generated_Code (-gnatG) or Dump_Generated_Code (-gnatD).
72 Dump_Freeze_Null
: Boolean;
73 -- Set True if freeze nodes and non-source null statements output
75 Freeze_Indent
: Int
:= 0;
76 -- Keep track of freeze indent level (controls output of blank lines before
77 -- procedures within expression freeze actions). Relevant only if we are
78 -- not in Dump_Source_Text mode, since in Dump_Source_Text mode we don't
79 -- output these blank lines in any case.
82 -- Number of columns for current line output indentation
84 Indent_Annull_Flag
: Boolean := False;
85 -- Set True if subsequent Write_Indent call to be ignored, gets reset
86 -- by this call, so it is only active to suppress a single indent call.
88 Last_Line_Printed
: Physical_Line_Number
;
89 -- This keeps track of the physical line number of the last source line
90 -- that has been output. The value is only valid in Dump_Source_Text mode.
92 -------------------------------
93 -- Operator Precedence Table --
94 -------------------------------
96 -- This table is used to decide whether a subexpression needs to be
97 -- parenthesized. The rule is that if an operand of an operator (which
98 -- for this purpose includes AND THEN and OR ELSE) is itself an operator
99 -- with a lower precedence than the operator (or equal precedence if
100 -- appearing as the right operand), then parentheses are required.
102 Op_Prec
: constant array (N_Subexpr
) of Short_Short_Integer :=
135 procedure Sprint_Left_Opnd
(N
: Node_Id
);
136 -- Print left operand of operator, parenthesizing if necessary
138 procedure Sprint_Right_Opnd
(N
: Node_Id
);
139 -- Print right operand of operator, parenthesizing if necessary
141 -----------------------
142 -- Local Subprograms --
143 -----------------------
145 procedure Col_Check
(N
: Nat
);
146 -- Check that at least N characters remain on current line, and if not,
147 -- then start an extra line with two characters extra indentation for
148 -- continuing text on the next line.
150 procedure Extra_Blank_Line
;
151 -- In some situations we write extra blank lines to separate the generated
152 -- code to make it more readable. However, these extra blank lines are not
153 -- generated in Dump_Source_Text mode, since there the source text lines
154 -- output with preceding blank lines are quite sufficient as separators.
155 -- This procedure writes a blank line if Dump_Source_Text is False.
157 procedure Indent_Annull
;
158 -- Causes following call to Write_Indent to be ignored. This is used when
159 -- a higher level node wants to stop a lower level node from starting a
160 -- new line, when it would otherwise be inclined to do so (e.g. the case
161 -- of an accept statement called from an accept alternative with a guard)
163 procedure Indent_Begin
;
164 -- Increase indentation level
166 procedure Indent_End
;
167 -- Decrease indentation level
169 procedure Print_Debug_Line
(S
: String);
170 -- Used to print output lines in Debug_Generated_Code mode (this is used
171 -- as the argument for a call to Set_Special_Output in package Output).
173 procedure Process_TFAI_RR_Flags
(Nod
: Node_Id
);
174 -- Given a divide, multiplication or division node, check the flags
175 -- Treat_Fixed_As_Integer and Rounded_Flags, and if set, output the
176 -- appropriate special syntax characters (# and @).
178 procedure Set_Debug_Sloc
;
179 -- If Dump_Node is non-empty, this routine sets the appropriate value
180 -- in its Sloc field, from the current location in the debug source file
181 -- that is currently being written.
183 procedure Sprint_And_List
(List
: List_Id
);
184 -- Print the given list with items separated by vertical "and"
186 procedure Sprint_Aspect_Specifications
(Node
: Node_Id
);
187 -- Node is a declaration node that has aspect specifications (Has_Aspects
188 -- flag set True). It is called after outputting the terminating semicolon
189 -- for the related node. The effect is to remove the semicolon and print
190 -- the aspect specifications, followed by a terminating semicolon.
192 procedure Sprint_Bar_List
(List
: List_Id
);
193 -- Print the given list with items separated by vertical bars
195 procedure Sprint_End_Label
198 -- Print the end label for a Handled_Sequence_Of_Statements in a body.
199 -- If there is not end label, use the defining identifier of the enclosing
200 -- construct. If the end label is present, treat it as a reference to the
201 -- defining entity of the construct: this guarantees that it carries the
202 -- proper sloc information for debugging purposes.
204 procedure Sprint_Node_Actual
(Node
: Node_Id
);
205 -- This routine prints its node argument. It is a lower level routine than
206 -- Sprint_Node, in that it does not bother about rewritten trees.
208 procedure Sprint_Node_Sloc
(Node
: Node_Id
);
209 -- Like Sprint_Node, but in addition, in Debug_Generated_Code mode,
210 -- sets the Sloc of the current debug node to be a copy of the Sloc
211 -- of the sprinted node Node. Note that this is done after printing
212 -- Node, so that the Sloc is the proper updated value for the debug file.
214 procedure Update_Itype
(Node
: Node_Id
);
215 -- Update the Sloc of an itype that is not attached to the tree, when
216 -- debugging expanded code. This routine is called from nodes whose
217 -- type can be an Itype, such as defining_identifiers that may be of
218 -- an anonymous access type, or ranges in slices.
220 procedure Write_Char_Sloc
(C
: Character);
221 -- Like Write_Char, except that if C is non-blank, Set_Debug_Sloc is
222 -- called to ensure that the current node has a proper Sloc set.
224 procedure Write_Condition_And_Reason
(Node
: Node_Id
);
225 -- Write Condition and Reason codes of Raise_xxx_Error node
227 procedure Write_Corresponding_Source
(S
: String);
228 -- If S is a string with a single keyword (possibly followed by a space),
229 -- and if the next non-comment non-blank source line matches this keyword,
230 -- then output all source lines up to this matching line.
232 procedure Write_Discr_Specs
(N
: Node_Id
);
233 -- Output discriminant specification for node, which is any of the type
234 -- declarations that can have discriminants.
236 procedure Write_Ekind
(E
: Entity_Id
);
237 -- Write the String corresponding to the Ekind without "E_"
239 procedure Write_Id
(N
: Node_Id
);
240 -- N is a node with a Chars field. This procedure writes the name that
241 -- will be used in the generated code associated with the name. For a
242 -- node with no associated entity, this is simply the Chars field. For
243 -- the case where there is an entity associated with the node, we print
244 -- the name associated with the entity (since it may have been encoded).
245 -- One other special case is that an entity has an active external name
246 -- (i.e. an external name present with no address clause), then this
247 -- external name is output. This procedure also deals with outputting
248 -- declarations of referenced itypes, if not output earlier.
250 function Write_Identifiers
(Node
: Node_Id
) return Boolean;
251 -- Handle node where the grammar has a list of defining identifiers, but
252 -- the tree has a separate declaration for each identifier. Handles the
253 -- printing of the defining identifier, and returns True if the type and
254 -- initialization information is to be printed, False if it is to be
255 -- skipped (the latter case happens when printing defining identifiers
256 -- other than the first in the original tree output case).
258 procedure Write_Implicit_Def
(E
: Entity_Id
);
259 pragma Warnings
(Off
, Write_Implicit_Def
);
260 -- Write the definition of the implicit type E according to its Ekind
261 -- For now a debugging procedure, but might be used in the future.
263 procedure Write_Indent
;
264 -- Start a new line and write indentation spacing
266 function Write_Indent_Identifiers
(Node
: Node_Id
) return Boolean;
267 -- Like Write_Identifiers except that each new printed declaration
268 -- is at the start of a new line.
270 function Write_Indent_Identifiers_Sloc
(Node
: Node_Id
) return Boolean;
271 -- Like Write_Indent_Identifiers except that in Debug_Generated_Code
272 -- mode, the Sloc of the current debug node is set to point to the
273 -- first output identifier.
275 procedure Write_Indent_Str
(S
: String);
276 -- Start a new line and write indent spacing followed by given string
278 procedure Write_Indent_Str_Sloc
(S
: String);
279 -- Like Write_Indent_Str, but in addition, in Debug_Generated_Code mode,
280 -- the Sloc of the current node is set to the first non-blank character
283 procedure Write_Itype
(Typ
: Entity_Id
);
284 -- If Typ is an Itype that has not been written yet, write it. If Typ is
285 -- any other kind of entity or tree node, the call is ignored.
287 procedure Write_Name_With_Col_Check
(N
: Name_Id
);
288 -- Write name (using Write_Name) with initial column check, and possible
289 -- initial Write_Indent (to get new line) if current line is too full.
291 procedure Write_Name_With_Col_Check_Sloc
(N
: Name_Id
);
292 -- Like Write_Name_With_Col_Check but in addition, in Debug_Generated_Code
293 -- mode, sets Sloc of current debug node to first character of name.
295 procedure Write_Operator
(N
: Node_Id
; S
: String);
296 -- Like Write_Str_Sloc, used for operators, encloses the string in
297 -- characters {} if the Do_Overflow flag is set on the node N.
299 procedure Write_Param_Specs
(N
: Node_Id
);
300 -- Output parameter specifications for node (which is either a function
301 -- or procedure specification with a Parameter_Specifications field)
303 procedure Write_Rewrite_Str
(S
: String);
304 -- Writes out a string (typically containing <<< or >>>}) for a node
305 -- created by rewriting the tree. Suppressed if we are outputting the
306 -- generated code only, since in this case we don't specially mark nodes
307 -- created by rewriting).
309 procedure Write_Source_Line
(L
: Physical_Line_Number
);
310 -- If writing of interspersed source lines is enabled, then write the given
311 -- line from the source file, preceded by Eol, then an extra blank line if
312 -- the line has at least one blank, is not a comment and is not line one,
313 -- then "--" and the line number followed by period followed by text of the
314 -- source line (without terminating Eol). If interspersed source line
315 -- output not enabled, then the call has no effect.
317 procedure Write_Source_Lines
(L
: Physical_Line_Number
);
318 -- If writing of interspersed source lines is enabled, then writes source
319 -- lines Last_Line_Printed + 1 .. L, and updates Last_Line_Printed. If
320 -- interspersed source line output not enabled, then call has no effect.
322 procedure Write_Str_Sloc
(S
: String);
323 -- Like Write_Str, but sets debug Sloc of current debug node to first
324 -- non-blank character if a current debug node is active.
326 procedure Write_Str_With_Col_Check
(S
: String);
327 -- Write string (using Write_Str) with initial column check, and possible
328 -- initial Write_Indent (to get new line) if current line is too full.
330 procedure Write_Str_With_Col_Check_Sloc
(S
: String);
331 -- Like Write_Str_With_Col_Check, but sets debug Sloc of current debug
332 -- node to first non-blank character if a current debug node is active.
334 procedure Write_Subprogram_Name
(N
: Node_Id
);
335 -- N is the Name field of a function call or procedure statement call.
336 -- The effect of the call is to output the name, preceded by a $ if the
337 -- call is identified as an implicit call to a run time routine.
339 procedure Write_Uint_With_Col_Check
(U
: Uint
; Format
: UI_Format
);
340 -- Write Uint (using UI_Write) with initial column check, and possible
341 -- initial Write_Indent (to get new line) if current line is too full.
342 -- The format parameter determines the output format (see UI_Write).
344 procedure Write_Uint_With_Col_Check_Sloc
(U
: Uint
; Format
: UI_Format
);
345 -- Write Uint (using UI_Write) with initial column check, and possible
346 -- initial Write_Indent (to get new line) if current line is too full.
347 -- The format parameter determines the output format (see UI_Write).
348 -- In addition, in Debug_Generated_Code mode, sets the current node
349 -- Sloc to the first character of the output value.
351 procedure Write_Ureal_With_Col_Check_Sloc
(U
: Ureal
);
352 -- Write Ureal (using same output format as UR_Write) with column checks
353 -- and a possible initial Write_Indent (to get new line) if current line
354 -- is too full. In addition, in Debug_Generated_Code mode, sets the
355 -- current node Sloc to the first character of the output value.
361 procedure Col_Check
(N
: Nat
) is
363 if N
+ Column
> Sprint_Line_Limit
then
364 Write_Indent_Str
(" ");
368 ----------------------
369 -- Extra_Blank_Line --
370 ----------------------
372 procedure Extra_Blank_Line
is
374 if not Dump_Source_Text
then
377 end Extra_Blank_Line
;
383 procedure Indent_Annull
is
385 Indent_Annull_Flag
:= True;
392 procedure Indent_Begin
is
394 Indent
:= Indent
+ 3;
401 procedure Indent_End
is
403 Indent
:= Indent
- 3;
410 procedure pg
(Arg
: Union_Id
) is
412 Dump_Generated_Only
:= True;
413 Dump_Original_Only
:= False;
414 Dump_Freeze_Null
:= True;
415 Current_Source_File
:= No_Source_File
;
417 if Arg
in List_Range
then
418 Sprint_Node_List
(List_Id
(Arg
));
420 elsif Arg
in Node_Range
then
421 Sprint_Node
(Node_Id
(Arg
));
434 procedure po
(Arg
: Union_Id
) is
436 Dump_Generated_Only
:= False;
437 Dump_Original_Only
:= True;
438 Current_Source_File
:= No_Source_File
;
440 if Arg
in List_Range
then
441 Sprint_Node_List
(List_Id
(Arg
));
443 elsif Arg
in Node_Range
then
444 Sprint_Node
(Node_Id
(Arg
));
453 ----------------------
454 -- Print_Debug_Line --
455 ----------------------
457 procedure Print_Debug_Line
(S
: String) is
459 Write_Debug_Line
(S
, Debug_Sloc
);
460 end Print_Debug_Line
;
462 ---------------------------
463 -- Process_TFAI_RR_Flags --
464 ---------------------------
466 procedure Process_TFAI_RR_Flags
(Nod
: Node_Id
) is
468 if Treat_Fixed_As_Integer
(Nod
) then
472 if Rounded_Result
(Nod
) then
475 end Process_TFAI_RR_Flags
;
481 procedure ps
(Arg
: Union_Id
) is
483 Dump_Generated_Only
:= False;
484 Dump_Original_Only
:= False;
485 Current_Source_File
:= No_Source_File
;
487 if Arg
in List_Range
then
488 Sprint_Node_List
(List_Id
(Arg
));
490 elsif Arg
in Node_Range
then
491 Sprint_Node
(Node_Id
(Arg
));
504 procedure Set_Debug_Sloc
is
506 if Debug_Generated_Code
and then Present
(Dump_Node
) then
507 Set_Sloc
(Dump_Node
, Debug_Sloc
+ Source_Ptr
(Column
- 1));
516 procedure Source_Dump
is
519 -- Put underline under string we just printed
525 procedure Underline
is
526 Col
: constant Int
:= Column
;
531 while Col
> Column
loop
538 -- Start of processing for Source_Dump
541 Dump_Generated_Only
:= Debug_Flag_G
or
542 Print_Generated_Code
or
543 Debug_Generated_Code
;
544 Dump_Original_Only
:= Debug_Flag_O
;
545 Dump_Freeze_Null
:= Debug_Flag_S
or Debug_Flag_G
;
547 -- Note that we turn off the tree dump flags immediately, before
548 -- starting the dump. This avoids generating two copies of the dump
549 -- if an abort occurs after printing the dump, and more importantly,
550 -- avoids an infinite loop if an abort occurs during the dump.
553 Current_Source_File
:= No_Source_File
;
554 Debug_Flag_Z
:= False;
557 Write_Str
("Source recreated from tree of Standard (spec)");
559 Sprint_Node
(Standard_Package_Node
);
564 if Debug_Flag_S
or Dump_Generated_Only
or Dump_Original_Only
then
565 Debug_Flag_G
:= False;
566 Debug_Flag_O
:= False;
567 Debug_Flag_S
:= False;
569 -- Dump requested units
571 for U
in Main_Unit
.. Last_Unit
loop
572 Current_Source_File
:= Source_Index
(U
);
574 -- Dump all units if -gnatdf set, otherwise we dump only
575 -- the source files that are in the extended main source.
578 or else In_Extended_Main_Source_Unit
(Cunit_Entity
(U
))
580 -- If we are generating debug files, setup to write them
582 if Debug_Generated_Code
then
583 Set_Special_Output
(Print_Debug_Line
'Access);
584 Create_Debug_Source
(Source_Index
(U
), Debug_Sloc
);
585 Write_Source_Line
(1);
586 Last_Line_Printed
:= 1;
587 Sprint_Node
(Cunit
(U
));
588 Write_Source_Lines
(Last_Source_Line
(Current_Source_File
));
591 Set_Special_Output
(null);
593 -- Normal output to standard output file
596 Write_Str
("Source recreated from tree for ");
597 Write_Unit_Name
(Unit_Name
(U
));
599 Write_Source_Line
(1);
600 Last_Line_Printed
:= 1;
601 Sprint_Node
(Cunit
(U
));
602 Write_Source_Lines
(Last_Source_Line
(Current_Source_File
));
611 ---------------------
612 -- Sprint_And_List --
613 ---------------------
615 procedure Sprint_And_List
(List
: List_Id
) is
618 if Is_Non_Empty_List
(List
) then
619 Node
:= First
(List
);
623 exit when Node
= Empty
;
629 ----------------------------------
630 -- Sprint_Aspect_Specifications --
631 ----------------------------------
633 procedure Sprint_Aspect_Specifications
(Node
: Node_Id
) is
634 AS
: constant List_Id
:= Aspect_Specifications
(Node
);
638 Write_Erase_Char
(';');
639 Indent
:= Indent
+ 2;
642 Indent
:= Indent
+ 5;
646 Sprint_Node
(Identifier
(A
));
648 if Class_Present
(A
) then
649 Write_Str
("'Class");
652 if Present
(Expression
(A
)) then
654 Sprint_Node
(Expression
(A
));
664 Indent
:= Indent
- 7;
666 end Sprint_Aspect_Specifications
;
668 ---------------------
669 -- Sprint_Bar_List --
670 ---------------------
672 procedure Sprint_Bar_List
(List
: List_Id
) is
675 if Is_Non_Empty_List
(List
) then
676 Node
:= First
(List
);
680 exit when Node
= Empty
;
686 ----------------------
687 -- Sprint_End_Label --
688 ----------------------
690 procedure Sprint_End_Label
696 and then Present
(End_Label
(Node
))
697 and then Is_Entity_Name
(End_Label
(Node
))
699 Set_Entity
(End_Label
(Node
), Default
);
701 -- For a function whose name is an operator, use the qualified name
702 -- created for the defining entity.
704 if Nkind
(End_Label
(Node
)) = N_Operator_Symbol
then
705 Set_Chars
(End_Label
(Node
), Chars
(Default
));
708 Sprint_Node
(End_Label
(Node
));
710 Sprint_Node
(Default
);
712 end Sprint_End_Label
;
714 -----------------------
715 -- Sprint_Comma_List --
716 -----------------------
718 procedure Sprint_Comma_List
(List
: List_Id
) is
722 if Is_Non_Empty_List
(List
) then
723 Node
:= First
(List
);
727 exit when Node
= Empty
;
729 if not Is_Rewrite_Insertion
(Node
)
730 or else not Dump_Original_Only
736 end Sprint_Comma_List
;
738 --------------------------
739 -- Sprint_Indented_List --
740 --------------------------
742 procedure Sprint_Indented_List
(List
: List_Id
) is
745 Sprint_Node_List
(List
);
747 end Sprint_Indented_List
;
749 ---------------------
750 -- Sprint_Left_Opnd --
751 ---------------------
753 procedure Sprint_Left_Opnd
(N
: Node_Id
) is
754 Opnd
: constant Node_Id
:= Left_Opnd
(N
);
757 if Paren_Count
(Opnd
) /= 0
758 or else Op_Prec
(Nkind
(Opnd
)) >= Op_Prec
(Nkind
(N
))
767 end Sprint_Left_Opnd
;
773 procedure Sprint_Node
(Node
: Node_Id
) is
775 if Is_Rewrite_Insertion
(Node
) then
776 if not Dump_Original_Only
then
778 -- For special cases of nodes that always output <<< >>>
779 -- do not duplicate the output at this point.
781 if Nkind
(Node
) = N_Freeze_Entity
782 or else Nkind
(Node
) = N_Implicit_Label_Declaration
784 Sprint_Node_Actual
(Node
);
786 -- Normal case where <<< >>> may be required
789 Write_Rewrite_Str
("<<<");
790 Sprint_Node_Actual
(Node
);
791 Write_Rewrite_Str
(">>>");
795 elsif Is_Rewrite_Substitution
(Node
) then
797 -- Case of dump generated only
799 if Dump_Generated_Only
then
800 Sprint_Node_Actual
(Node
);
802 -- Case of dump original only
804 elsif Dump_Original_Only
then
805 Sprint_Node_Actual
(Original_Node
(Node
));
807 -- Case of both being dumped
810 Sprint_Node_Actual
(Original_Node
(Node
));
811 Write_Rewrite_Str
("<<<");
812 Sprint_Node_Actual
(Node
);
813 Write_Rewrite_Str
(">>>");
817 Sprint_Node_Actual
(Node
);
821 ------------------------
822 -- Sprint_Node_Actual --
823 ------------------------
825 procedure Sprint_Node_Actual
(Node
: Node_Id
) is
826 Save_Dump_Node
: constant Node_Id
:= Dump_Node
;
833 for J
in 1 .. Paren_Count
(Node
) loop
834 Write_Str_With_Col_Check
("(");
837 -- Setup current dump node
841 if Nkind
(Node
) in N_Subexpr
842 and then Do_Range_Check
(Node
)
844 Write_Str_With_Col_Check
("{");
847 -- Select print circuit based on node kind
850 when N_Abort_Statement
=>
851 Write_Indent_Str_Sloc
("abort ");
852 Sprint_Comma_List
(Names
(Node
));
855 when N_Abortable_Part
=>
857 Write_Str_Sloc
("abort ");
858 Sprint_Indented_List
(Statements
(Node
));
860 when N_Abstract_Subprogram_Declaration
=>
862 Sprint_Node
(Specification
(Node
));
863 Write_Str_With_Col_Check
(" is ");
864 Write_Str_Sloc
("abstract;");
866 when N_Accept_Alternative
=>
867 Sprint_Node_List
(Pragmas_Before
(Node
));
869 if Present
(Condition
(Node
)) then
870 Write_Indent_Str
("when ");
871 Sprint_Node
(Condition
(Node
));
876 Sprint_Node_Sloc
(Accept_Statement
(Node
));
877 Sprint_Node_List
(Statements
(Node
));
879 when N_Accept_Statement
=>
880 Write_Indent_Str_Sloc
("accept ");
881 Write_Id
(Entry_Direct_Name
(Node
));
883 if Present
(Entry_Index
(Node
)) then
884 Write_Str_With_Col_Check
(" (");
885 Sprint_Node
(Entry_Index
(Node
));
889 Write_Param_Specs
(Node
);
891 if Present
(Handled_Statement_Sequence
(Node
)) then
892 Write_Str_With_Col_Check
(" do");
893 Sprint_Node
(Handled_Statement_Sequence
(Node
));
894 Write_Indent_Str
("end ");
895 Write_Id
(Entry_Direct_Name
(Node
));
900 when N_Access_Definition
=>
904 if Present
(Access_To_Subprogram_Definition
(Node
)) then
905 Sprint_Node
(Access_To_Subprogram_Definition
(Node
));
909 if Null_Exclusion_Present
(Node
) then
910 Write_Str
("not null ");
913 Write_Str_With_Col_Check_Sloc
("access ");
915 if All_Present
(Node
) then
917 elsif Constant_Present
(Node
) then
918 Write_Str
("constant ");
921 Sprint_Node
(Subtype_Mark
(Node
));
924 when N_Access_Function_Definition
=>
928 if Null_Exclusion_Present
(Node
) then
929 Write_Str
("not null ");
932 Write_Str_With_Col_Check_Sloc
("access ");
934 if Protected_Present
(Node
) then
935 Write_Str_With_Col_Check
("protected ");
938 Write_Str_With_Col_Check
("function");
939 Write_Param_Specs
(Node
);
940 Write_Str_With_Col_Check
(" return ");
941 Sprint_Node
(Result_Definition
(Node
));
943 when N_Access_Procedure_Definition
=>
947 if Null_Exclusion_Present
(Node
) then
948 Write_Str
("not null ");
951 Write_Str_With_Col_Check_Sloc
("access ");
953 if Protected_Present
(Node
) then
954 Write_Str_With_Col_Check
("protected ");
957 Write_Str_With_Col_Check
("procedure");
958 Write_Param_Specs
(Node
);
960 when N_Access_To_Object_Definition
=>
961 Write_Str_With_Col_Check_Sloc
("access ");
963 if All_Present
(Node
) then
964 Write_Str_With_Col_Check
("all ");
965 elsif Constant_Present
(Node
) then
966 Write_Str_With_Col_Check
("constant ");
971 if Null_Exclusion_Present
(Node
) then
972 Write_Str
("not null ");
975 Sprint_Node
(Subtype_Indication
(Node
));
978 if Null_Record_Present
(Node
) then
979 Write_Str_With_Col_Check_Sloc
("(null record)");
982 Write_Str_With_Col_Check_Sloc
("(");
984 if Present
(Expressions
(Node
)) then
985 Sprint_Comma_List
(Expressions
(Node
));
987 if Present
(Component_Associations
(Node
))
988 and then not Is_Empty_List
(Component_Associations
(Node
))
994 if Present
(Component_Associations
(Node
))
995 and then not Is_Empty_List
(Component_Associations
(Node
))
1003 Nd
:= First
(Component_Associations
(Node
));
1011 if not Is_Rewrite_Insertion
(Nd
)
1012 or else not Dump_Original_Only
1026 Write_Str_With_Col_Check_Sloc
("new ");
1028 -- Ada 2005 (AI-231)
1030 if Null_Exclusion_Present
(Node
) then
1031 Write_Str
("not null ");
1034 Sprint_Node
(Expression
(Node
));
1036 if Present
(Storage_Pool
(Node
)) then
1037 Write_Str_With_Col_Check
("[storage_pool = ");
1038 Sprint_Node
(Storage_Pool
(Node
));
1043 Sprint_Left_Opnd
(Node
);
1044 Write_Str_Sloc
(" and then ");
1045 Sprint_Right_Opnd
(Node
);
1047 when N_Aspect_Specification
=>
1048 raise Program_Error
;
1050 when N_Assignment_Statement
=>
1052 Sprint_Node
(Name
(Node
));
1053 Write_Str_Sloc
(" := ");
1054 Sprint_Node
(Expression
(Node
));
1057 when N_Asynchronous_Select
=>
1058 Write_Indent_Str_Sloc
("select");
1060 Sprint_Node
(Triggering_Alternative
(Node
));
1063 -- Note: let the printing of Abortable_Part handle outputting
1064 -- the ABORT keyword, so that the Sloc can be set correctly.
1066 Write_Indent_Str
("then ");
1067 Sprint_Node
(Abortable_Part
(Node
));
1068 Write_Indent_Str
("end select;");
1071 Write_Indent_Str_Sloc
("for ");
1072 Write_Id
(Identifier
(Node
));
1073 Write_Str_With_Col_Check
(" use at ");
1074 Sprint_Node
(Expression
(Node
));
1077 when N_Attribute_Definition_Clause
=>
1078 Write_Indent_Str_Sloc
("for ");
1079 Sprint_Node
(Name
(Node
));
1081 Write_Name_With_Col_Check
(Chars
(Node
));
1082 Write_Str_With_Col_Check
(" use ");
1083 Sprint_Node
(Expression
(Node
));
1086 when N_Attribute_Reference
=>
1087 if Is_Procedure_Attribute_Name
(Attribute_Name
(Node
)) then
1091 Sprint_Node
(Prefix
(Node
));
1092 Write_Char_Sloc
(''');
1093 Write_Name_With_Col_Check
(Attribute_Name
(Node
));
1094 Sprint_Paren_Comma_List
(Expressions
(Node
));
1096 if Is_Procedure_Attribute_Name
(Attribute_Name
(Node
)) then
1100 when N_Block_Statement
=>
1103 if Present
(Identifier
(Node
))
1104 and then (not Has_Created_Identifier
(Node
)
1105 or else not Dump_Original_Only
)
1107 Write_Rewrite_Str
("<<<");
1108 Write_Id
(Identifier
(Node
));
1110 Write_Rewrite_Str
(">>>");
1113 if Present
(Declarations
(Node
)) then
1114 Write_Str_With_Col_Check_Sloc
("declare");
1115 Sprint_Indented_List
(Declarations
(Node
));
1119 Write_Str_With_Col_Check_Sloc
("begin");
1120 Sprint_Node
(Handled_Statement_Sequence
(Node
));
1121 Write_Indent_Str
("end");
1123 if Present
(Identifier
(Node
))
1124 and then (not Has_Created_Identifier
(Node
)
1125 or else not Dump_Original_Only
)
1127 Write_Rewrite_Str
("<<<");
1129 Write_Id
(Identifier
(Node
));
1130 Write_Rewrite_Str
(">>>");
1135 when N_Case_Expression
=>
1140 Write_Str_With_Col_Check_Sloc
("(case ");
1141 Sprint_Node
(Expression
(Node
));
1142 Write_Str_With_Col_Check
(" is");
1144 Alt
:= First
(Alternatives
(Node
));
1155 when N_Case_Expression_Alternative
=>
1156 Write_Str_With_Col_Check
(" when ");
1157 Sprint_Bar_List
(Discrete_Choices
(Node
));
1159 Sprint_Node
(Expression
(Node
));
1161 when N_Case_Statement
=>
1162 Write_Indent_Str_Sloc
("case ");
1163 Sprint_Node
(Expression
(Node
));
1165 Sprint_Indented_List
(Alternatives
(Node
));
1166 Write_Indent_Str
("end case;");
1168 when N_Case_Statement_Alternative
=>
1169 Write_Indent_Str_Sloc
("when ");
1170 Sprint_Bar_List
(Discrete_Choices
(Node
));
1172 Sprint_Indented_List
(Statements
(Node
));
1174 when N_Character_Literal
=>
1175 if Column
> Sprint_Line_Limit
- 2 then
1176 Write_Indent_Str
(" ");
1179 Write_Char_Sloc
(''');
1180 Write_Char_Code
(UI_To_CC
(Char_Literal_Value
(Node
)));
1183 when N_Code_Statement
=>
1186 Sprint_Node
(Expression
(Node
));
1189 when N_Compilation_Unit
=>
1190 Sprint_Node_List
(Context_Items
(Node
));
1191 Sprint_Opt_Node_List
(Declarations
(Aux_Decls_Node
(Node
)));
1193 if Private_Present
(Node
) then
1194 Write_Indent_Str
("private ");
1198 Sprint_Node_Sloc
(Unit
(Node
));
1200 if Present
(Actions
(Aux_Decls_Node
(Node
)))
1202 Present
(Pragmas_After
(Aux_Decls_Node
(Node
)))
1207 Sprint_Opt_Node_List
(Actions
(Aux_Decls_Node
(Node
)));
1208 Sprint_Opt_Node_List
(Pragmas_After
(Aux_Decls_Node
(Node
)));
1210 when N_Compilation_Unit_Aux
=>
1211 null; -- nothing to do, never used, see above
1213 when N_Component_Association
=>
1215 Sprint_Bar_List
(Choices
(Node
));
1218 -- Ada 2005 (AI-287): Print the box if present
1220 if Box_Present
(Node
) then
1221 Write_Str_With_Col_Check
("<>");
1223 Sprint_Node
(Expression
(Node
));
1226 when N_Component_Clause
=>
1228 Sprint_Node
(Component_Name
(Node
));
1229 Write_Str_Sloc
(" at ");
1230 Sprint_Node
(Position
(Node
));
1232 Write_Str_With_Col_Check
("range ");
1233 Sprint_Node
(First_Bit
(Node
));
1235 Sprint_Node
(Last_Bit
(Node
));
1238 when N_Component_Definition
=>
1241 -- Ada 2005 (AI-230): Access definition components
1243 if Present
(Access_Definition
(Node
)) then
1244 Sprint_Node
(Access_Definition
(Node
));
1246 elsif Present
(Subtype_Indication
(Node
)) then
1247 if Aliased_Present
(Node
) then
1248 Write_Str_With_Col_Check
("aliased ");
1251 -- Ada 2005 (AI-231)
1253 if Null_Exclusion_Present
(Node
) then
1254 Write_Str
(" not null ");
1257 Sprint_Node
(Subtype_Indication
(Node
));
1260 Write_Str
(" ??? ");
1263 when N_Component_Declaration
=>
1264 if Write_Indent_Identifiers_Sloc
(Node
) then
1266 Sprint_Node
(Component_Definition
(Node
));
1268 if Present
(Expression
(Node
)) then
1270 Sprint_Node
(Expression
(Node
));
1276 when N_Component_List
=>
1277 if Null_Present
(Node
) then
1279 Write_Indent_Str_Sloc
("null");
1285 Sprint_Indented_List
(Component_Items
(Node
));
1286 Sprint_Node
(Variant_Part
(Node
));
1289 when N_Conditional_Entry_Call
=>
1290 Write_Indent_Str_Sloc
("select");
1292 Sprint_Node
(Entry_Call_Alternative
(Node
));
1294 Write_Indent_Str
("else");
1295 Sprint_Indented_List
(Else_Statements
(Node
));
1296 Write_Indent_Str
("end select;");
1298 when N_Conditional_Expression
=>
1300 Condition
: constant Node_Id
:= First
(Expressions
(Node
));
1301 Then_Expr
: constant Node_Id
:= Next
(Condition
);
1304 Write_Str_With_Col_Check_Sloc
("(if ");
1305 Sprint_Node
(Condition
);
1306 Write_Str_With_Col_Check
(" then ");
1308 -- Defense against junk here!
1310 if Present
(Then_Expr
) then
1311 Sprint_Node
(Then_Expr
);
1312 Write_Str_With_Col_Check
(" else ");
1313 Sprint_Node
(Next
(Then_Expr
));
1319 when N_Constrained_Array_Definition
=>
1320 Write_Str_With_Col_Check_Sloc
("array ");
1321 Sprint_Paren_Comma_List
(Discrete_Subtype_Definitions
(Node
));
1324 Sprint_Node
(Component_Definition
(Node
));
1326 when N_Decimal_Fixed_Point_Definition
=>
1327 Write_Str_With_Col_Check_Sloc
(" delta ");
1328 Sprint_Node
(Delta_Expression
(Node
));
1329 Write_Str_With_Col_Check
("digits ");
1330 Sprint_Node
(Digits_Expression
(Node
));
1331 Sprint_Opt_Node
(Real_Range_Specification
(Node
));
1333 when N_Defining_Character_Literal
=>
1334 Write_Name_With_Col_Check_Sloc
(Chars
(Node
));
1336 when N_Defining_Identifier
=>
1340 when N_Defining_Operator_Symbol
=>
1341 Write_Name_With_Col_Check_Sloc
(Chars
(Node
));
1343 when N_Defining_Program_Unit_Name
=>
1345 Sprint_Node
(Name
(Node
));
1347 Write_Id
(Defining_Identifier
(Node
));
1349 when N_Delay_Alternative
=>
1350 Sprint_Node_List
(Pragmas_Before
(Node
));
1352 if Present
(Condition
(Node
)) then
1354 Write_Str_With_Col_Check
("when ");
1355 Sprint_Node
(Condition
(Node
));
1360 Sprint_Node_Sloc
(Delay_Statement
(Node
));
1361 Sprint_Node_List
(Statements
(Node
));
1363 when N_Delay_Relative_Statement
=>
1364 Write_Indent_Str_Sloc
("delay ");
1365 Sprint_Node
(Expression
(Node
));
1368 when N_Delay_Until_Statement
=>
1369 Write_Indent_Str_Sloc
("delay until ");
1370 Sprint_Node
(Expression
(Node
));
1373 when N_Delta_Constraint
=>
1374 Write_Str_With_Col_Check_Sloc
("delta ");
1375 Sprint_Node
(Delta_Expression
(Node
));
1376 Sprint_Opt_Node
(Range_Constraint
(Node
));
1378 when N_Derived_Type_Definition
=>
1379 if Abstract_Present
(Node
) then
1380 Write_Str_With_Col_Check
("abstract ");
1383 Write_Str_With_Col_Check
("new ");
1385 -- Ada 2005 (AI-231)
1387 if Null_Exclusion_Present
(Node
) then
1388 Write_Str_With_Col_Check
("not null ");
1391 Sprint_Node
(Subtype_Indication
(Node
));
1393 if Present
(Interface_List
(Node
)) then
1394 Write_Str_With_Col_Check
(" and ");
1395 Sprint_And_List
(Interface_List
(Node
));
1396 Write_Str_With_Col_Check
(" with ");
1399 if Present
(Record_Extension_Part
(Node
)) then
1400 if No
(Interface_List
(Node
)) then
1401 Write_Str_With_Col_Check
(" with ");
1404 Sprint_Node
(Record_Extension_Part
(Node
));
1407 when N_Designator
=>
1408 Sprint_Node
(Name
(Node
));
1409 Write_Char_Sloc
('.');
1410 Write_Id
(Identifier
(Node
));
1412 when N_Digits_Constraint
=>
1413 Write_Str_With_Col_Check_Sloc
("digits ");
1414 Sprint_Node
(Digits_Expression
(Node
));
1415 Sprint_Opt_Node
(Range_Constraint
(Node
));
1417 when N_Discriminant_Association
=>
1420 if Present
(Selector_Names
(Node
)) then
1421 Sprint_Bar_List
(Selector_Names
(Node
));
1426 Sprint_Node
(Expression
(Node
));
1428 when N_Discriminant_Specification
=>
1431 if Write_Identifiers
(Node
) then
1434 if Null_Exclusion_Present
(Node
) then
1435 Write_Str
("not null ");
1438 Sprint_Node
(Discriminant_Type
(Node
));
1440 if Present
(Expression
(Node
)) then
1442 Sprint_Node
(Expression
(Node
));
1448 when N_Elsif_Part
=>
1449 Write_Indent_Str_Sloc
("elsif ");
1450 Sprint_Node
(Condition
(Node
));
1451 Write_Str_With_Col_Check
(" then");
1452 Sprint_Indented_List
(Then_Statements
(Node
));
1457 when N_Entry_Body
=>
1458 Write_Indent_Str_Sloc
("entry ");
1459 Write_Id
(Defining_Identifier
(Node
));
1460 Sprint_Node
(Entry_Body_Formal_Part
(Node
));
1461 Write_Str_With_Col_Check
(" is");
1462 Sprint_Indented_List
(Declarations
(Node
));
1463 Write_Indent_Str
("begin");
1464 Sprint_Node
(Handled_Statement_Sequence
(Node
));
1465 Write_Indent_Str
("end ");
1466 Write_Id
(Defining_Identifier
(Node
));
1469 when N_Entry_Body_Formal_Part
=>
1470 if Present
(Entry_Index_Specification
(Node
)) then
1471 Write_Str_With_Col_Check_Sloc
(" (");
1472 Sprint_Node
(Entry_Index_Specification
(Node
));
1476 Write_Param_Specs
(Node
);
1477 Write_Str_With_Col_Check_Sloc
(" when ");
1478 Sprint_Node
(Condition
(Node
));
1480 when N_Entry_Call_Alternative
=>
1481 Sprint_Node_List
(Pragmas_Before
(Node
));
1482 Sprint_Node_Sloc
(Entry_Call_Statement
(Node
));
1483 Sprint_Node_List
(Statements
(Node
));
1485 when N_Entry_Call_Statement
=>
1487 Sprint_Node_Sloc
(Name
(Node
));
1488 Sprint_Opt_Paren_Comma_List
(Parameter_Associations
(Node
));
1491 when N_Entry_Declaration
=>
1492 Write_Indent_Str_Sloc
("entry ");
1493 Write_Id
(Defining_Identifier
(Node
));
1495 if Present
(Discrete_Subtype_Definition
(Node
)) then
1496 Write_Str_With_Col_Check
(" (");
1497 Sprint_Node
(Discrete_Subtype_Definition
(Node
));
1501 Write_Param_Specs
(Node
);
1504 when N_Entry_Index_Specification
=>
1505 Write_Str_With_Col_Check_Sloc
("for ");
1506 Write_Id
(Defining_Identifier
(Node
));
1507 Write_Str_With_Col_Check
(" in ");
1508 Sprint_Node
(Discrete_Subtype_Definition
(Node
));
1510 when N_Enumeration_Representation_Clause
=>
1511 Write_Indent_Str_Sloc
("for ");
1512 Write_Id
(Identifier
(Node
));
1513 Write_Str_With_Col_Check
(" use ");
1514 Sprint_Node
(Array_Aggregate
(Node
));
1517 when N_Enumeration_Type_Definition
=>
1520 -- Skip attempt to print Literals field if it's not there and
1521 -- we are in package Standard (case of Character, which is
1522 -- handled specially (without an explicit literals list).
1524 if Sloc
(Node
) > Standard_Location
1525 or else Present
(Literals
(Node
))
1527 Sprint_Paren_Comma_List
(Literals
(Node
));
1531 Write_Str_With_Col_Check_Sloc
("<error>");
1533 when N_Exception_Declaration
=>
1534 if Write_Indent_Identifiers
(Node
) then
1535 Write_Str_With_Col_Check
(" : ");
1537 if Is_Statically_Allocated
(Defining_Identifier
(Node
)) then
1538 Write_Str_With_Col_Check
("static ");
1541 Write_Str_Sloc
("exception");
1543 if Present
(Expression
(Node
)) then
1545 Sprint_Node
(Expression
(Node
));
1551 when N_Exception_Handler
=>
1552 Write_Indent_Str_Sloc
("when ");
1554 if Present
(Choice_Parameter
(Node
)) then
1555 Sprint_Node
(Choice_Parameter
(Node
));
1559 Sprint_Bar_List
(Exception_Choices
(Node
));
1561 Sprint_Indented_List
(Statements
(Node
));
1563 when N_Exception_Renaming_Declaration
=>
1566 Sprint_Node
(Defining_Identifier
(Node
));
1567 Write_Str_With_Col_Check
(" : exception renames ");
1568 Sprint_Node
(Name
(Node
));
1571 when N_Exit_Statement
=>
1572 Write_Indent_Str_Sloc
("exit");
1573 Sprint_Opt_Node
(Name
(Node
));
1575 if Present
(Condition
(Node
)) then
1576 Write_Str_With_Col_Check
(" when ");
1577 Sprint_Node
(Condition
(Node
));
1582 when N_Expanded_Name
=>
1583 Sprint_Node
(Prefix
(Node
));
1584 Write_Char_Sloc
('.');
1585 Sprint_Node
(Selector_Name
(Node
));
1587 when N_Explicit_Dereference
=>
1588 Sprint_Node
(Prefix
(Node
));
1589 Write_Char_Sloc
('.');
1590 Write_Str_Sloc
("all");
1592 when N_Expression_With_Actions
=>
1594 Write_Indent_Str_Sloc
("do ");
1596 Sprint_Node_List
(Actions
(Node
));
1599 Write_Str_With_Col_Check_Sloc
("in ");
1600 Sprint_Node
(Expression
(Node
));
1601 Write_Str_With_Col_Check
(" end");
1605 when N_Extended_Return_Statement
=>
1606 Write_Indent_Str_Sloc
("return ");
1607 Sprint_Node_List
(Return_Object_Declarations
(Node
));
1609 if Present
(Handled_Statement_Sequence
(Node
)) then
1610 Write_Str_With_Col_Check
(" do");
1611 Sprint_Node
(Handled_Statement_Sequence
(Node
));
1612 Write_Indent_Str
("end return;");
1614 Write_Indent_Str
(";");
1617 when N_Extension_Aggregate
=>
1618 Write_Str_With_Col_Check_Sloc
("(");
1619 Sprint_Node
(Ancestor_Part
(Node
));
1620 Write_Str_With_Col_Check
(" with ");
1622 if Null_Record_Present
(Node
) then
1623 Write_Str_With_Col_Check
("null record");
1625 if Present
(Expressions
(Node
)) then
1626 Sprint_Comma_List
(Expressions
(Node
));
1628 if Present
(Component_Associations
(Node
)) then
1633 if Present
(Component_Associations
(Node
)) then
1634 Sprint_Comma_List
(Component_Associations
(Node
));
1640 when N_Floating_Point_Definition
=>
1641 Write_Str_With_Col_Check_Sloc
("digits ");
1642 Sprint_Node
(Digits_Expression
(Node
));
1643 Sprint_Opt_Node
(Real_Range_Specification
(Node
));
1645 when N_Formal_Decimal_Fixed_Point_Definition
=>
1646 Write_Str_With_Col_Check_Sloc
("delta <> digits <>");
1648 when N_Formal_Derived_Type_Definition
=>
1649 Write_Str_With_Col_Check_Sloc
("new ");
1650 Sprint_Node
(Subtype_Mark
(Node
));
1652 if Present
(Interface_List
(Node
)) then
1653 Write_Str_With_Col_Check
(" and ");
1654 Sprint_And_List
(Interface_List
(Node
));
1657 if Private_Present
(Node
) then
1658 Write_Str_With_Col_Check
(" with private");
1661 when N_Formal_Abstract_Subprogram_Declaration
=>
1662 Write_Indent_Str_Sloc
("with ");
1663 Sprint_Node
(Specification
(Node
));
1665 Write_Str_With_Col_Check
(" is abstract");
1667 if Box_Present
(Node
) then
1668 Write_Str_With_Col_Check
(" <>");
1669 elsif Present
(Default_Name
(Node
)) then
1670 Write_Str_With_Col_Check
(" ");
1671 Sprint_Node
(Default_Name
(Node
));
1676 when N_Formal_Concrete_Subprogram_Declaration
=>
1677 Write_Indent_Str_Sloc
("with ");
1678 Sprint_Node
(Specification
(Node
));
1680 if Box_Present
(Node
) then
1681 Write_Str_With_Col_Check
(" is <>");
1682 elsif Present
(Default_Name
(Node
)) then
1683 Write_Str_With_Col_Check
(" is ");
1684 Sprint_Node
(Default_Name
(Node
));
1689 when N_Formal_Discrete_Type_Definition
=>
1690 Write_Str_With_Col_Check_Sloc
("<>");
1692 when N_Formal_Floating_Point_Definition
=>
1693 Write_Str_With_Col_Check_Sloc
("digits <>");
1695 when N_Formal_Modular_Type_Definition
=>
1696 Write_Str_With_Col_Check_Sloc
("mod <>");
1698 when N_Formal_Object_Declaration
=>
1701 if Write_Indent_Identifiers
(Node
) then
1704 if In_Present
(Node
) then
1705 Write_Str_With_Col_Check
("in ");
1708 if Out_Present
(Node
) then
1709 Write_Str_With_Col_Check
("out ");
1712 if Present
(Subtype_Mark
(Node
)) then
1714 -- Ada 2005 (AI-423): Formal object with null exclusion
1716 if Null_Exclusion_Present
(Node
) then
1717 Write_Str
("not null ");
1720 Sprint_Node
(Subtype_Mark
(Node
));
1722 -- Ada 2005 (AI-423): Formal object with access definition
1725 pragma Assert
(Present
(Access_Definition
(Node
)));
1727 Sprint_Node
(Access_Definition
(Node
));
1730 if Present
(Default_Expression
(Node
)) then
1732 Sprint_Node
(Default_Expression
(Node
));
1738 when N_Formal_Ordinary_Fixed_Point_Definition
=>
1739 Write_Str_With_Col_Check_Sloc
("delta <>");
1741 when N_Formal_Package_Declaration
=>
1742 Write_Indent_Str_Sloc
("with package ");
1743 Write_Id
(Defining_Identifier
(Node
));
1744 Write_Str_With_Col_Check
(" is new ");
1745 Sprint_Node
(Name
(Node
));
1746 Write_Str_With_Col_Check
(" (<>);");
1748 when N_Formal_Private_Type_Definition
=>
1749 if Abstract_Present
(Node
) then
1750 Write_Str_With_Col_Check
("abstract ");
1753 if Tagged_Present
(Node
) then
1754 Write_Str_With_Col_Check
("tagged ");
1757 if Limited_Present
(Node
) then
1758 Write_Str_With_Col_Check
("limited ");
1761 Write_Str_With_Col_Check_Sloc
("private");
1763 when N_Formal_Signed_Integer_Type_Definition
=>
1764 Write_Str_With_Col_Check_Sloc
("range <>");
1766 when N_Formal_Type_Declaration
=>
1767 Write_Indent_Str_Sloc
("type ");
1768 Write_Id
(Defining_Identifier
(Node
));
1770 if Present
(Discriminant_Specifications
(Node
)) then
1771 Write_Discr_Specs
(Node
);
1772 elsif Unknown_Discriminants_Present
(Node
) then
1773 Write_Str_With_Col_Check
("(<>)");
1776 Write_Str_With_Col_Check
(" is ");
1777 Sprint_Node
(Formal_Type_Definition
(Node
));
1780 when N_Free_Statement
=>
1781 Write_Indent_Str_Sloc
("free ");
1782 Sprint_Node
(Expression
(Node
));
1785 when N_Freeze_Entity
=>
1786 if Dump_Original_Only
then
1789 elsif Present
(Actions
(Node
)) or else Dump_Freeze_Null
then
1791 Write_Rewrite_Str
("<<<");
1792 Write_Str_With_Col_Check_Sloc
("freeze ");
1793 Write_Id
(Entity
(Node
));
1796 if No
(Actions
(Node
)) then
1800 -- Output freeze actions. We increment Freeze_Indent during
1801 -- this output to avoid generating extra blank lines before
1802 -- any procedures included in the freeze actions.
1804 Freeze_Indent
:= Freeze_Indent
+ 1;
1805 Sprint_Indented_List
(Actions
(Node
));
1806 Freeze_Indent
:= Freeze_Indent
- 1;
1807 Write_Indent_Str
("]");
1810 Write_Rewrite_Str
(">>>");
1813 when N_Full_Type_Declaration
=>
1814 Write_Indent_Str_Sloc
("type ");
1815 Sprint_Node
(Defining_Identifier
(Node
));
1816 Write_Discr_Specs
(Node
);
1817 Write_Str_With_Col_Check
(" is ");
1818 Sprint_Node
(Type_Definition
(Node
));
1821 when N_Function_Call
=>
1823 Write_Subprogram_Name
(Name
(Node
));
1824 Sprint_Opt_Paren_Comma_List
(Parameter_Associations
(Node
));
1826 when N_Function_Instantiation
=>
1827 Write_Indent_Str_Sloc
("function ");
1828 Sprint_Node
(Defining_Unit_Name
(Node
));
1829 Write_Str_With_Col_Check
(" is new ");
1830 Sprint_Node
(Name
(Node
));
1831 Sprint_Opt_Paren_Comma_List
(Generic_Associations
(Node
));
1834 when N_Function_Specification
=>
1835 Write_Str_With_Col_Check_Sloc
("function ");
1836 Sprint_Node
(Defining_Unit_Name
(Node
));
1837 Write_Param_Specs
(Node
);
1838 Write_Str_With_Col_Check
(" return ");
1840 -- Ada 2005 (AI-231)
1842 if Nkind
(Result_Definition
(Node
)) /= N_Access_Definition
1843 and then Null_Exclusion_Present
(Node
)
1845 Write_Str
(" not null ");
1848 Sprint_Node
(Result_Definition
(Node
));
1850 when N_Generic_Association
=>
1853 if Present
(Selector_Name
(Node
)) then
1854 Sprint_Node
(Selector_Name
(Node
));
1858 Sprint_Node
(Explicit_Generic_Actual_Parameter
(Node
));
1860 when N_Generic_Function_Renaming_Declaration
=>
1861 Write_Indent_Str_Sloc
("generic function ");
1862 Sprint_Node
(Defining_Unit_Name
(Node
));
1863 Write_Str_With_Col_Check
(" renames ");
1864 Sprint_Node
(Name
(Node
));
1867 when N_Generic_Package_Declaration
=>
1869 Write_Indent_Str_Sloc
("generic ");
1870 Sprint_Indented_List
(Generic_Formal_Declarations
(Node
));
1872 Sprint_Node
(Specification
(Node
));
1875 when N_Generic_Package_Renaming_Declaration
=>
1876 Write_Indent_Str_Sloc
("generic package ");
1877 Sprint_Node
(Defining_Unit_Name
(Node
));
1878 Write_Str_With_Col_Check
(" renames ");
1879 Sprint_Node
(Name
(Node
));
1882 when N_Generic_Procedure_Renaming_Declaration
=>
1883 Write_Indent_Str_Sloc
("generic procedure ");
1884 Sprint_Node
(Defining_Unit_Name
(Node
));
1885 Write_Str_With_Col_Check
(" renames ");
1886 Sprint_Node
(Name
(Node
));
1889 when N_Generic_Subprogram_Declaration
=>
1891 Write_Indent_Str_Sloc
("generic ");
1892 Sprint_Indented_List
(Generic_Formal_Declarations
(Node
));
1894 Sprint_Node
(Specification
(Node
));
1897 when N_Goto_Statement
=>
1898 Write_Indent_Str_Sloc
("goto ");
1899 Sprint_Node
(Name
(Node
));
1902 if Nkind
(Next
(Node
)) = N_Label
then
1906 when N_Handled_Sequence_Of_Statements
=>
1908 Sprint_Indented_List
(Statements
(Node
));
1910 if Present
(Exception_Handlers
(Node
)) then
1911 Write_Indent_Str
("exception");
1913 Sprint_Node_List
(Exception_Handlers
(Node
));
1917 if Present
(At_End_Proc
(Node
)) then
1918 Write_Indent_Str
("at end");
1921 Sprint_Node
(At_End_Proc
(Node
));
1926 when N_Identifier
=>
1930 when N_If_Statement
=>
1931 Write_Indent_Str_Sloc
("if ");
1932 Sprint_Node
(Condition
(Node
));
1933 Write_Str_With_Col_Check
(" then");
1934 Sprint_Indented_List
(Then_Statements
(Node
));
1935 Sprint_Opt_Node_List
(Elsif_Parts
(Node
));
1937 if Present
(Else_Statements
(Node
)) then
1938 Write_Indent_Str
("else");
1939 Sprint_Indented_List
(Else_Statements
(Node
));
1942 Write_Indent_Str
("end if;");
1944 when N_Implicit_Label_Declaration
=>
1945 if not Dump_Original_Only
then
1947 Write_Rewrite_Str
("<<<");
1949 Write_Id
(Defining_Identifier
(Node
));
1951 Write_Str_With_Col_Check
("label");
1952 Write_Rewrite_Str
(">>>");
1956 Sprint_Left_Opnd
(Node
);
1957 Write_Str_Sloc
(" in ");
1959 if Present
(Right_Opnd
(Node
)) then
1960 Sprint_Right_Opnd
(Node
);
1962 Sprint_Bar_List
(Alternatives
(Node
));
1965 when N_Incomplete_Type_Declaration
=>
1966 Write_Indent_Str_Sloc
("type ");
1967 Write_Id
(Defining_Identifier
(Node
));
1969 if Present
(Discriminant_Specifications
(Node
)) then
1970 Write_Discr_Specs
(Node
);
1971 elsif Unknown_Discriminants_Present
(Node
) then
1972 Write_Str_With_Col_Check
("(<>)");
1977 when N_Index_Or_Discriminant_Constraint
=>
1979 Sprint_Paren_Comma_List
(Constraints
(Node
));
1981 when N_Indexed_Component
=>
1982 Sprint_Node_Sloc
(Prefix
(Node
));
1983 Sprint_Opt_Paren_Comma_List
(Expressions
(Node
));
1985 when N_Integer_Literal
=>
1986 if Print_In_Hex
(Node
) then
1987 Write_Uint_With_Col_Check_Sloc
(Intval
(Node
), Hex
);
1989 Write_Uint_With_Col_Check_Sloc
(Intval
(Node
), Auto
);
1992 when N_Iteration_Scheme
=>
1993 if Present
(Condition
(Node
)) then
1994 Write_Str_With_Col_Check_Sloc
("while ");
1995 Sprint_Node
(Condition
(Node
));
1997 Write_Str_With_Col_Check_Sloc
("for ");
1999 if Present
(Iterator_Specification
(Node
)) then
2000 Sprint_Node
(Iterator_Specification
(Node
));
2002 Sprint_Node
(Loop_Parameter_Specification
(Node
));
2008 when N_Iterator_Specification
=>
2010 Write_Id
(Defining_Identifier
(Node
));
2012 if Present
(Subtype_Indication
(Node
)) then
2013 Write_Str_With_Col_Check
(" : ");
2014 Sprint_Node
(Subtype_Indication
(Node
));
2017 if Of_Present
(Node
) then
2018 Write_Str_With_Col_Check
(" of ");
2020 Write_Str_With_Col_Check
(" in ");
2023 if Reverse_Present
(Node
) then
2024 Write_Str_With_Col_Check
("reverse ");
2027 Sprint_Node
(Name
(Node
));
2029 when N_Itype_Reference
=>
2030 Write_Indent_Str_Sloc
("reference ");
2031 Write_Id
(Itype
(Node
));
2034 Write_Indent_Str_Sloc
("<<");
2035 Write_Id
(Identifier
(Node
));
2038 when N_Loop_Parameter_Specification
=>
2040 Write_Id
(Defining_Identifier
(Node
));
2041 Write_Str_With_Col_Check
(" in ");
2043 if Reverse_Present
(Node
) then
2044 Write_Str_With_Col_Check
("reverse ");
2047 Sprint_Node
(Discrete_Subtype_Definition
(Node
));
2049 when N_Loop_Statement
=>
2052 if Present
(Identifier
(Node
))
2053 and then (not Has_Created_Identifier
(Node
)
2054 or else not Dump_Original_Only
)
2056 Write_Rewrite_Str
("<<<");
2057 Write_Id
(Identifier
(Node
));
2059 Write_Rewrite_Str
(">>>");
2060 Sprint_Node
(Iteration_Scheme
(Node
));
2061 Write_Str_With_Col_Check_Sloc
("loop");
2062 Sprint_Indented_List
(Statements
(Node
));
2063 Write_Indent_Str
("end loop ");
2064 Write_Rewrite_Str
("<<<");
2065 Write_Id
(Identifier
(Node
));
2066 Write_Rewrite_Str
(">>>");
2070 Sprint_Node
(Iteration_Scheme
(Node
));
2071 Write_Str_With_Col_Check_Sloc
("loop");
2072 Sprint_Indented_List
(Statements
(Node
));
2073 Write_Indent_Str
("end loop;");
2076 when N_Mod_Clause
=>
2077 Sprint_Node_List
(Pragmas_Before
(Node
));
2078 Write_Str_With_Col_Check_Sloc
("at mod ");
2079 Sprint_Node
(Expression
(Node
));
2081 when N_Modular_Type_Definition
=>
2082 Write_Str_With_Col_Check_Sloc
("mod ");
2083 Sprint_Node
(Expression
(Node
));
2086 Sprint_Left_Opnd
(Node
);
2087 Write_Str_Sloc
(" not in ");
2089 if Present
(Right_Opnd
(Node
)) then
2090 Sprint_Right_Opnd
(Node
);
2092 Sprint_Bar_List
(Alternatives
(Node
));
2096 Write_Str_With_Col_Check_Sloc
("null");
2098 when N_Null_Statement
=>
2099 if Comes_From_Source
(Node
)
2100 or else Dump_Freeze_Null
2101 or else not Is_List_Member
(Node
)
2102 or else (No
(Prev
(Node
)) and then No
(Next
(Node
)))
2104 Write_Indent_Str_Sloc
("null;");
2107 when N_Number_Declaration
=>
2110 if Write_Indent_Identifiers
(Node
) then
2111 Write_Str_With_Col_Check
(" : constant ");
2113 Sprint_Node
(Expression
(Node
));
2117 when N_Object_Declaration
=>
2120 if Write_Indent_Identifiers
(Node
) then
2122 Def_Id
: constant Entity_Id
:= Defining_Identifier
(Node
);
2125 Write_Str_With_Col_Check
(" : ");
2127 if Is_Statically_Allocated
(Def_Id
) then
2128 Write_Str_With_Col_Check
("static ");
2131 if Aliased_Present
(Node
) then
2132 Write_Str_With_Col_Check
("aliased ");
2135 if Constant_Present
(Node
) then
2136 Write_Str_With_Col_Check
("constant ");
2139 -- Ada 2005 (AI-231)
2141 if Null_Exclusion_Present
(Node
) then
2142 Write_Str_With_Col_Check
("not null ");
2145 Sprint_Node
(Object_Definition
(Node
));
2147 if Present
(Expression
(Node
)) then
2149 Sprint_Node
(Expression
(Node
));
2154 -- Handle implicit importation and implicit exportation of
2155 -- object declarations:
2156 -- $pragma import (Convention_Id, Def_Id, "...");
2157 -- $pragma export (Convention_Id, Def_Id, "...");
2159 if Is_Internal
(Def_Id
)
2160 and then Present
(Interface_Name
(Def_Id
))
2162 Write_Indent_Str_Sloc
("$pragma ");
2164 if Is_Imported
(Def_Id
) then
2165 Write_Str
("import (");
2167 else pragma Assert
(Is_Exported
(Def_Id
));
2168 Write_Str
("export (");
2172 Prefix
: constant String := "Convention_";
2173 S
: constant String := Convention
(Def_Id
)'Img;
2176 Name_Len
:= S
'Last - Prefix
'Last;
2177 Name_Buffer
(1 .. Name_Len
) :=
2178 S
(Prefix
'Last + 1 .. S
'Last);
2179 Set_Casing
(All_Lower_Case
);
2180 Write_Str
(Name_Buffer
(1 .. Name_Len
));
2186 Write_String_Table_Entry
2187 (Strval
(Interface_Name
(Def_Id
)));
2193 when N_Object_Renaming_Declaration
=>
2196 Sprint_Node
(Defining_Identifier
(Node
));
2199 -- Ada 2005 (AI-230): Access renamings
2201 if Present
(Access_Definition
(Node
)) then
2202 Sprint_Node
(Access_Definition
(Node
));
2204 elsif Present
(Subtype_Mark
(Node
)) then
2206 -- Ada 2005 (AI-423): Object renaming with a null exclusion
2208 if Null_Exclusion_Present
(Node
) then
2209 Write_Str
("not null ");
2212 Sprint_Node
(Subtype_Mark
(Node
));
2215 Write_Str
(" ??? ");
2218 Write_Str_With_Col_Check
(" renames ");
2219 Sprint_Node
(Name
(Node
));
2223 Write_Operator
(Node
, "abs ");
2224 Sprint_Right_Opnd
(Node
);
2227 Sprint_Left_Opnd
(Node
);
2228 Write_Operator
(Node
, " + ");
2229 Sprint_Right_Opnd
(Node
);
2232 Sprint_Left_Opnd
(Node
);
2233 Write_Operator
(Node
, " and ");
2234 Sprint_Right_Opnd
(Node
);
2237 Sprint_Left_Opnd
(Node
);
2238 Write_Operator
(Node
, " & ");
2239 Sprint_Right_Opnd
(Node
);
2242 Sprint_Left_Opnd
(Node
);
2244 Process_TFAI_RR_Flags
(Node
);
2245 Write_Operator
(Node
, "/ ");
2246 Sprint_Right_Opnd
(Node
);
2249 Sprint_Left_Opnd
(Node
);
2250 Write_Operator
(Node
, " = ");
2251 Sprint_Right_Opnd
(Node
);
2254 Sprint_Left_Opnd
(Node
);
2255 Write_Operator
(Node
, " ** ");
2256 Sprint_Right_Opnd
(Node
);
2259 Sprint_Left_Opnd
(Node
);
2260 Write_Operator
(Node
, " >= ");
2261 Sprint_Right_Opnd
(Node
);
2264 Sprint_Left_Opnd
(Node
);
2265 Write_Operator
(Node
, " > ");
2266 Sprint_Right_Opnd
(Node
);
2269 Sprint_Left_Opnd
(Node
);
2270 Write_Operator
(Node
, " <= ");
2271 Sprint_Right_Opnd
(Node
);
2274 Sprint_Left_Opnd
(Node
);
2275 Write_Operator
(Node
, " < ");
2276 Sprint_Right_Opnd
(Node
);
2279 Write_Operator
(Node
, "-");
2280 Sprint_Right_Opnd
(Node
);
2283 Sprint_Left_Opnd
(Node
);
2285 if Treat_Fixed_As_Integer
(Node
) then
2289 Write_Operator
(Node
, " mod ");
2290 Sprint_Right_Opnd
(Node
);
2292 when N_Op_Multiply
=>
2293 Sprint_Left_Opnd
(Node
);
2295 Process_TFAI_RR_Flags
(Node
);
2296 Write_Operator
(Node
, "* ");
2297 Sprint_Right_Opnd
(Node
);
2300 Sprint_Left_Opnd
(Node
);
2301 Write_Operator
(Node
, " /= ");
2302 Sprint_Right_Opnd
(Node
);
2305 Write_Operator
(Node
, "not ");
2306 Sprint_Right_Opnd
(Node
);
2309 Sprint_Left_Opnd
(Node
);
2310 Write_Operator
(Node
, " or ");
2311 Sprint_Right_Opnd
(Node
);
2314 Write_Operator
(Node
, "+");
2315 Sprint_Right_Opnd
(Node
);
2318 Sprint_Left_Opnd
(Node
);
2320 if Treat_Fixed_As_Integer
(Node
) then
2324 Write_Operator
(Node
, " rem ");
2325 Sprint_Right_Opnd
(Node
);
2331 Write_Str_With_Col_Check
("(");
2332 Sprint_Node
(Left_Opnd
(Node
));
2334 Sprint_Node
(Right_Opnd
(Node
));
2337 when N_Op_Subtract
=>
2338 Sprint_Left_Opnd
(Node
);
2339 Write_Operator
(Node
, " - ");
2340 Sprint_Right_Opnd
(Node
);
2343 Sprint_Left_Opnd
(Node
);
2344 Write_Operator
(Node
, " xor ");
2345 Sprint_Right_Opnd
(Node
);
2347 when N_Operator_Symbol
=>
2348 Write_Name_With_Col_Check_Sloc
(Chars
(Node
));
2350 when N_Ordinary_Fixed_Point_Definition
=>
2351 Write_Str_With_Col_Check_Sloc
("delta ");
2352 Sprint_Node
(Delta_Expression
(Node
));
2353 Sprint_Opt_Node
(Real_Range_Specification
(Node
));
2356 Sprint_Left_Opnd
(Node
);
2357 Write_Str_Sloc
(" or else ");
2358 Sprint_Right_Opnd
(Node
);
2360 when N_Others_Choice
=>
2361 if All_Others
(Node
) then
2362 Write_Str_With_Col_Check
("all ");
2365 Write_Str_With_Col_Check_Sloc
("others");
2367 when N_Package_Body
=>
2369 Write_Indent_Str_Sloc
("package body ");
2370 Sprint_Node
(Defining_Unit_Name
(Node
));
2372 Sprint_Indented_List
(Declarations
(Node
));
2374 if Present
(Handled_Statement_Sequence
(Node
)) then
2375 Write_Indent_Str
("begin");
2376 Sprint_Node
(Handled_Statement_Sequence
(Node
));
2379 Write_Indent_Str
("end ");
2381 (Handled_Statement_Sequence
(Node
), Defining_Unit_Name
(Node
));
2384 when N_Package_Body_Stub
=>
2385 Write_Indent_Str_Sloc
("package body ");
2386 Sprint_Node
(Defining_Identifier
(Node
));
2387 Write_Str_With_Col_Check
(" is separate;");
2389 when N_Package_Declaration
=>
2392 Sprint_Node_Sloc
(Specification
(Node
));
2395 when N_Package_Instantiation
=>
2397 Write_Indent_Str_Sloc
("package ");
2398 Sprint_Node
(Defining_Unit_Name
(Node
));
2399 Write_Str
(" is new ");
2400 Sprint_Node
(Name
(Node
));
2401 Sprint_Opt_Paren_Comma_List
(Generic_Associations
(Node
));
2404 when N_Package_Renaming_Declaration
=>
2405 Write_Indent_Str_Sloc
("package ");
2406 Sprint_Node
(Defining_Unit_Name
(Node
));
2407 Write_Str_With_Col_Check
(" renames ");
2408 Sprint_Node
(Name
(Node
));
2411 when N_Package_Specification
=>
2412 Write_Str_With_Col_Check_Sloc
("package ");
2413 Sprint_Node
(Defining_Unit_Name
(Node
));
2415 Sprint_Indented_List
(Visible_Declarations
(Node
));
2417 if Present
(Private_Declarations
(Node
)) then
2418 Write_Indent_Str
("private");
2419 Sprint_Indented_List
(Private_Declarations
(Node
));
2422 Write_Indent_Str
("end ");
2423 Sprint_Node
(Defining_Unit_Name
(Node
));
2425 when N_Parameter_Association
=>
2426 Sprint_Node_Sloc
(Selector_Name
(Node
));
2428 Sprint_Node
(Explicit_Actual_Parameter
(Node
));
2430 when N_Parameter_Specification
=>
2433 if Write_Identifiers
(Node
) then
2436 if In_Present
(Node
) then
2437 Write_Str_With_Col_Check
("in ");
2440 if Out_Present
(Node
) then
2441 Write_Str_With_Col_Check
("out ");
2444 -- Ada 2005 (AI-231): Parameter specification may carry null
2445 -- exclusion. Do not print it now if this is an access formal,
2446 -- it is emitted when the access definition is displayed.
2448 if Null_Exclusion_Present
(Node
)
2449 and then Nkind
(Parameter_Type
(Node
))
2450 /= N_Access_Definition
2452 Write_Str
("not null ");
2455 Sprint_Node
(Parameter_Type
(Node
));
2457 if Present
(Expression
(Node
)) then
2459 Sprint_Node
(Expression
(Node
));
2465 when N_Parameterized_Expression
=>
2467 Sprint_Node_Sloc
(Specification
(Node
));
2472 Sprint_Node
(Expression
(Node
));
2476 when N_Pop_Constraint_Error_Label
=>
2477 Write_Indent_Str
("%pop_constraint_error_label");
2479 when N_Pop_Program_Error_Label
=>
2480 Write_Indent_Str
("%pop_program_error_label");
2482 when N_Pop_Storage_Error_Label
=>
2483 Write_Indent_Str
("%pop_storage_error_label");
2485 when N_Private_Extension_Declaration
=>
2486 Write_Indent_Str_Sloc
("type ");
2487 Write_Id
(Defining_Identifier
(Node
));
2489 if Present
(Discriminant_Specifications
(Node
)) then
2490 Write_Discr_Specs
(Node
);
2491 elsif Unknown_Discriminants_Present
(Node
) then
2492 Write_Str_With_Col_Check
("(<>)");
2495 Write_Str_With_Col_Check
(" is new ");
2496 Sprint_Node
(Subtype_Indication
(Node
));
2498 if Present
(Interface_List
(Node
)) then
2499 Write_Str_With_Col_Check
(" and ");
2500 Sprint_And_List
(Interface_List
(Node
));
2503 Write_Str_With_Col_Check
(" with private;");
2505 when N_Private_Type_Declaration
=>
2506 Write_Indent_Str_Sloc
("type ");
2507 Write_Id
(Defining_Identifier
(Node
));
2509 if Present
(Discriminant_Specifications
(Node
)) then
2510 Write_Discr_Specs
(Node
);
2511 elsif Unknown_Discriminants_Present
(Node
) then
2512 Write_Str_With_Col_Check
("(<>)");
2517 if Tagged_Present
(Node
) then
2518 Write_Str_With_Col_Check
("tagged ");
2521 if Limited_Present
(Node
) then
2522 Write_Str_With_Col_Check
("limited ");
2525 Write_Str_With_Col_Check
("private;");
2527 when N_Push_Constraint_Error_Label
=>
2528 Write_Indent_Str
("%push_constraint_error_label (");
2530 if Present
(Exception_Label
(Node
)) then
2531 Write_Name_With_Col_Check
(Chars
(Exception_Label
(Node
)));
2536 when N_Push_Program_Error_Label
=>
2537 Write_Indent_Str
("%push_program_error_label (");
2539 if Present
(Exception_Label
(Node
)) then
2540 Write_Name_With_Col_Check
(Chars
(Exception_Label
(Node
)));
2545 when N_Push_Storage_Error_Label
=>
2546 Write_Indent_Str
("%push_storage_error_label (");
2548 if Present
(Exception_Label
(Node
)) then
2549 Write_Name_With_Col_Check
(Chars
(Exception_Label
(Node
)));
2555 Write_Indent_Str_Sloc
("pragma ");
2556 Write_Name_With_Col_Check
(Pragma_Name
(Node
));
2558 if Present
(Pragma_Argument_Associations
(Node
)) then
2559 Sprint_Opt_Paren_Comma_List
2560 (Pragma_Argument_Associations
(Node
));
2565 when N_Pragma_Argument_Association
=>
2568 if Chars
(Node
) /= No_Name
then
2569 Write_Name_With_Col_Check
(Chars
(Node
));
2573 Sprint_Node
(Expression
(Node
));
2575 when N_Procedure_Call_Statement
=>
2578 Write_Subprogram_Name
(Name
(Node
));
2579 Sprint_Opt_Paren_Comma_List
(Parameter_Associations
(Node
));
2582 when N_Procedure_Instantiation
=>
2583 Write_Indent_Str_Sloc
("procedure ");
2584 Sprint_Node
(Defining_Unit_Name
(Node
));
2585 Write_Str_With_Col_Check
(" is new ");
2586 Sprint_Node
(Name
(Node
));
2587 Sprint_Opt_Paren_Comma_List
(Generic_Associations
(Node
));
2590 when N_Procedure_Specification
=>
2591 Write_Str_With_Col_Check_Sloc
("procedure ");
2592 Sprint_Node
(Defining_Unit_Name
(Node
));
2593 Write_Param_Specs
(Node
);
2595 when N_Protected_Body
=>
2596 Write_Indent_Str_Sloc
("protected body ");
2597 Write_Id
(Defining_Identifier
(Node
));
2599 Sprint_Indented_List
(Declarations
(Node
));
2600 Write_Indent_Str
("end ");
2601 Write_Id
(Defining_Identifier
(Node
));
2604 when N_Protected_Body_Stub
=>
2605 Write_Indent_Str_Sloc
("protected body ");
2606 Write_Id
(Defining_Identifier
(Node
));
2607 Write_Str_With_Col_Check
(" is separate;");
2609 when N_Protected_Definition
=>
2611 Sprint_Indented_List
(Visible_Declarations
(Node
));
2613 if Present
(Private_Declarations
(Node
)) then
2614 Write_Indent_Str
("private");
2615 Sprint_Indented_List
(Private_Declarations
(Node
));
2618 Write_Indent_Str
("end ");
2620 when N_Protected_Type_Declaration
=>
2621 Write_Indent_Str_Sloc
("protected type ");
2622 Sprint_Node
(Defining_Identifier
(Node
));
2623 Write_Discr_Specs
(Node
);
2625 if Present
(Interface_List
(Node
)) then
2626 Write_Str
(" is new ");
2627 Sprint_And_List
(Interface_List
(Node
));
2628 Write_Str
(" with ");
2633 Sprint_Node
(Protected_Definition
(Node
));
2634 Write_Id
(Defining_Identifier
(Node
));
2637 when N_Qualified_Expression
=>
2638 Sprint_Node
(Subtype_Mark
(Node
));
2639 Write_Char_Sloc
(''');
2641 -- Print expression, make sure we have at least one level of
2642 -- parentheses around the expression. For cases of qualified
2643 -- expressions in the source, this is always the case, but
2644 -- for generated qualifications, there may be no explicit
2645 -- parentheses present.
2647 if Paren_Count
(Expression
(Node
)) /= 0 then
2648 Sprint_Node
(Expression
(Node
));
2651 Sprint_Node
(Expression
(Node
));
2655 when N_Quantified_Expression
=>
2658 if All_Present
(Node
) then
2659 Write_Str
(" all ");
2661 Write_Str
(" some ");
2664 Sprint_Node
(Loop_Parameter_Specification
(Node
));
2666 Sprint_Node
(Condition
(Node
));
2668 when N_Raise_Constraint_Error
=>
2670 -- This node can be used either as a subexpression or as a
2671 -- statement form. The following test is a reasonably reliable
2672 -- way to distinguish the two cases.
2674 if Is_List_Member
(Node
)
2675 and then Nkind
(Parent
(Node
)) not in N_Subexpr
2680 Write_Str_With_Col_Check_Sloc
("[constraint_error");
2681 Write_Condition_And_Reason
(Node
);
2683 when N_Raise_Program_Error
=>
2685 -- This node can be used either as a subexpression or as a
2686 -- statement form. The following test is a reasonably reliable
2687 -- way to distinguish the two cases.
2689 if Is_List_Member
(Node
)
2690 and then Nkind
(Parent
(Node
)) not in N_Subexpr
2695 Write_Str_With_Col_Check_Sloc
("[program_error");
2696 Write_Condition_And_Reason
(Node
);
2698 when N_Raise_Storage_Error
=>
2700 -- This node can be used either as a subexpression or as a
2701 -- statement form. The following test is a reasonably reliable
2702 -- way to distinguish the two cases.
2704 if Is_List_Member
(Node
)
2705 and then Nkind
(Parent
(Node
)) not in N_Subexpr
2710 Write_Str_With_Col_Check_Sloc
("[storage_error");
2711 Write_Condition_And_Reason
(Node
);
2713 when N_Raise_Statement
=>
2714 Write_Indent_Str_Sloc
("raise ");
2715 Sprint_Node
(Name
(Node
));
2719 Sprint_Node
(Low_Bound
(Node
));
2720 Write_Str_Sloc
(" .. ");
2721 Sprint_Node
(High_Bound
(Node
));
2722 Update_Itype
(Node
);
2724 when N_Range_Constraint
=>
2725 Write_Str_With_Col_Check_Sloc
("range ");
2726 Sprint_Node
(Range_Expression
(Node
));
2728 when N_Real_Literal
=>
2729 Write_Ureal_With_Col_Check_Sloc
(Realval
(Node
));
2731 when N_Real_Range_Specification
=>
2732 Write_Str_With_Col_Check_Sloc
("range ");
2733 Sprint_Node
(Low_Bound
(Node
));
2735 Sprint_Node
(High_Bound
(Node
));
2737 when N_Record_Definition
=>
2738 if Abstract_Present
(Node
) then
2739 Write_Str_With_Col_Check
("abstract ");
2742 if Tagged_Present
(Node
) then
2743 Write_Str_With_Col_Check
("tagged ");
2746 if Limited_Present
(Node
) then
2747 Write_Str_With_Col_Check
("limited ");
2750 if Null_Present
(Node
) then
2751 Write_Str_With_Col_Check_Sloc
("null record");
2754 Write_Str_With_Col_Check_Sloc
("record");
2755 Sprint_Node
(Component_List
(Node
));
2756 Write_Indent_Str
("end record");
2759 when N_Record_Representation_Clause
=>
2760 Write_Indent_Str_Sloc
("for ");
2761 Sprint_Node
(Identifier
(Node
));
2762 Write_Str_With_Col_Check
(" use record ");
2764 if Present
(Mod_Clause
(Node
)) then
2765 Sprint_Node
(Mod_Clause
(Node
));
2768 Sprint_Indented_List
(Component_Clauses
(Node
));
2769 Write_Indent_Str
("end record;");
2772 Sprint_Node
(Prefix
(Node
));
2773 Write_Str_With_Col_Check_Sloc
("'reference");
2775 when N_Requeue_Statement
=>
2776 Write_Indent_Str_Sloc
("requeue ");
2777 Sprint_Node
(Name
(Node
));
2779 if Abort_Present
(Node
) then
2780 Write_Str_With_Col_Check
(" with abort");
2785 -- Don't we want to print more detail???
2787 -- Doc of this extended syntax belongs in sinfo.ads and/or
2790 when N_SCIL_Dispatch_Table_Tag_Init
=>
2791 Write_Indent_Str
("[N_SCIL_Dispatch_Table_Tag_Init]");
2793 when N_SCIL_Dispatching_Call
=>
2794 Write_Indent_Str
("[N_SCIL_Dispatching_Node]");
2796 when N_SCIL_Membership_Test
=>
2797 Write_Indent_Str
("[N_SCIL_Membership_Test]");
2799 when N_Simple_Return_Statement
=>
2800 if Present
(Expression
(Node
)) then
2801 Write_Indent_Str_Sloc
("return ");
2802 Sprint_Node
(Expression
(Node
));
2805 Write_Indent_Str_Sloc
("return;");
2808 when N_Selective_Accept
=>
2809 Write_Indent_Str_Sloc
("select");
2814 Alt_Node
:= First
(Select_Alternatives
(Node
));
2817 Sprint_Node
(Alt_Node
);
2820 exit when No
(Alt_Node
);
2821 Write_Indent_Str
("or");
2825 if Present
(Else_Statements
(Node
)) then
2826 Write_Indent_Str
("else");
2827 Sprint_Indented_List
(Else_Statements
(Node
));
2830 Write_Indent_Str
("end select;");
2832 when N_Signed_Integer_Type_Definition
=>
2833 Write_Str_With_Col_Check_Sloc
("range ");
2834 Sprint_Node
(Low_Bound
(Node
));
2836 Sprint_Node
(High_Bound
(Node
));
2838 when N_Single_Protected_Declaration
=>
2839 Write_Indent_Str_Sloc
("protected ");
2840 Write_Id
(Defining_Identifier
(Node
));
2842 Sprint_Node
(Protected_Definition
(Node
));
2843 Write_Id
(Defining_Identifier
(Node
));
2846 when N_Single_Task_Declaration
=>
2847 Write_Indent_Str_Sloc
("task ");
2848 Sprint_Node
(Defining_Identifier
(Node
));
2850 if Present
(Task_Definition
(Node
)) then
2852 Sprint_Node
(Task_Definition
(Node
));
2857 when N_Selected_Component
=>
2858 Sprint_Node
(Prefix
(Node
));
2859 Write_Char_Sloc
('.');
2860 Sprint_Node
(Selector_Name
(Node
));
2864 Sprint_Node
(Prefix
(Node
));
2865 Write_Str_With_Col_Check
(" (");
2866 Sprint_Node
(Discrete_Range
(Node
));
2869 when N_String_Literal
=>
2870 if String_Length
(Strval
(Node
)) + Column
> Sprint_Line_Limit
then
2871 Write_Indent_Str
(" ");
2875 Write_String_Table_Entry
(Strval
(Node
));
2877 when N_Subprogram_Body
=>
2879 -- Output extra blank line unless we are in freeze actions
2881 if Freeze_Indent
= 0 then
2887 if Present
(Corresponding_Spec
(Node
)) then
2888 Sprint_Node_Sloc
(Parent
(Corresponding_Spec
(Node
)));
2890 Sprint_Node_Sloc
(Specification
(Node
));
2895 Sprint_Indented_List
(Declarations
(Node
));
2896 Write_Indent_Str
("begin");
2897 Sprint_Node
(Handled_Statement_Sequence
(Node
));
2899 Write_Indent_Str
("end ");
2902 (Handled_Statement_Sequence
(Node
),
2903 Defining_Unit_Name
(Specification
(Node
)));
2906 if Is_List_Member
(Node
)
2907 and then Present
(Next
(Node
))
2908 and then Nkind
(Next
(Node
)) /= N_Subprogram_Body
2913 when N_Subprogram_Body_Stub
=>
2915 Sprint_Node_Sloc
(Specification
(Node
));
2916 Write_Str_With_Col_Check
(" is separate;");
2918 when N_Subprogram_Declaration
=>
2920 Sprint_Node_Sloc
(Specification
(Node
));
2922 if Nkind
(Specification
(Node
)) = N_Procedure_Specification
2923 and then Null_Present
(Specification
(Node
))
2925 Write_Str_With_Col_Check
(" is null");
2930 when N_Subprogram_Info
=>
2931 Sprint_Node
(Identifier
(Node
));
2932 Write_Str_With_Col_Check_Sloc
("'subprogram_info");
2934 when N_Subprogram_Renaming_Declaration
=>
2936 Sprint_Node
(Specification
(Node
));
2937 Write_Str_With_Col_Check_Sloc
(" renames ");
2938 Sprint_Node
(Name
(Node
));
2941 when N_Subtype_Declaration
=>
2942 Write_Indent_Str_Sloc
("subtype ");
2943 Sprint_Node
(Defining_Identifier
(Node
));
2946 -- Ada 2005 (AI-231)
2948 if Null_Exclusion_Present
(Node
) then
2949 Write_Str
("not null ");
2952 Sprint_Node
(Subtype_Indication
(Node
));
2955 when N_Subtype_Indication
=>
2956 Sprint_Node_Sloc
(Subtype_Mark
(Node
));
2958 Sprint_Node
(Constraint
(Node
));
2961 Write_Indent_Str_Sloc
("separate (");
2962 Sprint_Node
(Name
(Node
));
2965 Sprint_Node
(Proper_Body
(Node
));
2968 Write_Indent_Str_Sloc
("task body ");
2969 Write_Id
(Defining_Identifier
(Node
));
2971 Sprint_Indented_List
(Declarations
(Node
));
2972 Write_Indent_Str
("begin");
2973 Sprint_Node
(Handled_Statement_Sequence
(Node
));
2974 Write_Indent_Str
("end ");
2976 (Handled_Statement_Sequence
(Node
), Defining_Identifier
(Node
));
2979 when N_Task_Body_Stub
=>
2980 Write_Indent_Str_Sloc
("task body ");
2981 Write_Id
(Defining_Identifier
(Node
));
2982 Write_Str_With_Col_Check
(" is separate;");
2984 when N_Task_Definition
=>
2986 Sprint_Indented_List
(Visible_Declarations
(Node
));
2988 if Present
(Private_Declarations
(Node
)) then
2989 Write_Indent_Str
("private");
2990 Sprint_Indented_List
(Private_Declarations
(Node
));
2993 Write_Indent_Str
("end ");
2994 Sprint_End_Label
(Node
, Defining_Identifier
(Parent
(Node
)));
2996 when N_Task_Type_Declaration
=>
2997 Write_Indent_Str_Sloc
("task type ");
2998 Sprint_Node
(Defining_Identifier
(Node
));
2999 Write_Discr_Specs
(Node
);
3001 if Present
(Interface_List
(Node
)) then
3002 Write_Str
(" is new ");
3003 Sprint_And_List
(Interface_List
(Node
));
3006 if Present
(Task_Definition
(Node
)) then
3007 if No
(Interface_List
(Node
)) then
3010 Write_Str
(" with ");
3013 Sprint_Node
(Task_Definition
(Node
));
3018 when N_Terminate_Alternative
=>
3019 Sprint_Node_List
(Pragmas_Before
(Node
));
3022 if Present
(Condition
(Node
)) then
3023 Write_Str_With_Col_Check
("when ");
3024 Sprint_Node
(Condition
(Node
));
3028 Write_Str_With_Col_Check_Sloc
("terminate;");
3029 Sprint_Node_List
(Pragmas_After
(Node
));
3031 when N_Timed_Entry_Call
=>
3032 Write_Indent_Str_Sloc
("select");
3034 Sprint_Node
(Entry_Call_Alternative
(Node
));
3036 Write_Indent_Str
("or");
3038 Sprint_Node
(Delay_Alternative
(Node
));
3040 Write_Indent_Str
("end select;");
3042 when N_Triggering_Alternative
=>
3043 Sprint_Node_List
(Pragmas_Before
(Node
));
3044 Sprint_Node_Sloc
(Triggering_Statement
(Node
));
3045 Sprint_Node_List
(Statements
(Node
));
3047 when N_Type_Conversion
=>
3049 Sprint_Node
(Subtype_Mark
(Node
));
3052 if Conversion_OK
(Node
) then
3056 if Float_Truncate
(Node
) then
3060 if Rounded_Result
(Node
) then
3065 Sprint_Node
(Expression
(Node
));
3068 when N_Unchecked_Expression
=>
3071 Sprint_Node_Sloc
(Expression
(Node
));
3074 when N_Unchecked_Type_Conversion
=>
3075 Sprint_Node
(Subtype_Mark
(Node
));
3077 Write_Str_With_Col_Check
("(");
3078 Sprint_Node_Sloc
(Expression
(Node
));
3081 when N_Unconstrained_Array_Definition
=>
3082 Write_Str_With_Col_Check_Sloc
("array (");
3087 Node1
:= First
(Subtype_Marks
(Node
));
3089 Sprint_Node
(Node1
);
3090 Write_Str_With_Col_Check
(" range <>");
3092 exit when Node1
= Empty
;
3097 Write_Str
(") of ");
3098 Sprint_Node
(Component_Definition
(Node
));
3100 when N_Unused_At_Start | N_Unused_At_End
=>
3101 Write_Indent_Str
("***** Error, unused node encountered *****");
3104 when N_Use_Package_Clause
=>
3105 Write_Indent_Str_Sloc
("use ");
3106 Sprint_Comma_List
(Names
(Node
));
3109 when N_Use_Type_Clause
=>
3110 Write_Indent_Str_Sloc
("use type ");
3111 Sprint_Comma_List
(Subtype_Marks
(Node
));
3114 when N_Validate_Unchecked_Conversion
=>
3115 Write_Indent_Str_Sloc
("validate unchecked_conversion (");
3116 Sprint_Node
(Source_Type
(Node
));
3118 Sprint_Node
(Target_Type
(Node
));
3122 Write_Indent_Str_Sloc
("when ");
3123 Sprint_Bar_List
(Discrete_Choices
(Node
));
3125 Sprint_Node
(Component_List
(Node
));
3127 when N_Variant_Part
=>
3129 Write_Indent_Str_Sloc
("case ");
3130 Sprint_Node
(Name
(Node
));
3132 Sprint_Indented_List
(Variants
(Node
));
3133 Write_Indent_Str
("end case");
3136 when N_With_Clause
=>
3138 -- Special test, if we are dumping the original tree only,
3139 -- then we want to eliminate the bogus with clauses that
3140 -- correspond to the non-existent children of Text_IO.
3142 if Dump_Original_Only
3143 and then Is_Text_IO_Kludge_Unit
(Name
(Node
))
3147 -- Normal case, output the with clause
3150 if First_Name
(Node
) or else not Dump_Original_Only
then
3152 -- Ada 2005 (AI-50217): Print limited with_clauses
3154 if Private_Present
(Node
) and Limited_Present
(Node
) then
3155 Write_Indent_Str
("limited private with ");
3157 elsif Private_Present
(Node
) then
3158 Write_Indent_Str
("private with ");
3160 elsif Limited_Present
(Node
) then
3161 Write_Indent_Str
("limited with ");
3164 Write_Indent_Str
("with ");
3171 Sprint_Node_Sloc
(Name
(Node
));
3173 if Last_Name
(Node
) or else not Dump_Original_Only
then
3179 if Has_Aspects
(Node
) then
3180 Sprint_Aspect_Specifications
(Node
);
3183 if Nkind
(Node
) in N_Subexpr
3184 and then Do_Range_Check
(Node
)
3189 for J
in 1 .. Paren_Count
(Node
) loop
3193 Dump_Node
:= Save_Dump_Node
;
3194 end Sprint_Node_Actual
;
3196 ----------------------
3197 -- Sprint_Node_List --
3198 ----------------------
3200 procedure Sprint_Node_List
(List
: List_Id
) is
3204 if Is_Non_Empty_List
(List
) then
3205 Node
:= First
(List
);
3210 exit when Node
= Empty
;
3213 end Sprint_Node_List
;
3215 ----------------------
3216 -- Sprint_Node_Sloc --
3217 ----------------------
3219 procedure Sprint_Node_Sloc
(Node
: Node_Id
) is
3223 if Debug_Generated_Code
and then Present
(Dump_Node
) then
3224 Set_Sloc
(Dump_Node
, Sloc
(Node
));
3227 end Sprint_Node_Sloc
;
3229 ---------------------
3230 -- Sprint_Opt_Node --
3231 ---------------------
3233 procedure Sprint_Opt_Node
(Node
: Node_Id
) is
3235 if Present
(Node
) then
3239 end Sprint_Opt_Node
;
3241 --------------------------
3242 -- Sprint_Opt_Node_List --
3243 --------------------------
3245 procedure Sprint_Opt_Node_List
(List
: List_Id
) is
3247 if Present
(List
) then
3248 Sprint_Node_List
(List
);
3250 end Sprint_Opt_Node_List
;
3252 ---------------------------------
3253 -- Sprint_Opt_Paren_Comma_List --
3254 ---------------------------------
3256 procedure Sprint_Opt_Paren_Comma_List
(List
: List_Id
) is
3258 if Is_Non_Empty_List
(List
) then
3260 Sprint_Paren_Comma_List
(List
);
3262 end Sprint_Opt_Paren_Comma_List
;
3264 -----------------------------
3265 -- Sprint_Paren_Comma_List --
3266 -----------------------------
3268 procedure Sprint_Paren_Comma_List
(List
: List_Id
) is
3270 Node_Exists
: Boolean := False;
3274 if Is_Non_Empty_List
(List
) then
3276 if Dump_Original_Only
then
3278 while Present
(N
) loop
3279 if not Is_Rewrite_Insertion
(N
) then
3280 Node_Exists
:= True;
3287 if not Node_Exists
then
3292 Write_Str_With_Col_Check
("(");
3293 Sprint_Comma_List
(List
);
3296 end Sprint_Paren_Comma_List
;
3298 ----------------------
3299 -- Sprint_Right_Opnd --
3300 ----------------------
3302 procedure Sprint_Right_Opnd
(N
: Node_Id
) is
3303 Opnd
: constant Node_Id
:= Right_Opnd
(N
);
3306 if Paren_Count
(Opnd
) /= 0
3307 or else Op_Prec
(Nkind
(Opnd
)) > Op_Prec
(Nkind
(N
))
3316 end Sprint_Right_Opnd
;
3322 procedure Update_Itype
(Node
: Node_Id
) is
3324 if Present
(Etype
(Node
))
3325 and then Is_Itype
(Etype
(Node
))
3326 and then Debug_Generated_Code
3328 Set_Sloc
(Etype
(Node
), Sloc
(Node
));
3332 ---------------------
3333 -- Write_Char_Sloc --
3334 ---------------------
3336 procedure Write_Char_Sloc
(C
: Character) is
3338 if Debug_Generated_Code
and then C
/= ' ' then
3343 end Write_Char_Sloc
;
3345 --------------------------------
3346 -- Write_Condition_And_Reason --
3347 --------------------------------
3349 procedure Write_Condition_And_Reason
(Node
: Node_Id
) is
3350 Cond
: constant Node_Id
:= Condition
(Node
);
3351 Image
: constant String := RT_Exception_Code
'Image
3352 (RT_Exception_Code
'Val
3353 (UI_To_Int
(Reason
(Node
))));
3356 if Present
(Cond
) then
3358 -- If condition is a single entity, or NOT with a single entity,
3359 -- output all on one line, since it will likely fit just fine.
3361 if Is_Entity_Name
(Cond
)
3362 or else (Nkind
(Cond
) = N_Op_Not
3363 and then Is_Entity_Name
(Right_Opnd
(Cond
)))
3365 Write_Str_With_Col_Check
(" when ");
3369 -- Otherwise for more complex condition, multiple lines
3372 Write_Str_With_Col_Check
(" when");
3373 Indent
:= Indent
+ 2;
3377 Indent
:= Indent
- 2;
3380 -- If no condition, just need a space (all on one line)
3390 for J
in 4 .. Image
'Last loop
3391 if Image
(J
) = '_' then
3394 Write_Char
(Fold_Lower
(Image
(J
)));
3399 end Write_Condition_And_Reason
;
3401 --------------------------------
3402 -- Write_Corresponding_Source --
3403 --------------------------------
3405 procedure Write_Corresponding_Source
(S
: String) is
3407 Src
: Source_Buffer_Ptr
;
3410 -- Ignore if not in dump source text mode, or if in freeze actions
3412 if Dump_Source_Text
and then Freeze_Indent
= 0 then
3414 -- Ignore null string
3420 -- Ignore space or semicolon at end of given string
3422 if S
(S
'Last) = ' ' or else S
(S
'Last) = ';' then
3423 Write_Corresponding_Source
(S
(S
'First .. S
'Last - 1));
3427 -- Loop to look at next lines not yet printed in source file
3430 Last_Line_Printed
+ 1 .. Last_Source_Line
(Current_Source_File
)
3432 Src
:= Source_Text
(Current_Source_File
);
3433 Loc
:= Line_Start
(L
, Current_Source_File
);
3435 -- If comment, keep looking
3437 if Src
(Loc
.. Loc
+ 1) = "--" then
3440 -- Search to first non-blank
3443 while Src
(Loc
) not in Line_Terminator
loop
3447 if Src
(Loc
) /= ' ' and then Src
(Loc
) /= ASCII
.HT
then
3449 -- Loop through characters in string to see if we match
3451 for J
in S
'Range loop
3453 -- If mismatch, then not the case we are looking for
3455 if Src
(Loc
) /= S
(J
) then
3462 -- If we fall through, string matched, if white space or
3463 -- semicolon after the matched string, this is the case
3464 -- we are looking for.
3466 if Src
(Loc
) in Line_Terminator
3467 or else Src
(Loc
) = ' '
3468 or else Src
(Loc
) = ASCII
.HT
3469 or else Src
(Loc
) = ';'
3471 -- So output source lines up to and including this one
3473 Write_Source_Lines
(L
);
3482 -- Line was all blanks, or a comment line, keep looking
3486 end Write_Corresponding_Source
;
3488 -----------------------
3489 -- Write_Discr_Specs --
3490 -----------------------
3492 procedure Write_Discr_Specs
(N
: Node_Id
) is
3497 Specs
:= Discriminant_Specifications
(N
);
3499 if Present
(Specs
) then
3500 Write_Str_With_Col_Check
(" (");
3501 Spec
:= First
(Specs
);
3506 exit when Spec
= Empty
;
3508 -- Add semicolon, unless we are printing original tree and the
3509 -- next specification is part of a list (but not the first
3510 -- element of that list)
3512 if not Dump_Original_Only
or else not Prev_Ids
(Spec
) then
3519 end Write_Discr_Specs
;
3525 procedure Write_Ekind
(E
: Entity_Id
) is
3526 S
: constant String := Entity_Kind
'Image (Ekind
(E
));
3529 Name_Len
:= S
'Length;
3530 Name_Buffer
(1 .. Name_Len
) := S
;
3531 Set_Casing
(Mixed_Case
);
3532 Write_Str_With_Col_Check
(Name_Buffer
(1 .. Name_Len
));
3539 procedure Write_Id
(N
: Node_Id
) is
3541 -- Deal with outputting Itype
3543 -- Note: if we are printing the full tree with -gnatds, then we may
3544 -- end up picking up the Associated_Node link from a generic template
3545 -- here which overlaps the Entity field, but as documented, Write_Itype
3546 -- is defended against junk calls.
3548 if Nkind
(N
) in N_Entity
then
3550 elsif Nkind
(N
) in N_Has_Entity
then
3551 Write_Itype
(Entity
(N
));
3554 -- Case of a defining identifier
3556 if Nkind
(N
) = N_Defining_Identifier
then
3558 -- If defining identifier has an interface name (and no
3559 -- address clause), then we output the interface name.
3561 if (Is_Imported
(N
) or else Is_Exported
(N
))
3562 and then Present
(Interface_Name
(N
))
3563 and then No
(Address_Clause
(N
))
3565 String_To_Name_Buffer
(Strval
(Interface_Name
(N
)));
3566 Write_Str_With_Col_Check
(Name_Buffer
(1 .. Name_Len
));
3568 -- If no interface name (or inactive because there was
3569 -- an address clause), then just output the Chars name.
3572 Write_Name_With_Col_Check
(Chars
(N
));
3575 -- Case of selector of an expanded name where the expanded name
3576 -- has an associated entity, output this entity. Check that the
3577 -- entity or associated node is of the right kind, see above.
3579 elsif Nkind
(Parent
(N
)) = N_Expanded_Name
3580 and then Selector_Name
(Parent
(N
)) = N
3581 and then Present
(Entity_Or_Associated_Node
(Parent
(N
)))
3582 and then Nkind
(Entity
(Parent
(N
))) in N_Entity
3584 Write_Id
(Entity
(Parent
(N
)));
3586 -- For any other node with an associated entity, output it
3588 elsif Nkind
(N
) in N_Has_Entity
3589 and then Present
(Entity_Or_Associated_Node
(N
))
3590 and then Nkind
(Entity_Or_Associated_Node
(N
)) in N_Entity
3592 Write_Id
(Entity
(N
));
3594 -- All other cases, we just print the Chars field
3597 Write_Name_With_Col_Check
(Chars
(N
));
3601 -----------------------
3602 -- Write_Identifiers --
3603 -----------------------
3605 function Write_Identifiers
(Node
: Node_Id
) return Boolean is
3607 Sprint_Node
(Defining_Identifier
(Node
));
3608 Update_Itype
(Defining_Identifier
(Node
));
3610 -- The remainder of the declaration must be printed unless we are
3611 -- printing the original tree and this is not the last identifier
3614 not Dump_Original_Only
or else not More_Ids
(Node
);
3616 end Write_Identifiers
;
3618 ------------------------
3619 -- Write_Implicit_Def --
3620 ------------------------
3622 procedure Write_Implicit_Def
(E
: Entity_Id
) is
3627 when E_Array_Subtype
=>
3628 Write_Str_With_Col_Check
("subtype ");
3630 Write_Str_With_Col_Check
(" is ");
3631 Write_Id
(Base_Type
(E
));
3632 Write_Str_With_Col_Check
(" (");
3634 Ind
:= First_Index
(E
);
3635 while Present
(Ind
) loop
3639 if Present
(Ind
) then
3646 when E_Signed_Integer_Subtype | E_Enumeration_Subtype
=>
3647 Write_Str_With_Col_Check
("subtype ");
3650 Write_Id
(Etype
(E
));
3651 Write_Str_With_Col_Check
(" range ");
3652 Sprint_Node
(Scalar_Range
(E
));
3656 Write_Str_With_Col_Check
("type ");
3658 Write_Str_With_Col_Check
(" is <");
3663 end Write_Implicit_Def
;
3669 procedure Write_Indent
is
3670 Loc
: constant Source_Ptr
:= Sloc
(Dump_Node
);
3673 if Indent_Annull_Flag
then
3674 Indent_Annull_Flag
:= False;
3676 -- Deal with Dump_Source_Text output. Note that we ignore implicit
3677 -- label declarations, since they typically have the sloc of the
3678 -- corresponding label, which really messes up the -gnatL output.
3681 and then Loc
> No_Location
3682 and then Nkind
(Dump_Node
) /= N_Implicit_Label_Declaration
3684 if Get_Source_File_Index
(Loc
) = Current_Source_File
then
3686 (Get_Physical_Line_Number
(Sloc
(Dump_Node
)));
3692 for J
in 1 .. Indent
loop
3698 ------------------------------
3699 -- Write_Indent_Identifiers --
3700 ------------------------------
3702 function Write_Indent_Identifiers
(Node
: Node_Id
) return Boolean is
3704 -- We need to start a new line for every node, except in the case
3705 -- where we are printing the original tree and this is not the first
3706 -- defining identifier in the list.
3708 if not Dump_Original_Only
or else not Prev_Ids
(Node
) then
3711 -- If printing original tree and this is not the first defining
3712 -- identifier in the list, then the previous call to this procedure
3713 -- printed only the name, and we add a comma to separate the names.
3719 Sprint_Node
(Defining_Identifier
(Node
));
3721 -- The remainder of the declaration must be printed unless we are
3722 -- printing the original tree and this is not the last identifier
3725 not Dump_Original_Only
or else not More_Ids
(Node
);
3726 end Write_Indent_Identifiers
;
3728 -----------------------------------
3729 -- Write_Indent_Identifiers_Sloc --
3730 -----------------------------------
3732 function Write_Indent_Identifiers_Sloc
(Node
: Node_Id
) return Boolean is
3734 -- We need to start a new line for every node, except in the case
3735 -- where we are printing the original tree and this is not the first
3736 -- defining identifier in the list.
3738 if not Dump_Original_Only
or else not Prev_Ids
(Node
) then
3741 -- If printing original tree and this is not the first defining
3742 -- identifier in the list, then the previous call to this procedure
3743 -- printed only the name, and we add a comma to separate the names.
3750 Sprint_Node
(Defining_Identifier
(Node
));
3752 -- The remainder of the declaration must be printed unless we are
3753 -- printing the original tree and this is not the last identifier
3755 return not Dump_Original_Only
or else not More_Ids
(Node
);
3756 end Write_Indent_Identifiers_Sloc
;
3758 ----------------------
3759 -- Write_Indent_Str --
3760 ----------------------
3762 procedure Write_Indent_Str
(S
: String) is
3764 Write_Corresponding_Source
(S
);
3767 end Write_Indent_Str
;
3769 ---------------------------
3770 -- Write_Indent_Str_Sloc --
3771 ---------------------------
3773 procedure Write_Indent_Str_Sloc
(S
: String) is
3775 Write_Corresponding_Source
(S
);
3778 end Write_Indent_Str_Sloc
;
3784 procedure Write_Itype
(Typ
: Entity_Id
) is
3786 procedure Write_Header
(T
: Boolean := True);
3787 -- Write type if T is True, subtype if T is false
3793 procedure Write_Header
(T
: Boolean := True) is
3796 Write_Str
("[type ");
3798 Write_Str
("[subtype ");
3801 Write_Name_With_Col_Check
(Chars
(Typ
));
3805 -- Start of processing for Write_Itype
3808 if Nkind
(Typ
) in N_Entity
3809 and then Is_Itype
(Typ
)
3810 and then not Itype_Printed
(Typ
)
3812 -- Itype to be printed
3815 B
: constant Node_Id
:= Etype
(Typ
);
3817 P
: constant Node_Id
:= Parent
(Typ
);
3819 S
: constant Saved_Output_Buffer
:= Save_Output_Buffer
;
3820 -- Save current output buffer
3822 Old_Sloc
: Source_Ptr
;
3823 -- Save sloc of related node, so it is not modified when
3824 -- printing with -gnatD.
3827 -- Write indentation at start of line
3829 for J
in 1 .. Indent
loop
3833 -- If we have a constructed declaration for the itype, print it
3836 and then Nkind
(P
) in N_Declaration
3837 and then Defining_Entity
(P
) = Typ
3839 -- We must set Itype_Printed true before the recursive call to
3840 -- print the node, otherwise we get an infinite recursion!
3842 Set_Itype_Printed
(Typ
, True);
3844 -- Write the declaration enclosed in [], avoiding new line
3845 -- at start of declaration, and semicolon at end.
3847 -- Note: The itype may be imported from another unit, in which
3848 -- case we do not want to modify the Sloc of the declaration.
3849 -- Otherwise the itype may appear to be in the current unit,
3850 -- and the back-end will reject a reference out of scope.
3853 Indent_Annull_Flag
:= True;
3854 Old_Sloc
:= Sloc
(P
);
3856 Set_Sloc
(P
, Old_Sloc
);
3857 Write_Erase_Char
(';');
3859 -- If no constructed declaration, then we have to concoct the
3860 -- source corresponding to the type entity that we have at hand.
3865 -- Access types and subtypes
3868 Write_Header
(Ekind
(Typ
) = E_Access_Type
);
3870 if Can_Never_Be_Null
(Typ
) then
3871 Write_Str
("not null ");
3874 Write_Str
("access ");
3876 if Is_Access_Constant
(Typ
) then
3877 Write_Str
("constant ");
3880 Write_Id
(Directly_Designated_Type
(Typ
));
3882 -- Array types and string types
3884 when E_Array_Type | E_String_Type
=>
3886 Write_Str
("array (");
3888 X
:= First_Index
(Typ
);
3892 if not Is_Constrained
(Typ
) then
3893 Write_Str
(" range <>");
3901 Write_Str
(") of ");
3902 X
:= Component_Type
(Typ
);
3904 -- Preserve sloc of component type, which is defined
3905 -- elsewhere than the itype (see comment above).
3907 Old_Sloc
:= Sloc
(X
);
3909 Set_Sloc
(X
, Old_Sloc
);
3911 -- Array subtypes and string subtypes.
3912 -- Preserve Sloc of index subtypes, as above.
3914 when E_Array_Subtype | E_String_Subtype
=>
3915 Write_Header
(False);
3916 Write_Id
(Etype
(Typ
));
3919 X
:= First_Index
(Typ
);
3921 Old_Sloc
:= Sloc
(X
);
3923 Set_Sloc
(X
, Old_Sloc
);
3931 -- Signed integer types, and modular integer subtypes,
3932 -- and also enumeration subtypes.
3934 when E_Signed_Integer_Type |
3935 E_Signed_Integer_Subtype |
3936 E_Modular_Integer_Subtype |
3937 E_Enumeration_Subtype
=>
3939 Write_Header
(Ekind
(Typ
) = E_Signed_Integer_Type
);
3941 if Ekind
(Typ
) = E_Signed_Integer_Type
then
3947 -- Print bounds if different from base type
3950 L
: constant Node_Id
:= Type_Low_Bound
(Typ
);
3951 H
: constant Node_Id
:= Type_High_Bound
(Typ
);
3956 -- B can either be a scalar type, in which case the
3957 -- declaration of Typ may constrain it with different
3958 -- bounds, or a private type, in which case we know
3959 -- that the declaration of Typ cannot have a scalar
3962 if Is_Scalar_Type
(B
) then
3963 LE
:= Type_Low_Bound
(B
);
3964 HE
:= Type_High_Bound
(B
);
3972 and then Nkind
(L
) = N_Integer_Literal
3973 and then Nkind
(H
) = N_Integer_Literal
3974 and then Nkind
(LE
) = N_Integer_Literal
3975 and then Nkind
(HE
) = N_Integer_Literal
3976 and then UI_Eq
(Intval
(L
), Intval
(LE
))
3977 and then UI_Eq
(Intval
(H
), Intval
(HE
)))
3982 Write_Str
(" range ");
3983 Sprint_Node
(Type_Low_Bound
(Typ
));
3985 Sprint_Node
(Type_High_Bound
(Typ
));
3989 -- Modular integer types
3991 when E_Modular_Integer_Type
=>
3993 Write_Str
(" mod ");
3994 Write_Uint_With_Col_Check
(Modulus
(Typ
), Auto
);
3996 -- Floating point types and subtypes
3998 when E_Floating_Point_Type |
3999 E_Floating_Point_Subtype
=>
4001 Write_Header
(Ekind
(Typ
) = E_Floating_Point_Type
);
4003 if Ekind
(Typ
) = E_Floating_Point_Type
then
4007 Write_Id
(Etype
(Typ
));
4009 if Digits_Value
(Typ
) /= Digits_Value
(Etype
(Typ
)) then
4010 Write_Str
(" digits ");
4011 Write_Uint_With_Col_Check
4012 (Digits_Value
(Typ
), Decimal
);
4015 -- Print bounds if not different from base type
4018 L
: constant Node_Id
:= Type_Low_Bound
(Typ
);
4019 H
: constant Node_Id
:= Type_High_Bound
(Typ
);
4020 LE
: constant Node_Id
:= Type_Low_Bound
(B
);
4021 HE
: constant Node_Id
:= Type_High_Bound
(B
);
4024 if Nkind
(L
) = N_Real_Literal
4025 and then Nkind
(H
) = N_Real_Literal
4026 and then Nkind
(LE
) = N_Real_Literal
4027 and then Nkind
(HE
) = N_Real_Literal
4028 and then UR_Eq
(Realval
(L
), Realval
(LE
))
4029 and then UR_Eq
(Realval
(H
), Realval
(HE
))
4034 Write_Str
(" range ");
4035 Sprint_Node
(Type_Low_Bound
(Typ
));
4037 Sprint_Node
(Type_High_Bound
(Typ
));
4043 when E_Record_Subtype
=>
4044 Write_Header
(False);
4045 Write_Str
("record");
4051 C
:= First_Entity
(Typ
);
4052 while Present
(C
) loop
4056 Write_Id
(Etype
(C
));
4062 Write_Indent_Str
(" end record");
4066 when E_Class_Wide_Type |
4067 E_Class_Wide_Subtype
=>
4069 Write_Name_With_Col_Check
(Chars
(Etype
(Typ
)));
4070 Write_Str
("'Class");
4074 when E_Subprogram_Type
=>
4077 if Etype
(Typ
) = Standard_Void_Type
then
4078 Write_Str
("procedure");
4080 Write_Str
("function");
4083 if Present
(First_Entity
(Typ
)) then
4090 Param
:= First_Entity
(Typ
);
4095 if Ekind
(Param
) = E_In_Out_Parameter
then
4096 Write_Str
("in out ");
4097 elsif Ekind
(Param
) = E_Out_Parameter
then
4101 Write_Id
(Etype
(Param
));
4102 Next_Entity
(Param
);
4103 exit when No
(Param
);
4111 if Etype
(Typ
) /= Standard_Void_Type
then
4112 Write_Str
(" return ");
4113 Write_Id
(Etype
(Typ
));
4116 when E_String_Literal_Subtype
=>
4118 LB
: constant Uint
:=
4119 Expr_Value
(String_Literal_Low_Bound
(Typ
));
4120 Len
: constant Uint
:=
4121 String_Literal_Length
(Typ
);
4123 Write_Str
("String (");
4124 Write_Int
(UI_To_Int
(LB
));
4126 Write_Int
(UI_To_Int
(LB
+ Len
) - 1);
4130 -- For all other Itypes, print ??? (fill in later)
4133 Write_Header
(True);
4139 -- Add terminating bracket and restore output buffer
4143 Restore_Output_Buffer
(S
);
4146 Set_Itype_Printed
(Typ
);
4150 -------------------------------
4151 -- Write_Name_With_Col_Check --
4152 -------------------------------
4154 procedure Write_Name_With_Col_Check
(N
: Name_Id
) is
4160 Get_Name_String
(N
);
4162 -- Deal with -gnatdI which replaces any sequence Cnnnb where C is an
4163 -- upper case letter, nnn is one or more digits and b is a lower case
4164 -- letter by C...b, so that listings do not depend on serial numbers.
4166 if Debug_Flag_II
then
4168 while J
< Name_Len
- 1 loop
4169 if Name_Buffer
(J
) in 'A' .. 'Z'
4170 and then Name_Buffer
(J
+ 1) in '0' .. '9'
4173 while K
< Name_Len
loop
4174 exit when Name_Buffer
(K
) not in '0' .. '9';
4178 if Name_Buffer
(K
) in 'a' .. 'z' then
4179 L
:= Name_Len
- K
+ 1;
4181 Name_Buffer
(J
+ 4 .. J
+ L
+ 3) :=
4182 Name_Buffer
(K
.. Name_Len
);
4183 Name_Buffer
(J
+ 1 .. J
+ 3) := "...";
4184 Name_Len
:= J
+ L
+ 3;
4197 -- Fall through for normal case
4199 Write_Str_With_Col_Check
(Name_Buffer
(1 .. Name_Len
));
4200 end Write_Name_With_Col_Check
;
4202 ------------------------------------
4203 -- Write_Name_With_Col_Check_Sloc --
4204 ------------------------------------
4206 procedure Write_Name_With_Col_Check_Sloc
(N
: Name_Id
) is
4208 Get_Name_String
(N
);
4209 Write_Str_With_Col_Check_Sloc
(Name_Buffer
(1 .. Name_Len
));
4210 end Write_Name_With_Col_Check_Sloc
;
4212 --------------------
4213 -- Write_Operator --
4214 --------------------
4216 procedure Write_Operator
(N
: Node_Id
; S
: String) is
4217 F
: Natural := S
'First;
4218 T
: Natural := S
'Last;
4221 -- If no overflow check, just write string out, and we are done
4223 if not Do_Overflow_Check
(N
) then
4226 -- If overflow check, we want to surround the operator with curly
4227 -- brackets, but not include spaces within the brackets.
4240 Write_Str_Sloc
(S
(F
.. T
));
4243 if S
(S
'Last) = ' ' then
4249 -----------------------
4250 -- Write_Param_Specs --
4251 -----------------------
4253 procedure Write_Param_Specs
(N
: Node_Id
) is
4259 Specs
:= Parameter_Specifications
(N
);
4261 if Is_Non_Empty_List
(Specs
) then
4262 Write_Str_With_Col_Check
(" (");
4263 Spec
:= First
(Specs
);
4267 Formal
:= Defining_Identifier
(Spec
);
4269 exit when Spec
= Empty
;
4271 -- Add semicolon, unless we are printing original tree and the
4272 -- next specification is part of a list (but not the first element
4275 if not Dump_Original_Only
or else not Prev_Ids
(Spec
) then
4280 -- Write out any extra formals
4282 while Present
(Extra_Formal
(Formal
)) loop
4283 Formal
:= Extra_Formal
(Formal
);
4285 Write_Name_With_Col_Check
(Chars
(Formal
));
4287 Write_Name_With_Col_Check
(Chars
(Etype
(Formal
)));
4292 end Write_Param_Specs
;
4294 -----------------------
4295 -- Write_Rewrite_Str --
4296 -----------------------
4298 procedure Write_Rewrite_Str
(S
: String) is
4300 if not Dump_Generated_Only
then
4301 if S
'Length = 3 and then S
= ">>>" then
4304 Write_Str_With_Col_Check
(S
);
4307 end Write_Rewrite_Str
;
4309 -----------------------
4310 -- Write_Source_Line --
4311 -----------------------
4313 procedure Write_Source_Line
(L
: Physical_Line_Number
) is
4315 Src
: Source_Buffer_Ptr
;
4319 if Dump_Source_Text
then
4320 Src
:= Source_Text
(Current_Source_File
);
4321 Loc
:= Line_Start
(L
, Current_Source_File
);
4324 -- See if line is a comment line, if not, and if not line one,
4325 -- precede with blank line.
4328 while Src
(Scn
) = ' ' or else Src
(Scn
) = ASCII
.HT
loop
4332 if (Src
(Scn
) in Line_Terminator
4333 or else Src
(Scn
.. Scn
+ 1) /= "--")
4339 -- Now write the source text of the line
4342 Write_Int
(Int
(L
));
4345 while Src
(Loc
) not in Line_Terminator
loop
4346 Write_Char
(Src
(Loc
));
4350 end Write_Source_Line
;
4352 ------------------------
4353 -- Write_Source_Lines --
4354 ------------------------
4356 procedure Write_Source_Lines
(L
: Physical_Line_Number
) is
4358 while Last_Line_Printed
< L
loop
4359 Last_Line_Printed
:= Last_Line_Printed
+ 1;
4360 Write_Source_Line
(Last_Line_Printed
);
4362 end Write_Source_Lines
;
4364 --------------------
4365 -- Write_Str_Sloc --
4366 --------------------
4368 procedure Write_Str_Sloc
(S
: String) is
4370 for J
in S
'Range loop
4371 Write_Char_Sloc
(S
(J
));
4375 ------------------------------
4376 -- Write_Str_With_Col_Check --
4377 ------------------------------
4379 procedure Write_Str_With_Col_Check
(S
: String) is
4381 if Int
(S
'Last) + Column
> Sprint_Line_Limit
then
4382 Write_Indent_Str
(" ");
4384 if S
(S
'First) = ' ' then
4385 Write_Str
(S
(S
'First + 1 .. S
'Last));
4393 end Write_Str_With_Col_Check
;
4395 -----------------------------------
4396 -- Write_Str_With_Col_Check_Sloc --
4397 -----------------------------------
4399 procedure Write_Str_With_Col_Check_Sloc
(S
: String) is
4401 if Int
(S
'Last) + Column
> Sprint_Line_Limit
then
4402 Write_Indent_Str
(" ");
4404 if S
(S
'First) = ' ' then
4405 Write_Str_Sloc
(S
(S
'First + 1 .. S
'Last));
4413 end Write_Str_With_Col_Check_Sloc
;
4415 ---------------------------
4416 -- Write_Subprogram_Name --
4417 ---------------------------
4419 procedure Write_Subprogram_Name
(N
: Node_Id
) is
4421 if not Comes_From_Source
(N
)
4422 and then Is_Entity_Name
(N
)
4425 Ent
: constant Entity_Id
:= Entity
(N
);
4427 if not In_Extended_Main_Source_Unit
(Ent
)
4429 Is_Predefined_File_Name
4430 (Unit_File_Name
(Get_Source_Unit
(Ent
)))
4432 -- Run-time routine name, output name with a preceding dollar
4433 -- making sure that we do not get a line split between them.
4435 Col_Check
(Length_Of_Name
(Chars
(Ent
)) + 1);
4437 Write_Name
(Chars
(Ent
));
4443 -- Normal case, not a run-time routine name
4446 end Write_Subprogram_Name
;
4448 -------------------------------
4449 -- Write_Uint_With_Col_Check --
4450 -------------------------------
4452 procedure Write_Uint_With_Col_Check
(U
: Uint
; Format
: UI_Format
) is
4454 Col_Check
(UI_Decimal_Digits_Hi
(U
));
4455 UI_Write
(U
, Format
);
4456 end Write_Uint_With_Col_Check
;
4458 ------------------------------------
4459 -- Write_Uint_With_Col_Check_Sloc --
4460 ------------------------------------
4462 procedure Write_Uint_With_Col_Check_Sloc
(U
: Uint
; Format
: UI_Format
) is
4464 Col_Check
(UI_Decimal_Digits_Hi
(U
));
4466 UI_Write
(U
, Format
);
4467 end Write_Uint_With_Col_Check_Sloc
;
4469 -------------------------------------
4470 -- Write_Ureal_With_Col_Check_Sloc --
4471 -------------------------------------
4473 procedure Write_Ureal_With_Col_Check_Sloc
(U
: Ureal
) is
4474 D
: constant Uint
:= Denominator
(U
);
4475 N
: constant Uint
:= Numerator
(U
);
4477 Col_Check
(UI_Decimal_Digits_Hi
(D
) + UI_Decimal_Digits_Hi
(N
) + 4);
4479 UR_Write
(U
, Brackets
=> True);
4480 end Write_Ureal_With_Col_Check_Sloc
;