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

⟦da4c8ef2f⟧ TextFile

    Length: 4951 (0x1357)
    Types: TextFile
    Names: »V«

Derivation

└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦12c68c704⟧ 
                └─⟦this⟧ 
└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS 
    └─ ⟦91c658230⟧ »DATA« 
        └─⟦458657fb6⟧ 
            └─⟦220843204⟧ 
                └─⟦this⟧ 

TextFile

package Simple_Status is

    -- Error status reporting package

    -- A simple_status.condition can be used to return error information from
    -- procedure calls.  They are relatively large and should always
    -- be passed in out (by convention to avoid copies).

    -- A Condition consists of a Condition_Name and a Message.
    -- The Condition_Name indicates the type of error (if any) and how
    -- how serious the error is (or if completion was
    -- successful).  The Message provides additional information about
    -- the error.

    -- In simple applications, A Condition_Name alone can be used to
    -- indicate status.

    -- By convention, condition names in an application should be
    -- standardized so that error conditions can be tested
    -- programmaticly.



    type Condition_Name  is private;  -- A short name for the error type
    type Condition_Class is
       (Normal,   -- operation completed normally
        Warning,  -- operation completed, but something unexpected happened
        Problem,  -- operation did not complete, but no harm done
        Fatal);   -- operation did not complete.  Proceeding is dangerous.
    type Condition       is private;  -- Contains the above plus a message
    -- Conditions are self-initializing to
    -- severity Normal and null names

    procedure Initialize (Status : in out Condition);
    -- The empty condition has null name and severity normal
    -- a declared condition is initialized;  This procedure will set the
    -- Condition to be Normal (ie, successful).

    function Name (Error_Type : Condition_Name) return String;
    function Name (Status : Condition)          return String;
    -- get the human-readable name of this Condition_Name (Condition)

    function Severity (Error_Type : Condition_Name) return Condition_Class;
    function Severity (Status : Condition)          return Condition_Class;

    function Error_Type (Status : Condition) return Condition_Name;
    -- provide the Condition_Name on which a Condition is built

    function Error (Error_Type : Condition_Name;
                    Level      : Condition_Class := Warning) return Boolean;
    function Error (Status : Condition; Level : Condition_Class := Warning)
                   return Boolean;
    -- True <=> Severity (Error_Type/Status) >= Level;
    -- usage:
    --    Do_Something (Status);
    --    if Simple_Status.Error (Status) then
    --           ... Put (Display_Message (Status);

    function Display_Message (Status : Condition) return String;
    -- given a condition that indicates and error, this function returns
    -- a string suitable for display to users.  It includes the
    -- string form of the condition name and any additional problem-
    -- specific information recorded in the condition.


    function Message (Status : Condition) return String;
    -- return just the message part of the Condition.

    procedure Create_Condition (Status     : in out Condition;
                                Error_Type :        String;
                                Message    :        String          := "";
                                Severity   :        Condition_Class := Problem);
    procedure Create_Condition (Status     : in out Condition;
                                Error_Type :        Condition_Name;
                                Message    :        String := "");
    -- Create a new error condition.  The Error_Type is intended to
    -- specify the class of error (limited to 63 characters), generally
    -- in a few words (eg, "Illegal name").  Message is intended to
    -- supplement the error_type with more specific information
    -- (eg, ": '#' is an illegal character").  Function Display_Message
    -- would then return "Illegal name: '#' is an illegal character".


    function Create_Condition_Name
                (Error_Type : String; Severity : Condition_Class := Problem)
                return Condition_Name;


    function Equal (Status : Condition; Error_Type : String) return Boolean;
    function Equal (Status : Condition; Error_Type : Condition_Name)
                   return Boolean;
    function Equal (Status : Condition_Name; Error_Type : String)
                   return Boolean;
    function Equal (Status : Condition_Name; Error_Type : Condition_Name)
                   return Boolean;

    -- return true if the error_type string of Status is equal to the
    -- right error_type string (the second parameter).  The severity
    -- does not participate in the comparison.  The strings must
    -- match exactly (except for index range).  Sample usage:
    --   Directory.Open(File, Status);
    --   if SS.Equal (Status, "Nonexistent file") then ...
    --   elsif SS.Equal (Status, "Internal error") then ...
    --   etc.
    -- The strings in the example should be constants, of course.


    pragma Subsystem (Miscellaneous);
    pragma Module_Name (4, 810);

end Simple_Status;