Commit 077f6c59 by Robert Dewar Committed by Arnaud Charlet

xtreeprs.adb, xnmake.adb: Use Stream_IO instead of Text_IO to guarantee Unix…

xtreeprs.adb, xnmake.adb: Use Stream_IO instead of Text_IO to guarantee Unix style line terminators for...

2005-03-29  Robert Dewar  <dewar@adacore.com>

	* xtreeprs.adb, xnmake.adb: Use Stream_IO instead of Text_IO to
	guarantee Unix style line terminators for the output files, even when
	running on windows.

From-SVN: r97187
parent a6de8e21
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -53,6 +53,7 @@ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; ...@@ -53,6 +53,7 @@ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO;
with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Spitbol; use GNAT.Spitbol; with GNAT.Spitbol; use GNAT.Spitbol;
...@@ -76,7 +77,6 @@ procedure XNmake is ...@@ -76,7 +77,6 @@ procedure XNmake is
Synonym : VString := Nul; Synonym : VString := Nul;
X : VString := Nul; X : VString := Nul;
Lineno : Natural;
NWidth : Natural; NWidth : Natural;
FileS : VString := V ("nmake.ads"); FileS : VString := V ("nmake.ads");
...@@ -86,10 +86,12 @@ procedure XNmake is ...@@ -86,10 +86,12 @@ procedure XNmake is
Given_File : VString := Nul; Given_File : VString := Nul;
-- File name given by command line argument -- File name given by command line argument
InS, InT : File_Type; subtype Sfile is Ada.Streams.Stream_IO.File_Type;
OutS, OutB : File_Type;
wsp : Pattern := Span (' ' & ASCII.HT); InS, InT : Ada.Text_IO.File_Type;
OutS, OutB : Sfile;
wsp : Pattern := Span (' ' & ASCII.HT);
Body_Only : Pattern := BreakX (' ') * X & Span (' ') & "-- body only"; Body_Only : Pattern := BreakX (' ') * X & Span (' ') & "-- body only";
Spec_Only : Pattern := BreakX (' ') * X & Span (' ') & "-- spec only"; Spec_Only : Pattern := BreakX (' ') * X & Span (' ') & "-- spec only";
...@@ -130,6 +132,10 @@ procedure XNmake is ...@@ -130,6 +132,10 @@ procedure XNmake is
V_Elist_Id : constant VString := V ("Elist_Id"); V_Elist_Id : constant VString := V ("Elist_Id");
V_Boolean : constant VString := V ("Boolean"); V_Boolean : constant VString := V ("Boolean");
procedure Put_Line (F : Sfile; S : String);
procedure Put_Line (F : Sfile; S : VString);
-- Local version of Put_Line ensures Unix style line endings
procedure WriteS (S : String); procedure WriteS (S : String);
procedure WriteB (S : String); procedure WriteB (S : String);
procedure WriteBS (S : String); procedure WriteBS (S : String);
...@@ -188,10 +194,20 @@ procedure XNmake is ...@@ -188,10 +194,20 @@ procedure XNmake is
end if; end if;
end WriteS; end WriteS;
procedure Put_Line (F : Sfile; S : String) is
begin
String'Write (Stream (F), S);
Character'Write (Stream (F), ASCII.LF);
end Put_Line;
procedure Put_Line (F : Sfile; S : VString) is
begin
Put_Line (F, To_String (S));
end Put_Line;
-- Start of processing for XNmake -- Start of processing for XNmake
begin begin
Lineno := 0;
NWidth := 28; NWidth := 28;
Anchored_Mode := True; Anchored_Mode := True;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -45,6 +45,7 @@ with Ada.Command_Line; use Ada.Command_Line; ...@@ -45,6 +45,7 @@ with Ada.Command_Line; use Ada.Command_Line;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO; with Ada.Strings.Unbounded.Text_IO; use Ada.Strings.Unbounded.Text_IO;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Text_IO; use Ada.Text_IO;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with GNAT.Spitbol; use GNAT.Spitbol; with GNAT.Spitbol; use GNAT.Spitbol;
with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns; with GNAT.Spitbol.Patterns; use GNAT.Spitbol.Patterns;
...@@ -75,13 +76,15 @@ procedure XTreeprs is ...@@ -75,13 +76,15 @@ procedure XTreeprs is
Synonym : VString := Nul; Synonym : VString := Nul;
Term : VString := Nul; Term : VString := Nul;
OutS : File_Type; subtype Sfile is Ada.Streams.Stream_IO.File_Type;
OutS : Sfile;
-- Output file -- Output file
InS : File_Type; InS : Ada.Text_IO.File_Type;
-- Read sinfo.ads -- Read sinfo.ads
InT : File_Type; InT : Ada.Text_IO.File_Type;
-- Read treeprs.adt -- Read treeprs.adt
Special : TB.Table (20); Special : TB.Table (20);
...@@ -137,6 +140,23 @@ procedure XTreeprs is ...@@ -137,6 +140,23 @@ procedure XTreeprs is
M : Match_Result; M : Match_Result;
procedure Put_Line (F : Sfile; S : String);
procedure Put_Line (F : Sfile; S : VString);
-- Local version of Put_Line ensures Unix style line endings
procedure Put_Line (F : Sfile; S : String) is
begin
String'Write (Stream (F), S);
Character'Write (Stream (F), ASCII.LF);
end Put_Line;
procedure Put_Line (F : Sfile; S : VString) is
begin
Put_Line (F, To_String (S));
end Put_Line;
-- Start of processing for XTreeprs
begin begin
Anchored_Mode := True; Anchored_Mode := True;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment