DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 31740 (0x7bfc) Types: TextFile Names: »B«
└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13 └─ ⟦124ff5788⟧ »DATA« └─⟦this⟧ └─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧ └─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16 └─ ⟦6f12a12be⟧ »DATA« └─⟦this⟧ └─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04 └─ ⟦d65440be7⟧ »DATA« └─⟦this⟧
with Asa_Definitions; with Gateway_Object; with Job_Segment; with Object_Class; with Simple_Status; with String_Utilities; with System; with Table_Sort_Generic; with Unchecked_Conversion; package body Requirements is package Asap renames Asa_Definitions.Properties; package Dtr renames Directory.Traversal; package Dst renames Directory.Statistics; package Gwo renames Gateway_Object; package Ss renames Simple_Status; -- --------------------------------------------- -- ( ) Declarations for permanent representation -- --------------------------------------------- type Record_Permanent_Representation is record Kind : Requirement_Kind; Object : Dir.Object; Id : Functional_Requirement_Number; end record; -- -- It is necessary to use a 31-bit integer internally, because -- unchecked conversion to a 30-bit integer may yield -2**31, -- which is the uninitialized value, and will raise NUMERIC_ERROR -- when read. -- type Integer31 is range -2 ** 30 .. 2 ** 30 - 1; for Integer31'Size use 31; pragma Assert (Record_Permanent_Representation'Size <= Permanent_Representation'Length * Integer31'Size); type Integer31_Permanent_Representation is array (Permanent_Representation'Range) of Integer31; function To_Record is new Unchecked_Conversion (Source => Integer31_Permanent_Representation, Target => Record_Permanent_Representation); function From_Record is new Unchecked_Conversion (Source => Record_Permanent_Representation, Target => Integer31_Permanent_Representation); -- ------------------ -- ( ) Error handling -- ------------------ function Diagnosis (Error : in Status) return String is begin case Error.Kind is when Module_Id_Error => return "the specified requirement id could not be found"; when Directory_Error => return String_Utilities.Lower_Case (Dir.Error_Status'Image (Error.Error_Status)); when Directory_Naming_Error => return String_Utilities.Lower_Case (Dna.Name_Status'Image (Error.Name_Status)); when General_Error => return Ss.Display_Message (Error.Condition); end case; end Diagnosis; function Module_Id_Error return Requirement is begin return (Kind => Not_A_Requirement, Error => (Kind => Status_Kind'(Module_Id_Error))); end Module_Id_Error; function Directory_Error (E : in Dir.Error_Status) return Requirement is begin return (Kind => Not_A_Requirement, Error => (Kind => Directory_Error, Error_Status => E)); end Directory_Error; function Directory_Error (E : in Dir.Error_Status) return Dependents is begin return (Is_Bad => True, Error => (Kind => Directory_Error, Error_Status => E)); end Directory_Error; function Directory_Naming_Error (N : in Dna.Name_Status) return Requirement is begin return (Kind => Not_A_Requirement, Error => (Kind => Directory_Naming_Error, Name_Status => N)); end Directory_Naming_Error; function Directory_Naming_Error (N : in Dna.Name_Status) return Dependents is begin return (Is_Bad => True, Error => (Kind => Directory_Naming_Error, Name_Status => N)); end Directory_Naming_Error; function General_Error (S : in Ss.Condition) return Requirement is begin return (Kind => Not_A_Requirement, Error => (Kind => General_Error, Condition => S)); end General_Error; function General_Error (S : in Ss.Condition) return Dependents is begin return (Is_Bad => True, Error => (Kind => General_Error, Condition => S)); end General_Error; -- ------------- -- ( ) Utilities -- ------------- function Name (Objects : in Object_List; Before : in String) return String is begin if Objects'First > Objects'Last then return Before; elsif Before = "" then return Name (Objects => Objects (Objects'First + 1 .. Objects'Last), Before => Dna.Get_Full_Name (Objects (Objects'First))); else return Name (Objects => Objects (Objects'First + 1 .. Objects'Last), Before => Before & ',' & Dna.Get_Full_Name (Objects (Objects'First))); end if; end Name; procedure Search_By_Id (Root : in Dir.Object; Id : in Positive; Action_Id : in Action.Id; Found : out Boolean; Object : out Dir.Object) is E : Dir.Error_Status; Found_In_Subobject : Boolean; Object_In_Subobject : Dir.Object; Gateway : Gwo.Handle; N : Dna.Name_Status; S : Ss.Condition; Subobject : Dir.Object; Subobjects : Dna.Iterator; use Dir; use Dna; begin Gwo.Open_Main_Object (Object => Root, H => Gateway, Update => False, Errors => S); if Ss.Error (S) then Found := False; Object := Dir.Nil; return; end if; if Asap.Asa_Id (Gateway) = Id then Gwo.Close (Gateway); Found := True; Object := Root; return; else Gwo.Close (Gateway); Dna.Resolve (Iter => Subobjects, Source => Dna.Get_Full_Name (Root) & ".@'C(~TEXT)", Status => N, Action_Id => Action_Id); if N = Dna.Successful then while not Dna.Done (Subobjects) loop Dna.Get_Object (Iter => Subobjects, The_Object => Subobject, Status => E); if E /= Dir.Successful then Found := False; Object := Dir.Nil; return; end if; Search_By_Id (Root => Subobject, Id => Id, Action_Id => Action_Id, Found => Found_In_Subobject, Object => Object_In_Subobject); if Found_In_Subobject then Found := Found_In_Subobject; Object := Object_In_Subobject; return; end if; Dna.Next (Subobjects); end loop; end if; Found := False; Object := Dir.Nil; end if; end Search_By_Id; -- ---------------------------------- -- ( ) Bodies of external subprograms -- ---------------------------------- -- ----------------------------- -- ( . ) Individual requirements -- ----------------------------- function Resolve (Model_Gateway_Name : in String; Module_Id : in Positive; Requirement_Id : in Requirement_Number; Action_Id : in Action.Id) return Requirement is E : Dir.Error_Status; Found : Boolean; Gateway : Gwo.Handle; N : Dna.Name_Status; S : Ss.Condition; The_Module : Dir.Object; The_Object : Dir.Object; The_Requirement : Dir.Object; The_Requirements : Dna.Iterator; use Asa_Definitions; use Dir; use Dna; begin Dna.Resolve (Name => Model_Gateway_Name, The_Object => The_Object, Status => N); if N /= Dna.Successful then return Directory_Naming_Error (N); end if; Search_By_Id (Root => The_Object, Id => Module_Id, Action_Id => Action_Id, Found => Found, Object => The_Module); if Found then case Requirement_Id is when Functional_Requirement_Number => return (Kind => Functional, Action_Id => Action_Id, Object => The_Module, Id => Requirement_Id); when Non_Functional_Requirement_Number => Dna.Resolve (Iter => The_Requirements, Source => Dna.Get_Full_Name (The_Module) & ".@'C(TEXT)", Status => N, Action_Id => Action_Id); if N = Dna.Successful then while not Dna.Done (The_Requirements) loop Dna.Get_Object (Iter => The_Requirements, The_Object => The_Requirement, Status => E); if E /= Dir.Successful then return Directory_Error (E); end if; Gwo.Open_Main_Object (Object => The_Requirement, H => Gateway, Update => False, Errors => S); if Ss.Error (S) then return General_Error (S); end if; if Requirement_Number (Asap.Asa_Id (Gateway)) = Requirement_Id then declare Result : Requirement (Asap.Asa_Requirement_Kind (Gateway)); begin Result.Action_Id := Action_Id; Result.Object := The_Requirement; Gwo.Close (Gateway); return Result; end; end if; Gwo.Close (Gateway); Dna.Next (The_Requirements); end loop; else return Directory_Naming_Error (N); end if; end case; else return Module_Id_Error; end if; end Resolve; function Comment (Asa_Gateway_Name : in String; Action_Id : in Action.Id) return String is Gateway : Gwo.Handle; Gateway_Object : Dir.Object; S : Ss.Condition; begin Gwo.Open_Main_Object (Object => Asa_Gateway_Name, H => Gateway, Update => False, Action_Id => Action_Id, Errors => S); if Ss.Error (S) then return ""; end if; declare Comment : constant String := Asap.Asa_Comment (Gateway); begin if Comment = "" then Gateway_Object := Gwo.Directory_Object (Gateway); Gwo.Close (Gateway); return Dna.Get_Simple_Name (Gateway_Object); else Gwo.Close (Gateway); return Comment; end if; end; end Comment; function Diagnosis (Req : in Requirement) return String is begin case Req.Kind is when Not_A_Requirement => return Diagnosis (Req.Error); when Functional | Non_Functional => return ""; end case; end Diagnosis; function Gateway_Full_Name (Req : in Requirement) return String is begin return Dna.Get_Full_Name (Req.Object); end Gateway_Full_Name; function Unique_Id (Req : in Requirement) return String is Data : Dst.Object_Data; E : Dir.Error_Status; Gateway : Gwo.Handle; Id : Positive; Module_Id : Positive; S : Ss.Condition; use Dir; begin case Req.Kind is when Not_A_Requirement => raise Requirement_Error; when Functional => Gwo.Open_Main_Object (Object => Req.Object, H => Gateway, Update => False, Action_Id => Req.Action_Id, Errors => S); if Ss.Error (S) then raise Requirement_Error; end if; Module_Id := Asap.Asa_Id (Gateway); Gwo.Close (Gateway); declare Module_Id_Image : constant String := Positive'Image (Module_Id); Id_Image : constant String := Functional_Requirement_Number'Image (Req.Id); begin return Module_Id_Image (Module_Id_Image'First + 1 .. Module_Id_Image'Last) & '.' & Id_Image (Id_Image'First + 1 .. Id_Image'Last); end; when Non_Functional => Dst.Get_Object_Data (The_Object => Req.Object, The_Data => Data, Action_Id => Req.Action_Id, Status => E); if E /= Dir.Successful then raise Requirement_Error; end if; Gwo.Open_Main_Object (Object => Dst.Object_Parent (Data), H => Gateway, Update => False, Action_Id => Req.Action_Id, Errors => S); if Ss.Error (S) then raise Requirement_Error; end if; Module_Id := Asap.Asa_Id (Gateway); Gwo.Close (Gateway); Gwo.Open_Main_Object (Object => Req.Object, H => Gateway, Update => False, Action_Id => Req.Action_Id, Errors => S); if Ss.Error (S) then raise Requirement_Error; end if; Id := Asap.Asa_Id (Gateway); Gwo.Close (Gateway); declare Module_Id_Image : constant String := Positive'Image (Module_Id); Id_Image : constant String := Positive'Image (Id); begin return Module_Id_Image (Module_Id_Image'First + 1 .. Module_Id_Image'Last) & '.' & Id_Image (Id_Image'First + 1 .. Id_Image'Last); end; end case; end Unique_Id; function Text (Req : in Requirement) return String is Gateway : Gwo.Handle; S : Ss.Condition; begin Gwo.Open_Main_Object (Object => Req.Object, H => Gateway, Update => False, Action_Id => Req.Action_Id, Errors => S); if Ss.Error (S) then raise Requirement_Error; end if; case Req.Kind is when Not_A_Requirement => raise Requirement_Error; when Functional => declare The_Text : constant String := Asap.Asa_Requirement (Gateway, Number => Req.Id); begin Gwo.Close (Gateway); return The_Text; end; when Non_Functional => declare The_Text : constant String := Asap.Asa_Requirement_Text (Gateway); begin Gwo.Close (Gateway); return The_Text; end; end case; end Text; function Convert (Req : in Requirement) return Permanent_Representation is Irep : Integer31_Permanent_Representation := (others => 0); Rep : Permanent_Representation; begin case Req.Kind is when Not_A_Requirement => raise Requirement_Error; when Functional => Irep := From_Record ((Kind => Req.Kind, Object => Req.Object, Id => Req.Id)); when Non_Functional => Irep := From_Record ((Kind => Req.Kind, Object => Req.Object, Id => 1)); end case; for I in Rep'Range loop Rep (I) := Integer (Irep (I)); end loop; return Rep; end Convert; function Convert (Rep : in Permanent_Representation; Action_Id : in Action.Id) return Requirement is Irep : Integer31_Permanent_Representation; Rrep : Record_Permanent_Representation; begin for I in Rep'Range loop Irep (I) := Integer31 (Rep (I)); end loop; Rrep := To_Record (Irep); declare Result : Requirement (Rrep.Kind); begin case Result.Kind is when Not_A_Requirement => raise Requirement_Error; when Functional => Result.Action_Id := Action_Id; Result.Object := Rrep.Object; Result.Id := Rrep.Id; when Non_Functional => Result.Action_Id := Action_Id; Result.Object := Rrep.Object; end case; return Result; end; end Convert; -- ---------------------------- -- ( . ) Requirements hierarchy -- ---------------------------- function Resolve (Asa_Gateway_Name : in String; Kind : in Requirement_Kind; Action_Id : Action.Id) return Requirement_Iterator is type Object_And_Id is record Object : Dir.Object; Id : Positive; end record; type Objects_And_Ids is array (Count range <>) of Object_And_Id; E : Dir.Error_Status; Gateway : Gwo.Handle; Gateway_Object : Dir.Object; Gateway_Objects : Dna.Iterator; N : Dna.Name_Status; Result : Requirement_Iterator; S : Ss.Condition; Size : Count := 0; The_Objects : Objects_And_Ids (Count range 1 .. Count'Last); function "<" (Left : in Object_And_Id; Right : in Object_And_Id) return Boolean is begin return Left.Id < Right.Id; end "<"; procedure Sort_By_Id is new Table_Sort_Generic (Element => Object_And_Id, Index => Count, Element_Array => Objects_And_Ids); use Dir; use Dna; begin case Kind is when Not_A_Requirement => raise Requirement_Error; when Functional => Dna.Resolve (Name => Asa_Gateway_Name, The_Object => Gateway_Object, Status => N, Action_Id => Action_Id); if N /= Dna.Successful then raise Requirement_Error; end if; Gwo.Open_Main_Object (Object => Gateway_Object, H => Gateway, Update => False, Action_Id => Action_Id, Errors => S); if Ss.Error (S) then raise Requirement_Error; end if; for R in reverse Functional_Requirement_Number loop if Asap.Asa_Requirement (Gateway, Number => R) /= "" then Size := Count (R); exit; end if; end loop; Gwo.Close (Gateway); Result := (Size => Size, Pos => 1, Contents => (others => (Kind => Functional, Action_Id => Action_Id, Object => Gateway_Object, Id => 1))); for I in Result.Contents'Range loop Result.Contents (I).Id := Functional_Requirement_Number (I); end loop; return Result; when Non_Functional => Dna.Resolve (Source => Asa_Gateway_Name & ".@'C(Text)", Iter => Gateway_Objects, Status => N, Action_Id => Action_Id); if N /= Dna.Undefined then if N /= Dna.Successful then raise Requirement_Error; end if; while not Dna.Done (Gateway_Objects) loop Dna.Get_Object (Iter => Gateway_Objects, The_Object => Gateway_Object, Status => E); if E /= Dir.Successful then raise Requirement_Error; end if; Gwo.Open_Main_Object (Object => Gateway_Object, H => Gateway, Update => False, Action_Id => Action_Id, Errors => S); if Ss.Error (S) then raise Requirement_Error; end if; if Asap.Asa_Requirement_Kind (Gateway) = Kind then Size := Size + 1; The_Objects (Size) := (Object => Gateway_Object, Id => Asap.Asa_Id (Gateway)); end if; Gwo.Close (Gateway); Dna.Next (Gateway_Objects); end loop; end if; Sort_By_Id (The_Objects (The_Objects'First .. Size)); declare Null_Requirement : Requirement (Kind); begin Null_Requirement.Action_Id := Action_Id; Null_Requirement.Object := Dir.Nil; Result := (Size => Size, Pos => 1, Contents => (others => Null_Requirement)); end; for I in Result.Contents'Range loop Result.Contents (I).Object := The_Objects (I).Object; end loop; return Result; end case; end Resolve; function Value (Reqs : in Requirement_Iterator) return Requirement is begin return Reqs.Contents (Reqs.Pos); end Value; function Done (Reqs : in Requirement_Iterator) return Boolean is begin return Reqs.Pos > Reqs.Size; end Done; procedure Next (Reqs : in out Requirement_Iterator) is begin Reqs.Pos := Reqs.Pos + 1; end Next; procedure Add (Req : in Requirement; Reqs : in out Requirement_Iterator) is Result : Requirement_Iterator (Reqs.Size + 1); begin Result.Pos := Reqs.Pos; Result.Contents := Reqs.Contents & Req; Reqs := Result; end Add; procedure Remove (Req : in Requirement; Reqs : in out Requirement_Iterator) is Result : Requirement_Iterator (Reqs.Size - 1); begin for I in Reqs.Contents'Range loop if Reqs.Contents (I) = Req then Result.Contents := Reqs.Contents (1 .. I - 1) & Reqs.Contents (I + 1 .. Reqs.Size); end if; end loop; Reqs := Result; end Remove; -- ---------------- -- ( ) Dependencies -- ---------------- function Get_Dependents (Req : in Requirement) return Dependents is Dependent_Objects : Dna.Iterator; E : Dir.Error_Status; Gateway : Gwo.Handle; N : Dna.Name_Status; S : Ss.Condition; Size : Count := 0; The_Objects : Object_List (Count); function Asa_Dependents (Req : in Requirement) return String is begin case Req.Kind is when Not_A_Requirement => raise Requirement_Error; when Functional => return Asap.Asa_Dependents (Gateway, Number => Req.Id); when Non_Functional => return Asap.Asa_Dependents (Gateway); end case; end Asa_Dependents; use Dir; use Dna; begin Gwo.Open_Main_Object (Object => Req.Object, H => Gateway, Update => False, Action_Id => Req.Action_Id, Errors => S); if Ss.Error (S) then return General_Error (S); end if; declare The_Dependents : constant String := Asa_Dependents (Req); begin Gwo.Close (Gateway, S); if Ss.Error (S) then return General_Error (S); end if; if The_Dependents = "" then return (Is_Bad => False, Objects => new Object_List'(1 .. 0 => Dir.Nil)); pragma Heap (Job_Segment.Get); end if; Dna.Resolve (Iter => Dependent_Objects, Source => '[' & The_Dependents & "]'S(Installed,Coded)", Status => N, Objects_Only => False, Action_Id => Req.Action_Id); end; if N = Dna.Undefined then return (Is_Bad => False, Objects => new Object_List'(1 .. 0 => Dir.Nil)); pragma Heap (Job_Segment.Get); elsif N /= Dna.Successful then return Directory_Naming_Error (N); end if; while not Dna.Done (Dependent_Objects) loop Size := Size + 1; Dna.Get_Object (Iter => Dependent_Objects, The_Object => The_Objects (Size), Status => E); if E /= Dir.Successful then return Directory_Error (E); end if; Dna.Next (Dependent_Objects); end loop; return (Is_Bad => False, Objects => new Object_List'(The_Objects (1 .. Size))); pragma Heap (Job_Segment.Get); end Get_Dependents; procedure Set_Dependents (Req : in Requirement; Dep : in Dependents) is Dependent_Objects : Dna.Iterator; Gateway : Gwo.Handle; S : Ss.Condition; Size : Count := 0; The_Objects : Object_List (Count); begin if Dep.Is_Bad then raise Dependent_Error; end if; Gwo.Open_Main_Object (Object => Req.Object, H => Gateway, Update => False, Action_Id => Req.Action_Id, Errors => S); if Ss.Error (S) then raise Requirement_Error; end if; case Req.Kind is when Not_A_Requirement => raise Requirement_Error; when Functional => Asap.Set_Asa_Dependents (Gateway, Number => Req.Id, Value => Name (Objects => Dep.Objects.all, Before => "")); when Non_Functional => Asap.Set_Asa_Dependents (Gateway, Value => Name (Objects => Dep.Objects.all, Before => "")); end case; Gwo.Close (Gateway); end Set_Dependents; procedure Add (Dep : in out Dependents; Onto : in String) is N : Dna.Name_Status; The_Object : Dir.Object; use Dna; begin if Dep.Is_Bad then raise Dependent_Error; end if; Dna.Resolve (Name => Onto, The_Object => The_Object, Status => N, Action_Id => Action.Null_Id); Dep := (Is_Bad => False, Objects => new Object_List'(Dep.Objects.all & The_Object)); pragma Heap (Job_Segment.Get); end Add; procedure Remove (Dep : in out Dependents; Onto : in String) is N : Dna.Name_Status; The_Object : Dir.Object; use Dir; begin if Dep.Is_Bad then raise Dependent_Error; end if; Dna.Resolve (Name => Onto, The_Object => The_Object, Status => N, Action_Id => Action.Null_Id); for I in Dep.Objects'Range loop if The_Object = Dep.Objects (I) then Dep := (Is_Bad => False, Objects => new Object_List' (Dep.Objects (Dep.Objects'First .. I - 1) & Dep.Objects (I + 1 .. Dep.Objects'Last))); pragma Heap (Job_Segment.Get); end if; end loop; end Remove; function Diagnosis (Dep : in Dependents) return String is begin case Dep.Is_Bad is when False => return ""; when True => return Diagnosis (Dep.Error); end case; end Diagnosis; end Requirements;