raw
vtools_vpatch_new...    1 package body Character_IO is
vtools_vpatch_new... 2 LM: constant Character := ASCII.LF;
vtools_vpatch_new... 3
vtools_vpatch_new... 4 procedure Get_Line(File : in Character_IO.File_Type;
vtools_vpatch_new... 5 Item : out String;
vtools_vpatch_new... 6 Last : out Natural;
vtools_vpatch_new... 7 New_Line : out Boolean) is
vtools_vpatch_new... 8 C: Character;
vtools_vpatch_new... 9 begin
vtools_vpatch_new... 10 New_Line := False;
vtools_vpatch_new... 11 Last := Item'First - 1;
vtools_vpatch_new... 12 if Last >= Item'Last then
vtools_vpatch_new... 13 return;
vtools_vpatch_new... 14 end if;
vtools_vpatch_new... 15 if Character_IO.End_Of_File(File) then
vtools_vpatch_new... 16 raise Character_IO.End_Error;
vtools_vpatch_new... 17 end if;
vtools_vpatch_new... 18 loop
vtools_vpatch_new... 19 Character_IO.Read(File, C);
vtools_vpatch_new... 20 if C = LM then
vtools_vpatch_new... 21 New_Line := True;
vtools_vpatch_new... 22 return;
vtools_vpatch_new... 23 end if;
vtools_vpatch_new... 24 Last := Last + 1;
vtools_vpatch_new... 25 Item(Last) := C;
vtools_vpatch_new... 26 if Last = Item'Last then
vtools_vpatch_new... 27 return;
vtools_vpatch_new... 28 end if;
vtools_vpatch_new... 29 exit when Character_IO.End_Of_File(File);
vtools_vpatch_new... 30 end loop;
vtools_vpatch_new... 31 end;
vtools_vpatch_new... 32
vtools_vpatch_new... 33 function Get_Line (File : Character_IO.File_Type;
vtools_vpatch_new... 34 New_Line : out Boolean) return String is
vtools_vpatch_new... 35 Buffer : String (1 .. 500);
vtools_vpatch_new... 36 Last : Natural;
vtools_vpatch_new... 37
vtools_vpatch_new... 38 function Get_Rest (S : String) return String is
vtools_vpatch_new... 39 Buffer : String (1 .. S'Length);
vtools_vpatch_new... 40 Last : Natural;
vtools_vpatch_new... 41 begin
vtools_vpatch_new... 42 Get_Line (File, Buffer, Last, New_Line);
vtools_vpatch_new... 43 declare
vtools_vpatch_new... 44 R : constant String := S & Buffer (1 .. Last);
vtools_vpatch_new... 45 begin
vtools_vpatch_new... 46 if Last < Buffer'Last then
vtools_vpatch_new... 47 return R;
vtools_vpatch_new... 48 else
vtools_vpatch_new... 49 return Get_Rest (R);
vtools_vpatch_new... 50 end if;
vtools_vpatch_new... 51 end;
vtools_vpatch_new... 52 end Get_Rest;
vtools_vpatch_new... 53
vtools_vpatch_new... 54 begin
vtools_vpatch_new... 55 Get_Line (File, Buffer, Last, New_Line);
vtools_vpatch_new... 56
vtools_vpatch_new... 57 if Last < Buffer'Last then
vtools_vpatch_new... 58 return Buffer (1 .. Last);
vtools_vpatch_new... 59 else
vtools_vpatch_new... 60 return Get_Rest (Buffer (1 .. Last));
vtools_vpatch_new... 61 end if;
vtools_vpatch_new... 62 end Get_Line;
vtools_vpatch_new... 63
vtools_vpatch_new... 64 function Get_Line(File : in Character_IO.File_Type) return String is
vtools_vpatch_new... 65 New_Line : Boolean;
vtools_vpatch_new... 66 begin
vtools_vpatch_new... 67 return Get_Line(File, New_Line);
vtools_vpatch_new... 68 end Get_Line;
vtools_vpatch_new... 69
vtools_vpatch_new... 70 procedure Put_Line(File : in Character_IO.File_Type;
vtools_vpatch_new... 71 Item : in String;
vtools_vpatch_new... 72 New_Line : Boolean := True) is
vtools_vpatch_new... 73 begin
vtools_vpatch_new... 74 for C of Item loop
vtools_vpatch_new... 75 Character_IO.Write(File, C);
vtools_vpatch_new... 76 end loop;
vtools_vpatch_new... 77 if New_Line then
vtools_vpatch_new... 78 Character_IO.Write(File, LM);
vtools_vpatch_new... 79 end if;
vtools_vpatch_new... 80 end;
vtools_vpatch_new... 81 end;