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: ┃ T V

⟦8a23a3ff0⟧ TextFile

    Length: 8550 (0x2166)
    Types: TextFile
    Names: »V«

Derivation

└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦c84a2ac9b⟧ 
                └─⟦this⟧ 

TextFile

with Profile;
with Simple_Status;
package Errors is

    subtype Error_Kinds    is Simple_Status.Condition_Name;
    subtype Condition      is Simple_Status.Condition;
    subtype Error_Severity is Simple_Status.Condition_Class;

    -- A CONDITION should be used to return error information from
    -- procedure calls.  They are relatively large and should always
    -- be passed by mode IN OUT.
    --
    -- A CONDITION consists of an ERROR_KINDS and a message string.  The
    -- ERROR_KINDS indicates the type of error (if any) and how
    -- serious the error is (or if completion was successful).  The
    -- Message provides additional information about the error.  A
    -- CONDITION is self-initializing to severity Normal and an empty
    -- message.
    --
    -- By convention, the set of defined ERROR_KINDS in an application
    -- should be standardized so that error conditions can be tested
    -- programmatically.

    ----- Error_Severity Constants
    --
    Normal  : constant Error_Severity := Simple_Status.Normal;
    Warn    : constant Error_Severity := Simple_Status.Warning;
    Problem : constant Error_Severity := Simple_Status.Problem;
    Fatal   : constant Error_Severity := Simple_Status.Fatal;


    function Make (Error_Name : String;  
                   Severity   : Error_Severity) return Error_Kinds
        renames Simple_Status.Create_Condition_Name;
    --
    -- Useful for creating predefined ERROR_KINDS.
    --
    -- NOTE: The length of ERROR_NAME is limited to 63 characters.

    procedure Append_Condition (A_Condition : in out Condition;
                                Owner       :        String;
                                Error_Kind  :        Error_Kinds;
                                Message     :        String);

    procedure Set_Ok (A_Condition : in out Condition)
        renames Simple_Status.Initialize;

    procedure Set (A_Condition : in out Condition;
                   Error_Kind  :        Error_Kinds;
                   Message     :        String)  
        renames Simple_Status.Create_Condition;
    --
    -- Augment A_CONDITION with a new ERROR_KIND and MESSAGE.  The REPORT
    -- procedures declared below display the information most recently
    -- SET.  Use REPORT_CONDITION at the end of this package to display
    -- all information stored in a given CONDITION.



    function Kind (Of_Condition : Condition) return Error_Kinds
        renames Simple_Status.Error_Type;
    --
    -- Returns the current ERROR_KIND from OF_CONDITION.

    function Severity (Of_Condition : Condition) return Error_Severity
        renames Simple_Status.Severity;
    --
    -- Returns the current ERROR_SEVERITY from OF_CONDITION.


    function Info (From_Condition : Condition) return String;
    --
    -- Returns the most recently SET information contained in
    -- FROM_CONDITION formatted in a style suitable for use in
    -- generating log messages.  The format of this information
    -- is ...  ERROR_NAME & ", " & MESSAGE
    --
    -- When either of ERROR_NAME or MESSAGE are the empty string, the
    -- intervening delimiter is omitted.  In this description,
    -- ERROR_NAME refers to the value provided in the first parameter of
    -- MAKE, and MESSAGE refers to the value provided in the MESSAGE
    -- parameter of APPEND_CONDITION and SET.


    function Exception_Info return String;
    --
    -- Called in the context of an exception handler, returns
    -- descriptive information about the name of the exception
    -- and the location at which it was raised.


    function Is_Error (A_Condition : Condition;
                       Severity    : Error_Severity := Errors.Warn)  
                      return Boolean renames Simple_Status.Error;
    --
    -- Returns SEVERITY (A_CONDITION) >= SEVERITY.
    --  (e.g. IS_ERROR (NONE) => False;  IS_ERROR (OPEN_ERROR) => True)

    function Is_Equal (A_Condition : Condition;  
                       An_Error    : Error_Kinds) return Boolean
        renames Simple_Status.Equal;
    --
    -- Returns KIND (A_CONDITION) = AN_ERROR.
    --
    -- NOTE: The severity component of A_CONDITION does not
    --       participate in the comparison.


    ----------------------------------------------------------
    -- The following are utilities for logging error messages
    ----------------------------------------------------------
    subtype Log_Level is Profile.Msg_Kind;

    ----- Log_Level Constants
    --
    Auxiliary : constant Log_Level := Profile.Auxiliary_Msg;
    Debug     : constant Log_Level := Profile.Debug_Msg;
    Note      : constant Log_Level := Profile.Note_Msg;
    Positive  : constant Log_Level := Profile.Positive_Msg;
    Position  : constant Log_Level := Profile.Position_Msg;
    Negative  : constant Log_Level := Profile.Negative_Msg;
    Warning   : constant Log_Level := Profile.Warning_Msg;
    Error     : constant Log_Level := Profile.Error_Msg;
    Xception  : constant Log_Level := Profile.Exception_Msg;
    Sharp     : constant Log_Level := Profile.Sharp_Msg;
    At_Sign   : constant Log_Level := Profile.At_Msg;
    Dollar    : constant Log_Level := Profile.Dollar_Msg;


    procedure Report_Exception (Where, What : String;
                                Level : Log_Level := Errors.Error;
                                Dont_Log, In_Message_Window : Boolean := False);
    --
    -- To be called in the context of an exception handler to
    -- display EXCEPTION_INFO in addition to information normally
    -- generated by REPORT below.

    procedure Report (Where, What                 : String;
                      With_Condition              : Condition;
                      Level                       : Log_Level := Errors.Note;
                      Dont_Log, In_Message_Window : Boolean   := False);
    --
    -- Generates a message of the following format to the current log
    -- device ...  WHERE & "; " & WHAT & " (" & INFO (WITH_CONDITION) & ')'
    --
    -- When WHERE is the null string, the semicolon separator is omitted
    -- from the display.  When WITH_CONDITION contains good status, the
    -- parentheses and their contents are omitted from the display.

    procedure Report (Where, What                 : String;
                      Level                       : Log_Level := Errors.Note;
                      Dont_Log, In_Message_Window : Boolean   := False);
    --
    -- Generates a message of the following format to the current log
    -- device ...  WHERE & "; " & WHAT
    --
    -- When WHERE is the null string, the semicolon separator is omitted
    -- from the display.


    --------------------------------------------------------------
    -- The following are errors used within the Design Facility
    --------------------------------------------------------------
    None : constant Error_Kinds :=  
       Make ("NONE", Errors.Normal);

    Internal_Error      : constant Error_Kinds :=  
       Make ("INTERNAL_ERROR", Errors.Fatal);
    Unknown             : constant Error_Kinds :=  
       Make ("UNKNOWN", Errors.Fatal);
    Unhandled_Exception : constant Error_Kinds :=  
       Make ("UNHANDLED_EXCEPTION", Errors.Fatal);
    Unimplemented       : constant Error_Kinds :=  
       Make ("UNIMPLEMENTED", Errors.Fatal);

    Open_Error     : constant Error_Kinds :=  
       Make ("OPEN_ERROR", Errors.Problem);
    Create_Error   : constant Error_Kinds :=  
       Make ("CREATE_ERROR", Errors.Problem);
    Access_Error   : constant Error_Kinds :=  
       Make ("ACCESS_ERROR", Errors.Problem);
    Lock_Error     : constant Error_Kinds :=  
       Make ("LOCK_ERROR", Errors.Problem);
    Mapping_Error  : constant Error_Kinds :=  
       Make ("MAPPING_ERROR", Errors.Problem);
    Inconsistency  : constant Error_Kinds :=  
       Make ("INCONSISTENCY", Errors.Problem);
    Table_Overflow : constant Error_Kinds :=
       Make ("TABLE_OVERFLOW", Errors.Problem);

    Undefined : constant Error_Kinds :=  
       Make ("UNDEFINED", Errors.Warn);
    Obsolete  : constant Error_Kinds :=  
       Make ("OBSOLETE", Errors.Warn);

    Invalid_Options    : constant Error_Kinds :=  
       Make ("INVALID_OPTIONS", Errors.Fatal);
    Warnings_Generated : constant Error_Kinds :=  
       Make ("WARNINGS_GENERATED", Errors.Warn);

    procedure Report_Condition (Status : Condition);
    --
    -- Displays the accumulated information contained in STATUS.


    pragma Subsystem (Design_Facility, Closed);
    pragma Module_Name (4, 3584);
    pragma Bias_Key (27);

end Errors;