From 187a44ec3e8ad404b63aca7fc343f011698ab2d5 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 17 Apr 2009 12:11:04 +0000 Subject: 2009-04-17 Bob Duff * output.ads (Indent,Outdent): New procedures for indenting the output. (Write_Char): Correct comment -- LF _is_ allowed. * output.adb (Indent,Outdent): New procedures for indenting the output. Keep track of the indentation level, and make sure it doesn't get too high. (Flush_Buffer): Insert spaces at the beginning of each line, if indentation level is nonzero. (Save_Output_Buffer,Restore_Output_Buffer): Save and restore the current indentation level. (Set_Standard_Error,Set_Standard_Output): Remove superfluous "Next_Col := 1;". Flush_Buffer does that. * sem_ch6.adb, sem_ch7.adb (Debug_Flag_C): Reorganize the output controlled by the -gnatdc switch. It now occurs on entry/exit to the relevant analysis routines, and calls Indent/Outdent to make the indentation reflect the nesting level. Add "helper" routines, since otherwise lots of "return;" statements would skip the debugging output. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146253 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/output.ads | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'gcc/ada/output.ads') diff --git a/gcc/ada/output.ads b/gcc/ada/output.ads index 559112cc94f..2bb38fc8fa4 100644 --- a/gcc/ada/output.ads +++ b/gcc/ada/output.ads @@ -81,9 +81,17 @@ package Output is -- has been cancelled. Output to standard output is the default mode -- before any call to either of the Set procedures. + procedure Indent; + -- Increases the current indentation level. Whenever a line is written + -- (triggered by Eol), an appropriate amount of whitespace is added to the + -- beginning of the line, wrapping around if it gets to long. + + procedure Outdent; + -- Decreases the current indentation level. + procedure Write_Char (C : Character); - -- Write one character to the standard output file. Note that the - -- character should not be LF or CR (use Write_Eol for end of line) + -- Write one character to the standard output file. If the character is LF, + -- this is equivalent to Write_Eol. procedure Write_Erase_Char (C : Character); -- If last character in buffer matches C, erase it, otherwise no effect @@ -177,7 +185,7 @@ private -- subprograms defined in this package, and cannot be directly modified or -- accessed by a client. - Buffer : String (1 .. Buffer_Max + 1); + Buffer : String (1 .. Buffer_Max + 1) := (others => '*'); for Buffer'Alignment use 4; -- Buffer used to build output line. We do line buffering because it -- is needed for the support of the debug-generated-code option (-gnatD). @@ -194,6 +202,7 @@ private type Saved_Output_Buffer is record Buffer : String (1 .. Buffer_Max + 1); Next_Col : Positive; + Cur_Indentation : Natural; end record; end Output; -- cgit v1.2.1