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: 3095 (0xc17) Types: TextFile Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧
with Oo_Ada_Exception; with Text_Io; with Unchecked_Conversion; with Unchecked_Deallocation; with Vegetable; package body Plant is procedure Free is new Unchecked_Deallocation (State, State_Ptr); function Plant_View_Of is new Unchecked_Conversion (Source => Root.Object, Target => State_Ptr); function Root_View_Of is new Unchecked_Conversion (Source => State_Ptr, Target => Root.Object); function Create (Offspring : Natural) return Root.Object is This_Object : Root.Object; This_State_Ptr : State_Ptr; begin This_State_Ptr := new State; This_State_Ptr.Offspring := Offspring; This_Object := Root.Create (1); Root.Set_Heir (This_Object, Root_View_Of (This_State_Ptr)); return This_Object; end Create; procedure Delete (This_Object : in out Root.Object) is This_State_Ptr : State_Ptr := Part_Of (This_Object); begin case This_State_Ptr.Offspring is when 0 => Free (This_State_Ptr); Root.Delete (This_Object); when 1 => Vegetable.Delete (This_Object); when others => raise Oo_Ada_Exception.Offspring_Error; end case; end Delete; procedure Set_X (This_State_Ptr : State_Ptr; This_X : Natural) is begin This_State_Ptr.X := This_X; end Set_X; function Get_X (This_State_Ptr : State_Ptr) return Natural is begin return This_State_Ptr.X; end Get_X; package Self is procedure Grow (This_Object : Root.Object; Marker : Boolean := False); end Self; package body Self is procedure Grow (This_Object : Root.Object; Marker : Boolean := False) is begin Text_Io.Put_Line ("The plant is growing ..."); end Grow; end Self; procedure Grow (This_Object : Root.Object; Marker : Boolean := False) is This_State_Ptr : State_Ptr := Part_Of (This_Object); begin case This_State_Ptr.Offspring is when 0 => Self.Grow (This_Object); when 1 => if not Marker then Vegetable.Grow (This_Object); else Self.Grow (This_Object); end if; when others => raise Oo_Ada_Exception.Offspring_Error; end case; end Grow; function Part_Of (This_Object : Root.Object) return State_Ptr is This_State_Ptr : State_Ptr; begin This_State_Ptr := Plant_View_Of (S => Root.Get_Heir (This_Object)); if This_State_Ptr = null then raise Oo_Ada_Exception.Part_Of_Error; end if; return This_State_Ptr; end Part_Of; procedure Set_Heir (This_State_Ptr : in out State_Ptr; Heir : Root.Object) is begin This_State_Ptr.Heir := Heir; end Set_Heir; function Get_Heir (This_State_Ptr : State_Ptr) return Root.Object is begin return This_State_Ptr.Heir; end Get_Heir; end Plant;