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 - downloadIndex: ┃ B T ┃
Length: 8222 (0x201e) 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 separate (Common_Text_Io) procedure Get_A_Line (File : in File_Type; S : in out Input_State; Item : out String; Last : out Natural; Skip_Terminators : in Boolean; End_Of_Line : out Boolean; End_Of_Page : out Boolean; End_Of_File : out Boolean) is C : Character; Item_Pos : Integer; Item_First : constant Integer := Item'First; Item_Last : constant Integer := Item'Last; Item_Length : constant Integer := Item'Length; B : Buffering.Data_Buffer := Dio.Get (File); -- procedure Pput (S : in String; -- Absorb_Output : Boolean := -- Primitive_Io.Global_Absorb_Output) -- renames Primitive_Io.Put_Line; begin --if not Primitive_Io.Absorb_Output then -- Pput ("Cti.Get_A_Line, Skip_Terminators = " & -- Boolean'Image (Skip_Terminators)); --end if; -- Set the out parameters to the expected case for most calls -- adjust for Item too short or appropriate terminator End_Of_Line := True; End_Of_Page := False; End_Of_File := False; -- Get rid of do-nothing case if Item'Length = 0 then -- Pput ("Cti.Get_A_Line do-nothing case"); End_Of_Line := False; Last := Item'First - 1; return; end if; -- Make sure there is some stuff in the buffer to start with Next_Buffer (File, S, B); --if not Primitive_Io.Absorb_Output then -- Pput ("Cti.Get_A_Line have stuff in the buffer"); -- Pput ("Cti.Get_A_Line S.Eob_Is_Eol = " & Boolean'Image (S.Eob_Is_Eol)); --end if; -- Try the "block copy" case first if S.Eob_Is_Eol then -- Have exactly one line in the buffer -- Pput ("Cti.Get_A_Line have exactly one line in the buffer"); declare -- Don't count the line terminator, which is present Left : constant Natural := Buffering.Left (B) - 1; begin if Item_Length < Left then -- Item can't hold entire line -- Pput ("Cti.Get_A_Line item can't hold entire line"); Buffering.Next (B, Item); Last := Item'Last; End_Of_Line := False; return; else -- Item can hold the entire line -- Pput ("Cti.Get_A_Line item can hold the entire line"); Buffering.Next (B, Item (Item_First .. Item_First + Left - 1)); Item_Pos := Item_First + Left - 1; end if; end; else -- Pput ("Cti.Get_A_Line don't have exactly one line in the buffer"); Item_Pos := Item_First - 1; end if; -- Here, Item_Pos is the index of the last location already filled -- (if any) while Item_Pos < Item_Last loop --if not Primitive_Io.Absorb_Output then --Pput ("Cti.Get_A_Line still filling the buffer, Item_Pos =" & -- Integer'Image (Item_Pos) & ", Item_Last =" & -- Integer'Image (Item_Last)); --end if; if Buffering.Is_Empty (B) then if S.Eof_Encountered = True then -- Since EOF_Encountered = True BEFORE the call to -- Fill_Buffer, some other operation has consumed the -- simulated line terminator, and we are bumping into the -- simulated file terminator. Thus, we raise End_Error. -- (Note that we are allowing ourselves to be fooled by -- Simulated_False here.) raise End_Error; end if; Fill_Buffer (File, S, B); if S.Eof_Encountered = True then -- We have just seen EOF_Encountered change from False to -- True, so we are the first to bump into the end of the -- file. We let the simulated line terminator terminate -- the string we are reading. This is the end of a line, -- page, and file. Last := Item_Pos; End_Of_Page := True; End_Of_File := True; return; end if; end if; -- Pput ("Cti.Get_A_Line peeking at next character"); C := Buffering.Peek (B); -- Pput ("Cti.Get_A_Line peek at next " & Character'Image (C)); -- for I in B.Tail .. B.Head loop -- Pput ("Cti.Get_A_Line buffer is " & -- Integer'Image (Integer (B.Buffer (I)))); -- end loop; case C is when Line_Terminator => if Skip_Terminators then -- Pput ("Cti.Get_A_Line skipping Line_Terminator"); Buffering.Consume (B, 1); New_Line (S); else -- Don't skip the line_terminator -- Pput ("Cti.Get_A_Line ignoring a Line_Terminator"); null; end if; Last := Item_Pos; return; when Page_Terminator => if Skip_Terminators then -- Pput ("Cti.Get_A_Line skipping Page_Terminator"); Buffering.Consume (B, 1); C := Buffering.Peek (B); if C = Line_Terminator then Buffering.Consume (B, 1); -- else --Pput -- ("Cti.Get_A_Line - Page Term with no Line Term"); end if; End_Of_Page := True; New_Page (S); else -- Don't skip the page_terminator -- Pput ("Cti.Get_A_Line ignoring a Page_Terminator"); null; end if; Last := Item_Pos; return; when others => -- if not Primitive_Io.Absorb_Output then -- Pput ("Cti.Get_A_Line racking up a '" & C & '''); -- end if; Buffering.Consume (B, 1); Item_Pos := Item_Pos + 1; Item (Item_Pos) := C; end case; end loop; -- If control comes here, we have filled the user's string -- completely before bumping into a terminator. -- Pput ("Cti.Get_A_Line filled user's string before finding terminator"); Last := Item_Pos; End_Of_Line := False; -- If the terminators are supposed to be skipped, and the -- next character is a terminator, then we skip it now. -- (Reason: It makes TEXT_IO work better when reading -- a string of fixed length lines into a string of the -- same length.) -- Unfortunately, what with CE3604A and AI-00050, we aren't allowed -- to do this. If the user supplies a buffer of exactly the right -- size he is obliged to call Skip_Line himself after every call to -- Get_Line to fill it. -- One question: What should End_Of_Line, etc. be here? Answer: -- Unreliable. end Get_A_Line;