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

⟦31513941c⟧ TextFile

    Length: 4321 (0x10e1)
    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 Open (File : in out File_Type;
                Mode :        File_Mode := Out_File;
                Name :        String;
                Form :        String    := "") is

    Dio_Mode           : Dio.File_Mode;
    Kind               : Dio.File_Kind;
    Actual_Buffer_Size : Natural;
    New_File           : File_Type := File;

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

begin
    Standard_Files.Check_If_Current_Compatible_Mode (File, Mode);

    -- if Name /= "" then   -- and why not??
    if Name'Length /= 0 then
        Kind := Dio.Normal;
    else
        Kind := Dio.Temporary;
    end if;

    begin
        Dio.Open (New_File, Convert (Mode), Kind, Name, Form,
                  Default_Buffer_Size, Actual_Buffer_Size, Dio.Text_Io);
        Standard_Files.Check_If_Reassociating_Current
           (Old_File => File, New_File => New_File);
        File := New_File;
    exception
        when Status_Error =>
            -- As far as DIO is concerned, the file is open.  See if the file
            -- has been opened by Text_Io.
            Standard_Files.Check_If_Reassociating_Current
               (Old_File => File, New_File => New_File);
            File := New_File;

            Dio_Mode := Dio.Mode (File);
            if Dio_Mode = Dio.In_File then
                if State_Handling.Iget (File) /= null then
                    raise Iof.Already_Open_Error;
                    -- the file was already opened by text_io;
                elsif Mode /= In_File then
                    raise Iof.Illegal_Operation_On_Infile;
                    -- Text_IO and DIO do not agree on the mode
                end if;
            elsif Dio_Mode = Dio.Out_File then
                if State_Handling.Oget (File) /= null then
                    raise Iof.Already_Open_Error;
                    -- The file was already opened by Text_Io.
                elsif Mode /= Out_File then
                    raise Iof.Illegal_Operation_On_Outfile;
                    -- Text_Io and DIO do not agree on the mode
                end if;
            else
                -- File is opened under DIO but the mode is Inout_File
                -- (Mode DIO.Closed is excluded here, obviously)
                if Mode = In_File then
                    raise Iof.Illegal_Operation_On_Infile;
                else
                    raise Iof.Illegal_Operation_On_Outfile;
                end if;
            end if;
        when others =>
            -- Name_Error, Device_Error, etc.
            raise;
    end;

    begin
        Dio.Acquire (File);
        State_Handling.Allocate_State (File, Mode);
    exception
        when others =>
            Dio.Release (File);
            raise;
    end;

    -- Make sure file-sharing regulations are met.
    declare
        Oin, Oout, Oinout : Natural;
    begin
        -- Pput ("Cti.Open testing identical for " & Name);
        Dio.Identical_Files (File, Oin, Oout, Oinout);
        if (Mode = In_File and (Oout > 0 or Oinout > 0)) or
           (Mode = Out_File and (Oin > 0 or Oout > 1 or Oinout > 0)) then
            -- Pput ("Cti.Open have identical disallowed");
            Dio.Release (File);
            Close (File);
            raise Iox.Use_Error;
        end if;
        -- Pput ("Cti.Open no identical disallowed");
        Dio.Release (File);
    end;

end Open;