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

⟦141085283⟧ Ada Source

    Length: 9216 (0x2400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Get_F, package body Get_R, seg_025091

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 Communications;
with Errors;
with Files;
with Interchange;
with Mac_Files;  
with Mac_Path;
with Mac_Types;
with Mac_Text;
with Osutils;
with Rational_Error;
with System;
with Talk_Utils;
with Text_Io;
use Text_Io;
with Unchecked_Conversion;
package body Get_R is

    package Get_F is

        procedure From_Remote_File_In (Name : Mac_Text.Text);
        function End_Iter_I return Boolean;
        procedure Content_Out (T : in out Mac_Text.Text);
        procedure Options_In (Options : Mac_Text.Text);
        procedure End_Get;

    end Get_F;

    package body Get_F is  
        Err : Mac_Types.Oserr := Mac_Types.Noerr;
        Refnum : Mac_Types.Integer;

        function As_Varinteger is new Unchecked_Conversion
                                         (Source => System.Address,
                                          Target => Mac_Types.Varinteger);

        function As_Varlongint is new Unchecked_Conversion
                                         (Source => System.Address,
                                          Target => Mac_Types.Varlongint);


        procedure From_Remote_File_In (Name : Mac_Text.Text) is
            S : Mac_Types.Str255 := Mac_Text.Value (Name);  
        begin
            Err := Files.Fsopen (S, 0, As_Varinteger (Refnum'Address));
            if Err /= Mac_Types.Noerr then
                return;
            end if;
        end From_Remote_File_In;

        function End_Iter_I return Boolean is
            Length : Mac_Types.Longint;  
            Leof : Mac_Types.Longint;
        begin  
            if Err /= Mac_Types.Noerr then
                return True;
            end if;
            Err := Files.Geteof (Refnum, As_Varlongint (Leof'Address));
            if Err = Mac_Types.Noerr then
                Err := Files.Getfpos (Refnum, As_Varlongint (Length'Address));
                if Err = Mac_Types.Noerr then
                    return Length >= Leof;
                end if;
            end if;  
            return True;
        end End_Iter_I;

        procedure Options_In (Options : Mac_Text.Text) is
        begin
            null;
        end Options_In;

        procedure Content_Out (T : in out Mac_Text.Text) is
            Length : Mac_Types.Longint;
        begin  
            if Err /= Mac_Types.Noerr then
                return;
            end if;
            Length := Mac_Text.Length (T);
            Err := Files.Fsread (Refnum, As_Varlongint (Length'Address),
                                 Mac_Text.As_Ptr (T));
            Mac_Text.Set_Length (T, Mac_Text.Index (Length));
            if Err = Errors.Eoferr then
                Err := Mac_Types.Noerr;
            end if;
        end Content_Out;

        procedure End_Get is
        begin  
            if Err = Mac_Types.Noerr then
                Err := Files.Fsclose (Refnum);
            else
                Err := Files.Fsclose (Refnum);
                Rational_Error.Raise_Mac_Error (Err);
            end if;
        end End_Get;
    end Get_F;

    procedure Read (A_Connection : in out Communications.Connection) is
        I : Mac_Types.Longint;
        B : Boolean;
        T : Mac_Text.Text (256);  
    begin
        Put_Line ("get_r:read begin");
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_From_Remote_File then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Interchange.Get_Text (A_Connection, T);
        Get_F.From_Remote_File_In (T);
        Put ("get_r:from file '");
        for I in 1 .. Mac_Text.Length (T) loop
            Put (Character'Val (Mac_Types.Char'Pos (Mac_Text.Value (I, T))));
        end loop;
        Put_Line ("'");
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_Options then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Interchange.Get_Text (A_Connection, T);
        Get_F.Options_In (T);
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_Delimitor then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.R_Get then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Put_Line ("get_r:read end");
    end Read;

    procedure Write (A_Connection : in out Communications.Connection) is
        Iter_I : Positive;
        Buffer : Mac_Text.Text (2000);
    begin
        Put_Line ("get_r:write begin");
        begin  
            Iter_I := 1;  
            while not Get_F.End_Iter_I loop
                Put_Line ("get_r:write iteration: ");  
                Put (Positive'Image (Iter_I));
                Get_F.Content_Out (Buffer);
                Interchange.Put_Int (A_Connection, Talk_Utils.F_Content);
                Interchange.Put_Text (A_Connection, Buffer);
                Iter_I := Iter_I + 1;
            end loop;
            Get_F.End_Get;
        exception
            when others =>
                Rational_Error.Report
                   (A_Connection, Talk_Utils.R_Get, Rational_Error.Get);
        end;
        Interchange.Put_Int (A_Connection, Talk_Utils.F_Delimitor);
        Interchange.Put_Int (A_Connection, Talk_Utils.R_Get);
        Put_Line ("get_r:write end");
    end Write;

end Get_R;

E3 Meta Data

    nblk1=8
    nid=8
    hdr6=e
        [0x00] rec0=26 rec1=00 rec2=01 rec3=012
        [0x01] rec0=01 rec1=00 rec2=03 rec3=05a
        [0x02] rec0=1b rec1=00 rec2=05 rec3=018
        [0x03] rec0=1d rec1=00 rec2=07 rec3=022
        [0x04] rec0=1a rec1=00 rec2=04 rec3=022
        [0x05] rec0=18 rec1=00 rec2=02 rec3=06e
        [0x06] rec0=0f rec1=00 rec2=06 rec3=000
        [0x07] rec0=68 rec1=39 rec2=b7 rec3=2e6
    tail 0x2172005b8839f57b8b58a 0x42a00088462060003
Free Block Chain:
  0x8: 0000  00 00 01 16 80 32 43 6f 6e 6e 65 63 74 69 6f 6e  ┆     2Connection┆