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

⟦b9b2624f4⟧ Ada Source

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

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 Fish is

    type State is
        record
            Offspring_No : Natural := 0;
            Fin_Number : Positive;
            Heir : Animal.Application.Object;
        end record;


    procedure Free is new Unchecked_Deallocation
                             (Object => State, Name => State_Ptr);


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


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


    function Create (Offspring_No : Natural := 0) return Object is
        This_Animal : Animal.Object;
        This_State_Ptr : State_Ptr;  
        Animal_State_Ptr : Animal.State_Ptr;
    begin  
        This_State_Ptr := new State;
        This_State_Ptr.Offspring_No := Offspring_No;

        This_Animal := Animal.Create (1);
        Animal_State_Ptr := Animal.Part_Of (This_Animal);
        Animal.Set_Heir (Animal_State_Ptr,
                         Application_View_Of (This_State_Ptr));

        return Fish.Object (This_Animal);
    end Create;


    procedure Delete (This_Fish : in out Object;
                      Marker : Boolean := False) is separate;


    procedure Image (This_Fish : Object) is
    begin
        Text_Io.Put_Line ("fish is :");
        Animal.Image (Animal.Object (This_Fish));
        Text_Io.Put_Line ("fish state is :");
        Text_Io.Put_Line ("   fin number: " &
                          Positive'Image (Part_Of (This_Fish).Fin_Number));
    end Image;


    procedure Set_Fin (This_Fish : Object; Number : Positive) is  
    begin
        Part_Of (This_Fish).Fin_Number := Number;
    end Set_Fin;


    function Get_Fin (This_Fish : Object) return Positive is
    begin
        return Part_Of (This_Fish).Fin_Number;
    end Get_Fin;


    package Self is
        procedure Sleep (This_Fish : Object; Marker : Boolean := False);
        procedure Swim (This_Fish : Object);
    end Self;

    package body Self is separate;

    procedure Sleep (This_Fish : Object; Marker : Boolean := False) is separate;

    procedure Swim (This_Fish : Object) is separate;


    function Part_Of (This_Fish : Object) return State_Ptr is  
        This_State_Ptr : State_Ptr;
    begin
        This_State_Ptr :=
           Fish_View_Of (S => Animal.Get_Heir
                                 (Animal.Part_Of (Animal.Object (This_Fish))));

        if This_State_Ptr = null then
            raise Oo_Ada_Exception.Part_Of_Error;
        else
            return This_State_Ptr;
        end if;
    end Part_Of;


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


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

end Fish;

E3 Meta Data

    nblk1=6
    nid=2
    hdr6=a
        [0x00] rec0=24 rec1=00 rec2=01 rec3=048
        [0x01] rec0=05 rec1=00 rec2=03 rec3=038
        [0x02] rec0=22 rec1=00 rec2=04 rec3=080
        [0x03] rec0=22 rec1=00 rec2=06 rec3=046
        [0x04] rec0=07 rec1=00 rec2=05 rec3=000
        [0x05] rec0=07 rec1=00 rec2=04 rec3=001
    tail 0x21533e7ee85177c0a9089 0x42a00088462060003
Free Block Chain:
  0x2: 0000  00 00 00 2c 80 1a 69 73 68 29 2e 46 69 6e 5f 4e  ┆   ,  ish).Fin_N┆