|
|
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: T V
Length: 16630 (0x40f6)
Types: TextFile
Names: »V«
└─⟦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 Buffering;
with Io_Exceptions;
with System;
with System_Types;
package Device_Independent_Io is
-- Device_Independent_IO is designed to provide a uniform method of
-- accessing sequential devices, including files, terminals, windows,
-- printers, and tape drives. Its clients are expected to be Text_IO and
-- Sequential_IO, though there may be others.
-- The assumption is made that devices deal in bytes or characters rather
-- than elemental types.
-- The File_Type is a pointer to a File_Descriptor (thus it has
-- an implicit initialization to null)
type File_Type is private;
Null_File : constant File_Type;
-- The File_Mode tells what kind of operations may be performed
-- on a file. Each protocol package implements its own File_Mode,
-- not every protocol package implements all of the modes listed
-- below.
type File_Mode is (Closed,
In_File,
Inout_File,
Out_File);
-- Most files are of File_Kind = Normal, the other cases are usually
-- treated specially by the operating system.
type File_Kind is (Normal,
Temporary,
Standard_Input,
Standard_Output,
Standard_Error);
-- Used to indicate the client service to certain calls, such
-- as Open, so that services can be customized according to
-- available Os2000 features.
type Client_Kind is new Natural;
Unknown : constant Client_Kind := 0;
Text_Io : constant Client_Kind := 1;
subtype Byte is System_Types.Byte;
subtype Byte_String is System_Types.Byte_String;
----------------------------------------------------------------------
-- Before any of the routines of this package can be used,
-- the caller must grab an exclusive lock on the file. The Acquire
-- may cause the calling task to be suspended, if the lock is already
-- acquired. Don't acquire the lock twice in the same task! There is
-- no maximum time limit on waiting to acquire the lock, so don't keep
-- it too long or you'll interfere with other tasks. Acquire and
-- Release can even be called on a closed file (and closing the file
-- or deleting it doesn't release the lock!).
--
-- Remember to release it (even if an exception is raised!)
--
-- If you do Acquire/Release then use the defaulting version of
-- the routines below.
--
procedure Acquire (File : File_Type);
procedure Release (File : File_Type);
----------------------------------------------------------------------
-- Is_Open can be called without acquiring the exclusive lock on the
-- file, but if it returns true the file isn't guaranteed to remain
-- open unless you already had the lock.
function Is_Open (File : File_Type) return Boolean;
-- The following procedure is used to Open a file in a device
-- independent way. If File_Mode = Closed then this procedure
-- only checks to see that a file of the given Name can be
-- opened with the given Mode and Kind and Form. If so, it
-- returns with File still closed, but if not then it will
-- raise Name_Error or Use_Error. The protocol can suggest
-- a buffer size to be used, but the operating system implementation
-- can override the suggested size if necessary. A recommended size
-- of 0 means no buffering is to be done, an actual size of 0 means
-- that no buffer will be done.
procedure Open (File : in out File_Type;
Mode : in File_Mode;
Kind : in File_Kind;
Name : in String := "";
Form : in String := "";
Recommended_Buffer_Size : in Natural;
Actual_Buffer_Size : out Natural;
Client : in Client_Kind := Unknown);
-- The following procedure is used to Open a file positioned at
-- the end of the file in a device independent way. This routine
-- might not be available for some (or most or all) files, depending
-- on the operating system. Mode must not be Closed. It is not
-- defined what happens if Kind is Standard_Input or Standard_Output.
-- See the corresponding procedure Open for Recommended_Buffer_Size
-- and Actual_Buffer_Size.
-- This procedure might not be implemented on some operating systems.
procedure Append (File : in out File_Type;
Mode : in File_Mode;
Kind : in File_Kind;
Name : in String := "";
Form : in String := "";
Recommended_Buffer_Size : in Natural;
Actual_Buffer_Size : out Natural);
-- The following procedure is used to Create a file in a device
-- independent way. If the operating system allows multiple versions
-- of files, and the Name does not specify a specific version, then
-- a new version will be created if possible. Mode must not be closed.
-- It is not defined what happens if Kind is Standard_Input or
-- Standard_Output. See the corresponding procedure Open for
-- Recommended_Buffer_Size and Actual_Buffer_Size.
procedure Create (File : in out File_Type;
Mode : in File_Mode;
Kind : in File_Kind;
Name : in String := "";
Form : in String := "";
Recommended_Buffer_Size : in Natural;
Actual_Buffer_Size : out Natural);
procedure Close (File : in out File_Type;
Already_Locked : Boolean := True);
procedure Delete (File : in out File_Type;
Already_Locked : Boolean := True);
procedure Reset (File : in out File_Type;
Mode : File_Mode;
Already_Locked : Boolean := True);
procedure Reset (File : in out File_Type;
Already_Locked : Boolean := True);
-- This routine will "save" the current contents of the file, but leave
-- it open. On some operating systems, this means simply flushing
-- the buffers. On the R1000, Immediate_Effect means to not wait
-- until the pending action is committed.
procedure Save (File : File_Type;
Immediate_Effect : Boolean := True;
Already_Locked : Boolean := True);
function Mode (File : File_Type;
Already_Locked : Boolean := True) return File_Mode;
function Name (File : File_Type;
Already_Locked : Boolean := True) return String;
function Form (File : File_Type;
Already_Locked : Boolean := True) return String;
function Kind (File : File_Type;
Already_Locked : Boolean := True) return File_Kind;
-- If Buffer_Size returns 0 then no buffer is allocated for the file.
function Buffer_Size (File : File_Type;
Already_Locked : Boolean := True) return Natural;
-- If Get returns null then no buffer is allocated for the file.
function Get (File : File_Type) return Buffering.Data_Buffer;
-- This is used to set the file's buffer. Should only be used by
-- the operating system specific package, but if that package doesn't
-- set it then the protocol package can.
procedure Set (File : File_Type; Buffer : Buffering.Data_Buffer);
function End_Of_File (File : File_Type;
Already_Locked : Boolean := True) return Boolean;
-- This routine will try to return data in units of one record or
-- more (if there is buffer space); but is never forced to return
-- more than one record even if the buffer space is available.
-- If Line_Terminator_Detected is true then Line_Last_Data_Index
-- will be the index in Item of the last data byte of the line read
-- and Line_Terminator_Present will be true if the next character
-- after that is a line terminator and false if the line terminator
-- is not represented in Item. This is the preferred way of reading
-- a text file, as it may be possible on some operating systems to
-- detect line terminators without scanning the line character by
-- character. The exact definition of the line terminator is
-- operating system dependent.
procedure Read (File : in File_Type;
Item : in out Byte_String;
Count : out Natural;
Line_Terminator_Detected : out Boolean;
Line_Last_Data_Index : out Natural;
Line_Terminator_Present : out Boolean;
Already_Locked : Boolean := True);
procedure Read (File : File_Type;
Item : in out Byte_String;
Count : out Natural;
Already_Locked : Boolean := True);
-- Protocols should write in units of one record; for a text file
-- a record is one line. If Line_Terminator_Present is true
-- then the last byte of the Item is a line terminator. If
-- Line_Terminator_Present is false then the line terminator is
-- not represented in the data but is implicit after the last
-- byte of the data.
procedure Write (File : in File_Type;
Item : in Byte_String;
Line_Terminator_Present : in Boolean;
Already_Locked : Boolean := True);
-- The user-visible function that determines whether or not a file
-- is interactive.
function Is_Interactive (File : File_Type;
Already_Locked : Boolean := True) return Boolean;
-- Determine if the file has any contents
function Is_Empty (File : File_Type;
Already_Locked : Boolean := True) return Boolean;
-- Constant object representing a closed input, output and error files
function Closed_Input_File return File_Type;
function Closed_Output_File return File_Type;
function Closed_Error_File return File_Type;
-- Close all files for clean program termination
procedure Close_All_Open_Files;
-- For debugging purposes
procedure List_All_Open_Files;
generic
type Derived_File_Type is limited private;
-- Only works for types derived from Device_Independent_Io.File_Type
--CC pragma Must_Be_Constrained (Derived_File_Type);
package File_Type_Conversions is
function From_Standard (File : File_Type) return Derived_File_Type;
function To_Standard (File : Derived_File_Type) return File_Type;
private
pragma Inline (From_Standard, To_Standard);
pragma Suppress (Elaboration_Check, On => From_Standard);
pragma Suppress (Elaboration_Check, On => To_Standard);
end File_Type_Conversions;
generic
type Control_Block is limited private;
type Pointer is access Control_Block;
package Client_Specific is
procedure Set (File : File_Type; Control : Pointer);
function Get (File : File_Type) return Pointer;
private
pragma Inline (Get, Set);
pragma Suppress (Elaboration_Check, On => Set);
pragma Suppress (Elaboration_Check, On => Get);
end Client_Specific;
-- ** The original R1000 interface included a generic interface
-- ** for protocols to use to store a pointer to a protocol
-- ** specific control block in the general file descriptor.
-- ** However, problems with the cross-compiler temporary force
-- ** the use of a simpler interface which relys on the caller
-- ** to do the unchecked conversions between System.Address and
-- ** a pointer to the control block. The use of these functions
-- ** should be phased out.
procedure Set (File : File_Type; Control : System.Address);
function Get (File : File_Type) return System.Address;
-- ** Get the associated OS dependent control block for a file. This
-- ** would be better done via a generic, like the client_specific ops,
-- ** but until the cross_compiler problems have been fixed, this will
-- ** work.
function Get_Os_Dependent_Control (File : File_Type) return System.Address;
-- Checking for Identical External Files
procedure Identical_Files (File : in File_Type;
Open_In : out Natural;
Open_Out : out Natural;
Open_In_Out : out Natural);
-- Exceptions
Status_Error : exception renames Io_Exceptions.Status_Error;
Mode_Error : exception renames Io_Exceptions.Mode_Error;
Name_Error : exception renames Io_Exceptions.Name_Error;
Use_Error : exception renames Io_Exceptions.Use_Error;
Device_Error : exception renames Io_Exceptions.Device_Error;
End_Error : exception renames Io_Exceptions.End_Error;
Data_Error : exception renames Io_Exceptions.Data_Error;
private
type File_Descriptor;
type File_Type is access File_Descriptor;
Null_File : constant File_Type := null;
pragma Inline (Acquire, Release, Is_Open, Get, Set);
pragma Suppress (Elaboration_Check, On => Acquire);
pragma Suppress (Elaboration_Check, On => Release);
pragma Suppress (Elaboration_Check, On => Is_Open);
pragma Suppress (Elaboration_Check, On => Open);
pragma Suppress (Elaboration_Check, On => Append);
pragma Suppress (Elaboration_Check, On => Create);
pragma Suppress (Elaboration_Check, On => Close);
pragma Suppress (Elaboration_Check, On => Delete);
pragma Suppress (Elaboration_Check, On => Reset);
pragma Suppress (Elaboration_Check, On => Save);
pragma Suppress (Elaboration_Check, On => Mode);
pragma Suppress (Elaboration_Check, On => Name);
pragma Suppress (Elaboration_Check, On => Form);
pragma Suppress (Elaboration_Check, On => Kind);
pragma Suppress (Elaboration_Check, On => Buffer_Size);
pragma Suppress (Elaboration_Check, On => Get);
pragma Suppress (Elaboration_Check, On => Set);
pragma Suppress (Elaboration_Check, On => End_Of_File);
pragma Suppress (Elaboration_Check, On => Read);
pragma Suppress (Elaboration_Check, On => Write);
pragma Suppress (Elaboration_Check, On => Is_Interactive);
pragma Suppress (Elaboration_Check, On => Is_Empty);
pragma Suppress (Elaboration_Check, On => Close_All_Open_Files);
pragma Suppress (Elaboration_Check, On => List_All_Open_Files);
pragma Suppress (Elaboration_Check, On => Identical_Files);
pragma Suppress (Elaboration_Check, On => Get_Os_Dependent_Control);
pragma Suppress (Elaboration_Check, On => Closed_Input_File);
pragma Suppress (Elaboration_Check, On => Closed_Output_File);
end Device_Independent_Io;