This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tested on i686-linux, committed on trunk
When Before_LM and Before_LM_PM are both set on entry in Skip_Line, we
reset the Before_LM_PM marker prior to taking it into account in the page
count (which is incorrect because if Before_LM_PM is set, then we know that
Before_LM is also set). We need to defer the reset of Before_LM_PM until
it has been taken into account (which means that within Skip_Line there
is a section of code during which the invariant (Before_LM_PM =>
Before_LM) is transiently violated, which is fine as long as it is
always restored prior to exiting that procedure).
The program below must produce the following ouput:
Page number 2
Line number 2
[Page 1][Line 1]Line 1.<EoL>
[Page 1][Line 2]Line 2.<EoL>
[Page 1][Line 3]Line 3.<EoL><EoP>
[Page 2][Line 1]<EoF>
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_IO is
F: File_Type;
C: Character;
E: Boolean := True;
begin
Create (F, Mode => Out_File);
Put_Line (F, "Line 1.");
Put_Line (F, "Line 2.");
Put_Line (F, "Line 3.");
Set_Line (F, 2);
Put_Line ("Page number" & Count'Image (Page (F)));
Put_Line ("Line number" & Count'Image (Line (F)));
Reset (F, Mode => In_File);
loop
if E then
Put ("[Page" & Count'Image (Page (F)) & "][Line" & Count'Image (Line (F)) & ']');
end if;
if End_of_File (F) then
Put_Line ("<EoF>");
exit;
end if;
if End_of_Line (F) then
Put ("<EoL>");
end if;
if End_of_Page (F) then
Put ("<EoP>");
end if;
if End_of_Line (F) then
New_Line;
end if;
Look_Ahead (F, C, E);
if E then
Skip_Line (F);
else
Get (F, C);
Put (C);
end if;
end loop;
end Test_IO;
2007-06-06 Thomas Quinot <quinot@adacore.com>
* a-textio.ads, a-textio.adb (Write): Add explicit size clause for the
C imported variable.
(Skip_Line): Do not reset Before_LM_PM immediately when Before_LM is set
on entry.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |