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

⟦98f998e71⟧ Ada Source

    Length: 9216 (0x2400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Rational_Error, seg_025385

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 Errors;
with Interchange;
with Talk_Utils;
package body Rational_Error is

    Last_Error : Rational_Error := Ok;

    function Mac_To_Rational (Err : Mac_Types.Oserr) return Rational_Error is
        type Synonym is
            record
                Mac : Mac_Types.Oserr;
                Rational : Rational_Error;
            end record;  
        type Synonym_Array is array (Positive range <>) of Synonym;
        Error_Synonyms : constant Synonym_Array :=
           ((Errors.Nsverr, Name_Error), (Errors.Bdnamerr, Name_Error),
            (Errors.Paramerr, Device_Error), (Errors.Dirfulerr, Device_Error),
            (Errors.Dskfulerr, Device_Error), (Errors.Ioerr, Device_Error),
            (Errors.Bdnamerr, Name_Error), (Errors.Fnferr, Name_Error),
            (Errors.Wprerr, Use_Error), (Errors.Vlckderr, Use_Error),
            (Errors.Dupfnerr, Policy_Error), (Errors.Dirnferr, Name_Error),
            (Errors.Afpaccessdenied, Policy_Error),
            (Errors.Extfserr, Device_Error), (Errors.Tmfoerr, Device_Error),
            (Errors.Opwrerr, Policy_Error), (Errors.Permerr, Access_Error),
            (Errors.Memfullerr, Resource_Limit),
            (Errors.Flckderr, Access_Error), (Errors.Fbsyerr, Device_Error),
            (Errors.Fsrnerr, Device_Error));
    begin
        for E in Error_Synonyms'Range loop
            if Error_Synonyms (E).Mac = Err then
                return Error_Synonyms (E).Rational;
            end if;
        end loop;
        return Internal_Error;
    end Mac_To_Rational;

    function Acceptable
                (Request : Natural; Error : Rational_Error) return Boolean is
        type Rational_Error_List is array (Positive range <>) of Rational_Error;
        type Rational_Error_Record (Size : Natural := 4) is
            record
                Errors : Rational_Error_List (1 .. Size);
            end record;
        type Request_List is
           array (Natural range Talk_Utils.R_Create ..
                                   Talk_Utils.R_Signal_To_Shell) of
              Rational_Error_Record;
        R_Ls_List : Rational_Error_Record (0);
        Errors_List : constant Request_List :=
           (Talk_Utils.R_Create => (6, (Policy_Error, Status_Error, Use_Error,
                                        Device_Error, Name_Error, Unsupported)),
            Talk_Utils.R_Put =>
               (7, (Policy_Error, Resource_Limit, Status_Error,
                    Use_Error, Device_Error, Name_Error, Unsupported)),
            Talk_Utils.R_Get =>
               (7, (Policy_Error, Resource_Limit, Status_Error,
                    Device_Error, Use_Error, Name_Error, Unsupported)),
            Talk_Utils.R_Last_Update =>
               (5, (Policy_Error, Status_Error,
                    Device_Error, Name_Error, Use_Error)),
            Talk_Utils.R_File_Exists =>
               (5, (Policy_Error, Status_Error,
                    Device_Error, Name_Error, Use_Error)),
            Talk_Utils.R_Copy =>
               (8, (Access_Error, Policy_Error, Resource_Limit, Status_Error,
                    Device_Error, Use_Error, Name_Error, Unsupported)),
            Talk_Utils.R_Delete =>
               (6, (Access_Error, Policy_Error, Status_Error,
                    Device_Error, Name_Error, Use_Error)),
            Talk_Utils.R_Move =>
               (4, (Policy_Error, Device_Error, Name_Error, Use_Error)),
            Talk_Utils.R_Ls => R_Ls_List,
            Talk_Utils.R_Input_To_Shell =>
               (9, (Access_Error, Resource_Limit, Status_Error,
                    Device_Error, Use_Error, Command_Error,
                    Command_Terminated, Command_Timed_Out, Unsupported)),
            Talk_Utils.R_Signal_To_Shell => R_Ls_List);
        Acceptable_Error : constant Rational_Error_Record :=
           Errors_List (Request);
    begin
        for E in Acceptable_Error.Errors'Range loop
            if Acceptable_Error.Errors (E) = Error then
                return True;
            end if;
        end loop;
        return False;
    end Acceptable;

    procedure Raise_Error (Error : Rational_Error) is
    begin
        Last_Error := Error;  
        raise Rational_Exception;
    end Raise_Error;

    procedure Raise_Mac_Error (Err : Mac_Types.Oserr) is
    begin
        Raise_Error (Mac_To_Rational (Err));
    end Raise_Mac_Error;

    function Get return Rational_Error is
    begin
        return Last_Error;
    end Get;

    procedure Report (A_Connection : in out Communications.Connection;
                      Request : Natural;
                      Error : Rational_Error;
                      Text : Mac_Text.Text := No_Text) is
        Int_Error : Mac_Types.Longint;
    begin  
        if Acceptable (Request, Error) then
            Int_Error := Rational_Error'Pos (Error);
        else
            Int_Error := Rational_Error'Pos (Internal_Error);
        end if;
        Interchange.Put_Int (A_Connection, Talk_Utils.F_Error);  
        Interchange.Put_Text (A_Connection, Text);
    end Report;

end Rational_Error;

E3 Meta Data

    nblk1=8
    nid=7
    hdr6=c
        [0x00] rec0=18 rec1=00 rec2=01 rec3=00a
        [0x01] rec0=16 rec1=00 rec2=02 rec3=040
        [0x02] rec0=12 rec1=00 rec2=06 rec3=038
        [0x03] rec0=13 rec1=00 rec2=03 rec3=00e
        [0x04] rec0=20 rec1=00 rec2=08 rec3=046
        [0x05] rec0=07 rec1=00 rec2=05 rec3=000
        [0x06] rec0=04 rec1=00 rec2=07 rec3=000
        [0x07] rec0=04 rec1=00 rec2=07 rec3=001
    tail 0x217202c9283a23d479424 0x42a00088462060003
Free Block Chain:
  0x7: 0000  00 04 00 9c 80 36 65 72 63 68 61 6e 67 65 2e 50  ┆     6erchange.P┆
  0x4: 0000  00 00 00 05 80 02 2c 20 02 03 20 20 20 20 20 20  ┆      ,         ┆