lace.text.forge: Rid <CR> in line terminators.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
with
|
with
|
||||||
ada.Characters.latin_1,
|
ada.Characters.latin_1,
|
||||||
ada.Strings.unbounded,
|
ada.Directories,
|
||||||
|
ada.Direct_IO,
|
||||||
ada.Text_IO;
|
ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
@@ -12,27 +13,35 @@ is
|
|||||||
|
|
||||||
function to_String (Filename : in forge.Filename) return String
|
function to_String (Filename : in forge.Filename) return String
|
||||||
is
|
is
|
||||||
use ada.Strings.unbounded,
|
use ada.Characters,
|
||||||
ada.Text_IO;
|
ada.Directories;
|
||||||
|
|
||||||
the_File : ada.Text_IO.File_type;
|
Length : constant Natural := Natural (Size (String (Filename)));
|
||||||
Pad : unbounded_String;
|
|
||||||
|
subtype sized_String is String (1 .. Length);
|
||||||
|
|
||||||
|
package my_IO is new ada.Direct_IO (sized_String);
|
||||||
|
use my_IO;
|
||||||
|
|
||||||
|
the_File : my_IO.File_type;
|
||||||
|
Pad : sized_String;
|
||||||
|
Result : sized_String;
|
||||||
|
i : Natural := 0;
|
||||||
begin
|
begin
|
||||||
open (the_File, in_File, String (Filename));
|
open (the_File, in_File, String (Filename));
|
||||||
|
read (the_File, Pad);
|
||||||
while not end_of_File (the_File)
|
|
||||||
loop
|
|
||||||
declare
|
|
||||||
use ada.Characters;
|
|
||||||
Line : constant String := get_Line (the_File);
|
|
||||||
begin
|
|
||||||
append (Pad, Line & latin_1.LF);
|
|
||||||
end;
|
|
||||||
end loop;
|
|
||||||
|
|
||||||
close (the_File);
|
close (the_File);
|
||||||
|
|
||||||
return to_String (Pad);
|
for Each of Pad
|
||||||
|
loop
|
||||||
|
if Each /= latin_1.CR
|
||||||
|
then
|
||||||
|
i := i + 1;
|
||||||
|
Result (i) := Each;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
return Result (1 .. i);
|
||||||
end to_String;
|
end to_String;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user