|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 9216 (0x2400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package Simple_Status, pragma Module_Name 4 810, pragma Subsystem Miscellaneous, seg_012911
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
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;
nblk1=8
nid=0
hdr6=10
[0x00] rec0=1c rec1=00 rec2=01 rec3=024
[0x01] rec0=00 rec1=00 rec2=08 rec3=002
[0x02] rec0=13 rec1=00 rec2=02 rec3=04a
[0x03] rec0=00 rec1=00 rec2=07 rec3=030
[0x04] rec0=17 rec1=00 rec2=03 rec3=028
[0x05] rec0=10 rec1=00 rec2=04 rec3=098
[0x06] rec0=17 rec1=00 rec2=05 rec3=044
[0x07] rec0=04 rec1=00 rec2=06 rec3=001
tail 0x2150d948282b0838d5e95 0x42a00088462065003