DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦85e16e6a2⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package File_Support, seg_04b933

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with System, Os_Files, A_Strings;
use Os_Files;
with V_I_Mutex;

package File_Support is

    Stdin_Fd : File_Descriptor renames Os_Files.Stdin_Fd;
    Stdout_Fd : File_Descriptor renames Os_Files.Stdout_Fd;
    Stderr_Fd : File_Descriptor renames Os_Files.Stderr_Fd;
    function Sequential return Os_Files.File_Styles renames Os_Files.Sequential;
    function Direct return Os_Files.File_Styles renames Os_Files.Direct;
    function Text return Os_Files.File_Styles renames Os_Files.Text;
    function "=" (A, B : File_Id_Ptr) return Boolean renames Os_Files."=";
    function Same_Id (A, B : File_Id_Ptr) return Boolean
        renames Os_Files.Same_Id;
    function File_Size
                (Fd : File_Descriptor; Elem_Size : Integer) return Integer
        renames Os_Files.File_Size;
    function Is_Interactive (Fd : File_Descriptor) return Boolean
        renames Os_Files.Is_Interactive;
    procedure Position_File (Fd : File_Descriptor; To, Size : Integer)
        renames Os_Files.Position_File;
    procedure Skip_In_File (Fd : File_Descriptor; To : Integer)
        renames Os_Files.Skip_In_File;
    function Read (Fd : File_Descriptor; Addr : System.Address; Cnt : Integer)
                  return Integer;
    --pragma inline(read);
    procedure Write
                 (Fd : File_Descriptor; Addr : System.Address; Cnt : Integer);
    --pragma inline(write);
    function Read (Fd : File_Descriptor;
                   Addr : System.Long_Address;
                   Cnt : Integer) return Integer renames Os_Files.Read;
    procedure Write (Fd : File_Descriptor;
                     Addr : System.Long_Address;
                     Cnt : Integer) renames Os_Files.Write;
    function Get_File_Id (Fd : File_Descriptor) return Os_Files.File_Id_Ptr
        renames Os_Files.Get_File_Id;

    type Byte_Array is array (Natural range <>) of Character;
    type Buffer_Rec (Size : Natural) is
        record
            -- elem(0) is used for pushing in ascii.lf
            -- after read-ahead.  buffer really starts at elem(1).
            Elem : Byte_Array (0 .. Size);
        end record;
    type Access_Bytes is access Buffer_Rec;

    type Access_Char is access Character;

    type File_Mode is (Input, Output, In_Out);

    type File_Pos is (Unknown, At_Char, At_Eol, At_Delayed_Eol, At_Eop, At_Eof);

    type File_Record;

    type File_Ptr is access File_Record;

    type File_Record is
        record
            Fd : File_Descriptor;
            Name : A_Strings.A_String;
            Mode : File_Mode;
            Form : A_Strings.A_String;
            Style : File_Styles;
            Resetable : Boolean;
            Index : Natural;
            Linelength : Natural;
            Pagelength : Natural;
            Line : Natural;
            Page : Natural;
            Pos : File_Pos;
            Delete : Boolean;
            File_Id : File_Id_Ptr;
            Eof_Char : Character;
            Test_Eof : Boolean := False;

            -- for buffering in the file.
            Buffer : Access_Bytes;
            Last : Integer := -1;
            Last_Lf : Integer := -1;
            In_Ptr : Integer := -1;
            Out_Ptr : Integer := -1;
            Always_Flush : Boolean;

            -- for get_line returning form feeds in the returned string
            Want_Ff : Boolean := False;

            -- for linked list of file descriptors: all open files
            Next : File_Ptr;

            -- for task and abort safe file I/O
            Mutex : V_I_Mutex.Safe_Mutex_T;
        end record;

    -- Access to file_list must be protected via
    -- safe_support.file_support_lock().
    File_List : File_Ptr := null;

    -- The following are updated in text_io
    Cur_Input_Id : File_Id_Ptr;
    Cur_Output_Id : File_Id_Ptr;

    -- The file routines need to be safe_support.file_lock()'ed as follows:
    --  file_open(), setup_buffer()\x09\x09=>
    --  \x09upon entry/exit: unlocked
    --  file_close_upon_exit()\x09\x09\x09=>
    --  \x09upon entry/exit: unlocked
    --  file_close(), file_delete()\x09\x09=>
    --  \x09upon entry: locked, upon exit unlocked
    --  all other file routines\x09\x09\x09=>
    --  \x09upon entry/exit: locked

    procedure File_Open (Name : String := "";
                         File : in out File_Ptr;
                         Mode : File_Mode := In_Out;
                         Create : Boolean := False;
                         Form : String := "";
                         Style : File_Styles := Text;
                         Record_Size : Integer := 0);

    procedure File_Close (File : in out File_Ptr);
    procedure File_Delete (File : in out File_Ptr);
    procedure File_Reset (File : in out File_Ptr; Mode : File_Mode);

    -- Called at program exit from close_all(). Doesn't do any
    -- locks/unlocks or frees
    procedure File_Close_Upon_Exit (File : File_Ptr);

    function File_Eof (File : in File_Ptr) return Boolean;

    procedure Putchar (File : File_Ptr; Char : Character);
    function Getchar (File : File_Ptr) return Character;
    procedure Skip_Past_Eol (File : File_Ptr);
    function Tstfile (File : File_Ptr) return File_Pos;
    function Tstfile_Beyond_Eol (File : File_Ptr) return File_Pos;
    procedure Setup_Buffer (File : File_Ptr; Size : Natural);
    procedure Refill_Buffer (File : File_Ptr);

    procedure Always_Flush (File : File_Ptr);
    procedure Want_Ff (File : File_Ptr);
    procedure Flush (File : File_Ptr);
    procedure Set_Buffer_Size (File : File_Ptr; Size : Natural);
    procedure Set_Eof_Char (File : File_Ptr; Eof_Char : Character := Ascii.Eot);

    procedure Write_To_Stderr (Message : String);

end File_Support;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=17 rec1=00 rec2=01 rec3=006
        [0x01] rec0=15 rec1=00 rec2=02 rec3=030
        [0x02] rec0=20 rec1=00 rec2=03 rec3=020
        [0x03] rec0=1e rec1=00 rec2=04 rec3=00a
        [0x04] rec0=17 rec1=00 rec2=05 rec3=064
        [0x05] rec0=15 rec1=00 rec2=06 rec3=000
    tail 0x21750b828868434e0f7fe 0x42a00088462060003