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

⟦00f07fff3⟧ Ada Source

    Length: 9216 (0x2400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Put_F, package body Put_R, seg_025603

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 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 Put_R is

    package Put_F is

        procedure Append_In (Must_Append : Boolean);
        procedure To_Remote_File_In (Name : Mac_Text.Text);
        procedure Content_In (Content : Mac_Text.Text);
        procedure Options_In (Options : Mac_Text.Text);
        procedure End_Put;

    end Put_F;

    package body Put_F is  
        Err : Mac_Types.Oserr := Mac_Types.Noerr;
        Append : Boolean;
        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 Append_In (Must_Append : Boolean) is  
        begin
            Append := Must_Append;
        end Append_In;

        procedure To_Remote_File_In (Name : Mac_Text.Text) is
            S : Mac_Types.Str255 := Mac_Text.Value (Name);
        begin
            Err := Mac_Files.Create_File (Name);
            Err := Files.Fsopen (S, 0, As_Varinteger (Refnum'Address));
            if Err /= Mac_Types.Noerr then
                return;
            end if;
            if Append then
                Err := Files.Setfpos (Refnum, Files.Fsfromleof, 0);
            else
                Err := Files.Seteof (Refnum, 0);
            end if;
        end To_Remote_File_In;

        procedure Content_In (Content : Mac_Text.Text) is
            Length : Mac_Types.Longint;
        begin  
            Length := Mac_Text.Length (Content);
            if Err = Mac_Types.Noerr then
                Err := Files.Fswrite (Refnum, As_Varlongint (Length'Address),
                                      Mac_Text.As_Ptr (Content));
            end if;
        end Content_In;

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

        procedure End_Put is
            L : Mac_Types.Longint;
        begin  
            if Err = Mac_Types.Noerr then
                if (Files.Getfpos (Refnum, As_Varlongint (L'Address)) =
                    Mac_Types.Noerr) then
                    Err := Files.Seteof (Refnum, L);
                end if;
                Err := Files.Fsclose (Refnum);
            end if;
            if Err /= Mac_Types.Noerr then
                Rational_Error.Raise_Mac_Error (Err);
            end if;
        end End_Put;
    end Put_F;

    procedure Read (A_Connection : in out Communications.Connection) is
        I : Mac_Types.Longint;
        B : Boolean;
        T : Mac_Text.Text (256);  
        Buffer : Mac_Text.Text (2010);
    begin
        Put_Line ("put_r:read begin");
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_Append then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Interchange.Get_Bool (A_Connection, B);
        Put_F.Append_In (B);
        Put ("put_r:append: ");
        Put_Line (Boolean'Image (B));
        Interchange.Get_Int (A_Connection, I);
        if I /= Talk_Utils.F_To_Remote_File then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Interchange.Get_Text (A_Connection, T);
        Put_F.To_Remote_File_In (T);
        Put ("put_r:to 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);       Put_F.Options_In (T);
        Interchange.Get_Int (A_Connection, I);
        while I = Talk_Utils.F_Content loop  
            Interchange.Get_Text (A_Connection, Buffer);
            Put_F.Content_In (Buffer);
            Interchange.Get_Int (A_Connection, I);
        end loop;
        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_Put then
            Rational_Error.Raise_Error (Rational_Error.Internal_Error);
        end if;
        Put_Line ("put_r:read end");
    end Read;

    procedure Write (A_Connection : in out Communications.Connection) is
    begin
        Put_Line ("put_r:write begin");
        begin
            Put_F.End_Put;
        exception
            when others =>
                Rational_Error.Report
                   (A_Connection, Talk_Utils.R_Put, Rational_Error.Get);       end;
        Interchange.Put_Int (A_Connection, Talk_Utils.F_Delimitor);
        Interchange.Put_Int (A_Connection, Talk_Utils.R_Put);  
        Put_Line ("put_r:write end");
    end Write;

end Put_R;

E3 Meta Data

    nblk1=8
    nid=0
    hdr6=10
        [0x00] rec0=25 rec1=00 rec2=01 rec3=068
        [0x01] rec0=01 rec1=00 rec2=02 rec3=02c
        [0x02] rec0=1b rec1=00 rec2=07 rec3=050
        [0x03] rec0=1c rec1=00 rec2=05 rec3=08e
        [0x04] rec0=07 rec1=00 rec2=04 rec3=05c
        [0x05] rec0=18 rec1=00 rec2=03 rec3=002
        [0x06] rec0=1a rec1=00 rec2=06 rec3=002
        [0x07] rec0=07 rec1=00 rec2=08 rec3=000
    tail 0x217204df683a2679c57f6 0x42a00088462060003