DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦f18886d49⟧ TextFile

    Length: 5052 (0x13bc)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

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;