DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦d104c5a8c⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Animal, package body Self, seg_03a3a3

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Oo_Ada_Exception;
with Text_Io;
with Unchecked_Conversion;
with Unchecked_Deallocation;

package body Animal is

    procedure Free is new Unchecked_Deallocation (State, State_Ptr);

    function Animal_View_Of is
       new Unchecked_Conversion
              (Source => Application.Object, Target => State_Ptr);


    function Application_View_Of is
       new Unchecked_Conversion (Source => State_Ptr,
                                 Target => Application.Object);


    function Create (Offspring_No : Natural := 0) return Object is
        This_Application : Animal.Application.Object;
        This_State_Ptr : State_Ptr;
    begin
        This_State_Ptr := new State;
        This_State_Ptr.Offspring_No := Offspring_No;
        This_Application := Application.Create (1);
        Application.Set_Heir (This_Application,
                              Application_View_Of (This_State_Ptr));

        return Object (This_Application);
    end Create;


    procedure Delete (This_Animal : in out Object) is
        This_State_Ptr : State_Ptr := Part_Of (This_Animal);
    begin
        case Part_Of (This_Animal).Offspring_No is
            when 0 =>
                Free (This_State_Ptr);
                Application.Delete (Application.Object (This_Animal));
            when 1 =>
                Fish.Delete (Fish.Object (This_Animal));
            when 2 =>
                Bird.Delete (Bird.Object (This_Animal));
            when others =>
                raise Oo_Ada_Exception.Offspring_Error;
        end case;
    end Delete;


    package Self is
        procedure Sleep (This_Animal : Object);
        procedure Eat (This_Animal : Object);
    end Self;


    package body Self is separate;


    procedure Sleep (This_Animal : Object) is separate;


    procedure Eat (This_Animal : Object) is separate;


    procedure Set_Mass (This_Animal : in out Object; Kg : Positive) is
    begin
        Part_Of (This_Animal).Mass := Kg;
    end Set_Mass;


    function Get_Mass (This_Animal : Object) return Positive is
    begin
        return Part_Of (This_Animal).Mass;
    end Get_Mass;


    procedure Image (This_Animal : Object) is
    begin
        Text_Io.Put_Line ("Animal is:");
        Text_Io.Put_Line ("   masse: " &
                          Positive'Image (Part_Of (This_Animal).Mass));
    end Image;


    function Part_Of (This_Animal : Object) return State_Ptr is  
    begin
        return Animal_View_Of (S => Application.Get_Heir
                                       (Application.Object (This_Animal)));
    end Part_Of;


    procedure Set_Heir (This_State_Ptr : in out State_Ptr;
                        Heir : Application.Object) is
    begin
        This_State_Ptr.Heir := Heir;
    end Set_Heir;


    function Get_Heir (This_State_Ptr : State_Ptr) return Application.Object is
    begin
        return This_State_Ptr.Heir;
    end Get_Heir;


end Animal;



E3 Meta Data

    nblk1=6
    nid=6
    hdr6=8
        [0x00] rec0=20 rec1=00 rec2=01 rec3=012
        [0x01] rec0=23 rec1=00 rec2=02 rec3=030
        [0x02] rec0=22 rec1=00 rec2=03 rec3=074
        [0x03] rec0=09 rec1=00 rec2=05 rec3=000
        [0x04] rec0=0c rec1=00 rec2=06 rec3=000
        [0x05] rec0=42 rec1=7a rec2=08 rec3=315
    tail 0x21533201085024cfee32b 0x42a00088462060003
Free Block Chain:
  0x6: 0000  00 04 00 19 80 16 20 20 70 72 6f 63 65 64 75 72  ┆        procedur┆
  0x4: 0000  00 00 00 22 00 1f 20 20 20 20 70 72 6f 63 65 64  ┆   "      proced┆