DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦eeb97853b⟧ TextFile

    Length: 7289 (0x1c79)
    Types: TextFile
    Names: »B«

Derivation

└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Object, Argument, Message, Text_Io,
     Bounded_String, Bloc_Classe, Boolean_Classe;
package body Integer_Classe is

    function Create (Value : Integer) return Object.Reference is
        Obj : Object.Reference;
    begin
        Obj := Object.Create (Object.Integer_Classe, Value);
        return (Obj);
    end Create;

    function Fois (Indice, Blk : Object.Reference) return Object.Reference is
        Obj : Object.Reference;  
        The_Message_Valeur : Message.Tiny_String;
    begin  
        Bounded_String.Copy (The_Message_Valeur, Bloc_Classe.Message_Valeur);
        for I in 1 .. Object.Get_Value (Indice) loop
            Obj := Bloc_Classe.Send (Blk, The_Message_Valeur);
        end loop;
        return (Obj);
    end Fois;



    function Repeter (Min, Max, Blk : Object.Reference)
                     return Object.Reference is
        Obj : Object.Reference;
        Arg : Argument.List;  
        Mess : Message.List;  
        The_Message_Valeurs : Message.Tiny_String;
    begin  
        Bounded_String.Copy (The_Message_Valeurs, Bloc_Classe.Message_Valeurs);
        for I in Object.Get_Value (Min) .. Object.Get_Value (Max) loop
            Message.Init (Mess);
            Mess := Message.Put (Mess, The_Message_Valeurs);
            Obj := Create (I);  
            Argument.Init (Arg);
            Arg := Argument.Put (Arg, Obj);
            Object.En_Texte (Blk);
            Obj := Bloc_Classe.Send (Blk, Mess, Arg);
        end loop;
        return (Obj);
    end Repeter;


    function "+" (A, B : Object.Reference) return Object.Reference is  
        Obj : Object.Reference;
    begin  
        Obj := Create (Object.Get_Value (A) + Object.Get_Value (B));
        return (Obj);
    end "+";

    function "-" (A, B : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        Obj := Create (Object.Get_Value (A) - Object.Get_Value (B));
        return (Obj);
    end "-";

    function "*" (A, B : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        Obj := Create (Object.Get_Value (A) * Object.Get_Value (B));
        return (Obj);
    end "*";

    function "/" (A, B : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        Obj := Create (Object.Get_Value (A) / Object.Get_Value (B));
        return (Obj);
    end "/";

    function Au_Cube (A : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
        Value : Integer;
    begin  
        Value := Object.Get_Value (A);
        Obj := Create (Value * Value * Value);
        return (Obj);
    end Au_Cube;

    function Greater_Than (A, B : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Get_Value (A) > Object.Get_Value (B) then
            Obj := Boolean_Classe.True;
        else
            Obj := Boolean_Classe.False;
        end if;
        return (Obj);
    end Greater_Than;

    function Lower_Than (A, B : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Get_Value (A) < Object.Get_Value (B) then
            Obj := Boolean_Classe.True;
        else
            Obj := Boolean_Classe.False;
        end if;
        return (Obj);
    end Lower_Than;

    function Greater_Or_Equal (A, B : Object.Reference)
                              return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Get_Value (A) >= Object.Get_Value (B) then
            Obj := Boolean_Classe.True;
        else
            Obj := Boolean_Classe.False;
        end if;
        return (Obj);
    end Greater_Or_Equal;

    function Lower_Or_Equal (A, B : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Get_Value (A) <= Object.Get_Value (B) then
            Obj := Boolean_Classe.True;
        else
            Obj := Boolean_Classe.False;
        end if;
        return (Obj);
    end Lower_Or_Equal;

    function Equal (A, B : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Get_Value (A) = Object.Get_Value (B) then
            Obj := Boolean_Classe.True;
        else
            Obj := Boolean_Classe.False;
        end if;
        return (Obj);
    end Equal;


    function En_Texte (I : Object.Reference) return Object.Reference is
        Valeur : Integer;
    begin  
        Valeur := Object.Get_Value (I);
        Text_Io.Put_Line (Integer'Image (Valeur));
        return (I);
    end En_Texte;

    function Send (To_Object : Object.Reference;
                   The_Message : Message.Selector;
                   With_Arguments : Argument.List) return Object.Reference is
        Obj, Arg1 : Object.Reference;
        Args : Argument.List;
    begin  
        Args := With_Arguments;
        Arg1 := Argument.Get (Args);
        case The_Message is
            when Message.Plus =>
                Obj := To_Object + Arg1;

            when Message.Moins =>
                Obj := To_Object - Arg1;

            when Message.Multiplier =>
                Obj := To_Object * Arg1;

            when Message.Diviser =>
                Obj := To_Object / Arg1;

            when Message.Inferieur =>
                Obj := Lower_Than (To_Object, Arg1);

            when Message.Superieur =>
                Obj := Greater_Than (To_Object, Arg1);

            when Message.Inferieur_Egal =>
                Obj := Lower_Or_Equal (To_Object, Arg1);

            when Message.Superieur_Egal =>
                Obj := Greater_Or_Equal (To_Object, Arg1);

            when Message.Egal =>
                Obj := Equal (To_Object, Arg1);

            when others =>
                Obj := Object.Void_Reference;
        end case;
        return (Obj);
    end Send;

    function Send (To_Object : Object.Reference;
                   The_Message : Message.Tiny_String;
                   With_Arguments : Argument.List) return Object.Reference is
        Result, Arg1, Arg2 : Object.Reference := Object.Void_Reference;
        Args : Argument.List;
    begin  
        Text_Io.Put_Line ("Integer_classe receive the message " &
                          Bounded_String.Image (The_Message));
        Args := With_Arguments;
        if Bounded_String.Image (The_Message) = "fois:" then
            Arg1 := Argument.Get (With_Arguments);  
            Result := Fois (To_Object, Arg1);
        end if;

        if Bounded_String.Image (The_Message) = "repeter:" then
            Arg1 := Argument.Get (With_Arguments);  
            Argument.Next (L => Args, Obj => Arg2);
            Result := Repeter (To_Object, Arg2, Arg1);
        end if;

        return (Result);
    end Send;

    function Send (To_Object : Object.Reference;
                   The_Message : Message.Tiny_String) return Object.Reference is
        Result : Object.Reference := Object.Void_Reference;
    begin
        if Bounded_String.Image (The_Message) = "EnTexte" then
            Result := En_Texte (To_Object);
        end if;
        if Bounded_String.Image (The_Message) = "AuCube" then
            Result := Au_Cube (To_Object);
        end if;  
        return (Result);
    end Send;

end Integer_Classe;