|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 6364 (0x18dc)
Types: TextFile
Names: »B«
└─⟦afbc8121e⟧ Bits:30000532 8mm tape, Rational 1000, MC68020_OS2000 7_2_2
└─⟦77aa8350c⟧ »DATA«
└─⟦f794ecd1d⟧
└─⟦4c85d69e2⟧
└─⟦this⟧
-- The use of this system is subject to the software license terms and
-- conditions agreed upon between Rational and the Customer.
--
-- Copyright 1988 by Rational.
--
-- RESTRICTED RIGHTS LEGEND
--
-- Use, duplication, or disclosure by the Government is subject to
-- restrictions as set forth in subdivision (b)(3)(ii) of the Rights in
-- Technical Data and Computer Software clause at 52.227-7013.
--
--
-- Rational
-- 3320 Scott Boulevard
-- Santa Clara, California 95054-3197
--
-- PROPRIETARY AND CONFIDENTIAL INFORMATION OF RATIONAL;
-- USE OR COPYING WITHOUT EXPRESS WRITTEN AUTHORIZATION
-- IS STRICTLY PROHIBITED. THIS MATERIAL IS PROTECTED AS
-- AN UNPUBLISHED WORK UNDER THE U.S. COPYRIGHT ACT OF
-- 1976. CREATED 1988. ALL RIGHTS RESERVED.
--
--
with Primitive_Io; -- For debugging only
with Io_Parameters;
pragma Elaborate (Io_Parameters);
separate (Common_Text_Io)
procedure Fill_Buffer (File : File_Type;
S : in out Input_State;
B : in out Buffering.Data_Buffer;
Undo_Eof : Boolean := False) is
Slide_Amount : Integer;
Count : Natural;
Line_Terminator_Detected : Boolean;
Line_Last_Data_Index : Natural;
Line_Terminator_Present : Boolean;
Empty_Buffer : constant Boolean := Buffering.Is_Empty (B);
Use_Block_Moves : Boolean renames Io_Parameters.Use_Block_Moves;
-- procedure Pput (S : in String;
-- Absorb_Output : Boolean :=
-- Primitive_Io.Global_Absorb_Output)
-- renames Primitive_Io.Put_Line;
begin
-- Pput ("Cti.Fill_Buffer, Empty_Buffer = " & Boolean'Image (Empty_Buffer));
case S.Eof_Encountered is
when False =>
if Buffering.Is_Full (B) then
return;
end if;
when True =>
-- Pput ("Cti.Fill_Buffer has Eof_Encountered on entry");
return; -- there are no characters to get
when Simulated_False =>
-- EOF has already happened, but we are pretending that is
-- hasn't
-- Pput ("Cti.Fill_Buffer has Simulated_False Eof on entry");
if Undo_Eof then
null; -- Imagine that we get the EOF and then put it back.
else
-- Do Normal EOF processing
S.Eof_Encountered := True;
New_Page (S);
end if;
return;
end case;
-- Make all possible room in the buffer.
Slide_Amount := B.Tail - 1;
if Empty_Buffer then
Buffering.Clear (B);
else
Buffering.Slide (B);
end if;
-- Adjust line start for amount of slide
S.Line_Start := S.Line_Start - Slide_Amount;
-- Pput ("Cti.Fill_Buffer buffer after sliding");
-- Buffering.Display_Buffer (B);
begin
-- Pput ("Cti.Fill_Buffer calling Dio.Read");
Dio.Read (File => File,
Item => B.Buffer (B.Head + 1 .. B.Max_Length),
Count => Count,
Line_Terminator_Detected => Line_Terminator_Detected,
Line_Last_Data_Index => Line_Last_Data_Index,
Line_Terminator_Present => Line_Terminator_Present,
Already_Locked => True);
exception
when End_Error =>
-- Pput ("Cti.Fill_Buffer has End_Error after Dio.Read; Undo_Eof = " &
-- Boolean'Image (Undo_Eof));
if Undo_Eof or else not Empty_Buffer then
S.Eof_Encountered := Simulated_False;
else
-- Do Normal EOF processing
S.Eof_Encountered := True;
New_Page (S);
end if;
return;
when others =>
-- Pput ("Cti.Fill_Buffer has some exception after Dio.Read");
raise;
end;
-- Pput ("Cti.Fill_Buffer has" & Integer'Image (Count) &
-- " bytes, Line_Terminator_Detected = " &
-- Boolean'Image (Line_Terminator_Detected));
-- Pput (" Line_Terminator_Present = " &
-- Boolean'Image (Line_Terminator_Present) &
-- ", line_last_data_index =" & Integer'Image (Line_Last_Data_Index));
-- This version of Fill_Buffer will put a Line_Terminator at the
-- end of every line.
if Line_Terminator_Detected then
Buffering.Bump (B, Count);
-- We will insert Line_Terminators into the buffer where
-- needed, but will take care to preserve the notion that
-- a Page_Terminator is also a Line_Terminator.
if not Line_Terminator_Present then
if Buffering.Is_Empty (B) or else
Buffering.Peek_At_Last (B) /= Page_Terminator then
-- Pput ("Cti.Fill_Buffer adding Line_Terminator");
Buffering.Stuff (B, Line_Terminator);
end if;
end if;
S.Eob_Is_Eol := Empty_Buffer and Use_Block_Moves;
-- Buffering.Display_Buffer (B);
else
-- If we didn't find a line terminator, then we assert that
-- we have at least one character.
if Count = 0 then
raise Use_Error;
end if;
Buffering.Bump (B, Count);
-- Buffering.Display_Buffer (B);
-- for I in B.Tail .. B.Head loop
-- Pput ("Have character " & Buffering.To_Character (B.Buffer (I)));
-- end loop;
S.Eob_Is_Eol := False;
end if;
-- Pput ("Cti.Fill_Buffer Eob_Is_Eol = " & Boolean'Image (S.Eob_Is_Eol));
-- Pput (" Line_Start =" & Integer'Image (S.Line_Start));
exception
when Constraint_Error =>
-- Pput ("Cti.Fill_Buffer has Constraint_Error");
raise Iof.Input_Value_Error;
when Numeric_Error =>
-- Pput ("Cti.Fill_Buffer has Numeric_Error");
raise Iof.Input_Value_Error;
when Use_Error | Data_Error | Layout_Error | Status_Error =>
-- Pput ("Cti.Fill_Buffer has Use_, Data_, Layout_, or Status_Error");
raise;
when others =>
-- Pput
-- ("Cti.Fill_Buffer: Some exception raised, reflecting Device_Error");
raise Device_Error;
end Fill_Buffer;