DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦ad608e978⟧ TextFile

    Length: 3230 (0xc9e)
    Types: TextFile
    Names: »B«

Derivation

└─⟦afbc8121e⟧ Bits:30000532 8mm tape, Rational 1000, MC68020_OS2000 7_2_2
    └─ ⟦77aa8350c⟧ »DATA« 
        └─⟦f794ecd1d⟧ 
            └─⟦4c85d69e2⟧ 
                └─⟦this⟧ 

TextFile

--    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 Flush (File : File_Type; Clear_Terminators : Boolean := True) is

    Mode : File_Mode;
    So   : Access_Output_State;
    Si   : Access_Input_State;

    -- procedure Pput (S : in String) renames Primitive_Io.Put_Line;


    procedure Eliminate_Terminator (B          : in out Buffering.Data_Buffer;
                                    Terminator : in     Character) is
        C : constant Character := Buffering.Peek_At_Last (B);
    begin
        if C = Terminator then
            Buffering.Unbump (B);
        end if;
    end Eliminate_Terminator;

begin

    State_Handling.Get_File_State (File, Mode, Si, So);
    if Mode /= Out_File then
        return;
    end if;

    -- Interactive output happened without buffering.
    if Dio.Is_Interactive (File) then
        if not So.Line_Terminated then
            Dio.Write (File, Line_Terminator_Bs,
                       Line_Terminator_Present => True);
            So.Line_Terminated := True;
        end if;
        return;
    end if;

    declare
        B : Buffering.Data_Buffer := Dio.Get (File);
    begin

        if Buffering.Is_Empty (B) then
            return;
        end if;

        -- If the very last character(s) of the file is a terminator,
        -- eliminate it when Clear_Terminators is True.  But if
        -- Clear_Terminators is false, then add a Line_Terminator if needed.

        if Clear_Terminators then
            Eliminate_Terminator (B, Line_Terminator);
            if not Buffering.Is_Empty (B) then
                Eliminate_Terminator (B, Page_Terminator);
            elsif So.Line_Terminated then
                Buffering.Stuff (B, Line_Terminator);
            end if;
            Dio.Write (File, B.Buffer (B.Tail .. B.Head),
                       Line_Terminator_Present => False,
                       Already_Locked          => True);
        else
            if not So.Line_Terminated then
                Buffering.Stuff (B, Line_Terminator);
            end if;
            Dio.Write (File, B.Buffer (B.Tail .. B.Head),
                       Line_Terminator_Present => True,
                       Already_Locked          => True);
        end if;
    end;

exception
    when Constraint_Error | Numeric_Error =>
        raise Iof.Output_Value_Error;
end Flush;