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

⟦6101e9a64⟧ TextFile

    Length: 8080 (0x1f90)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

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

    function Create (Value : Boolean) return Object.Reference is
        Obj : Object.Reference;  
        Val : Integer;
    begin  
        if Value = Standard.True then
            Val := 1;
        else
            Val := 0;
        end if;
        Obj := Object.Create (Ident_Classe => Object.Boolean_Classe,
                              Ident_Object => Val);
        return (Obj);
    end Create;

    function True return Object.Reference is
        Obj : Object.Reference;
    begin  
        Obj := Create (Standard.True);
        return (Obj);

    end True;

    function False return Object.Reference is
        Obj : Object.Reference;
    begin
        Obj := Create (Standard.False);
        return (Obj);
    end False;

    function "+" (Left, Right : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Get_Value (From_Object => Left) = 1 or
           Object.Get_Value (From_Object => Right) = 1 then
            Obj := Create (Standard.True);
        else
            Obj := Create (Standard.False);
        end if;
        return Obj;
    end "+";

    function "&" (Left, Right : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Get_Value (From_Object => Left) = 1 and
           Object.Get_Value (From_Object => Right) = 1 then
            Obj := Create (Standard.True);
        else
            Obj := Create (Standard.False);
        end if;
        return Obj;
    end "&";

    function Equal (Left, Right : Object.Reference) return Object.Reference is
        Obj : Object.Reference;
    begin
        if Object.Equal (A => Left, B => Right) then
            Obj := Create (Standard.True);
        else
            Obj := Create (Standard.False);
        end if;
        return Obj;


    end Equal;

    function En_Texte (Obj : Object.Reference) return Object.Reference is
        New_String : Message.Tiny_String;
    begin
        Bounded_String.Free (V => New_String);
        if Object.Equal (A => Obj, B => True) then
            Bounded_String.Copy (New_String, "vrai");
        elsif Object.Equal (A => Obj, B => False) then
            Bounded_String.Copy (New_String, "faux");
        else
            null;
        end if;
        return String_Classe.Create (Name => New_String);
    end En_Texte;

    function Not_Value (Obj : Object.Reference) return Object.Reference is
        New_Object : Object.Reference;
    begin
        if Object.Equal (A => Obj, B => True) then
            New_Object := Create (Standard.False);
        elsif Object.Equal (A => Obj, B => False) then
            New_Object := Create (Standard.True);
        else
            null;
        end if;
        return New_Object;
    end Not_Value;

    function Si_Vrai (Obj, Blk : Object.Reference) return Object.Reference is
        The_Message_Valeur : Message.Tiny_String;
        New_Object : Object.Reference := Object.Void_Reference;
    begin
        if Object.Equal (A => Obj, B => True) then
            Bounded_String.Copy (The_Message_Valeur,
                                 Bloc_Classe.Message_Valeur);
            New_Object := Bloc_Classe.Send (Blk, The_Message_Valeur);
        end if;
        return New_Object;
    end Si_Vrai;

    function Si_Faux (Obj, Blk : Object.Reference) return Object.Reference is
        The_Message_Valeur : Message.Tiny_String;
        New_Object : Object.Reference := Object.Void_Reference;
    begin
        if Object.Equal (A => Obj, B => False) then
            Bounded_String.Copy (The_Message_Valeur,
                                 Bloc_Classe.Message_Valeur);
            New_Object := Bloc_Classe.Send (Blk, The_Message_Valeur);
        end if;
        return New_Object;
    end Si_Faux;

    function Si_Vrai_Si_Faux (Obj, Blk1, Blk2 : Object.Reference)
                             return Object.Reference is
        The_Message_Valeur : Message.Tiny_String;
        New_Object : Object.Reference := Object.Void_Reference;
    begin
        Bounded_String.Copy (The_Message_Valeur, Bloc_Classe.Message_Valeur);
        if Object.Equal (A => Obj, B => True) then
            New_Object := Bloc_Classe.Send (Blk1, The_Message_Valeur);
        elsif Object.Equal (A => Obj, B => False) then
            New_Object := Bloc_Classe.Send (Blk2, The_Message_Valeur);
        end if;
        return New_Object;
    end Si_Vrai_Si_Faux;

    function Si_Faux_Si_Vrai (Obj, Blk1, Blk2 : Object.Reference)
                             return Object.Reference is
        The_Message_Valeur : Message.Tiny_String;
        New_Object : Object.Reference := Object.Void_Reference;
    begin
        Bounded_String.Copy (The_Message_Valeur, Bloc_Classe.Message_Valeur);
        if Object.Equal (A => Obj, B => False) then
            New_Object := Bloc_Classe.Send (Blk1, The_Message_Valeur);
        elsif Object.Equal (A => Obj, B => True) then
            New_Object := Bloc_Classe.Send (Blk2, The_Message_Valeur);
        end if;
        return New_Object;
    end Si_Faux_Si_Vrai;


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

            when Message.Et =>
                Arg1 := Argument.Get (L => With_Arguments);
                Obj := 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) return Object.Reference is
        Result : Object.Reference := Object.Void_Reference;
    begin
        if Bounded_String.Image (V => The_Message) = "EnTexte" then
            Result := En_Texte (Obj => To_Object);
        end if;  
        if Bounded_String.Image (V => The_Message) = "non" then
            Result := Not_Value (Obj => To_Object);
        end if;

        return (Result);

    end Send;

    function Send (To_Object : Object.Reference;
                   The_Message : Message.List;
                   With_Arguments : Argument.List) return Object.Reference is
        Result, Arg1, Arg2 : Object.Reference := Object.Void_Reference;
        Args : Argument.List;  
        Message_List : Message.List;
        Message_Receive : Message.Tiny_String;
    begin
        Args := With_Arguments;  
        Message_List := The_Message;
        Message_Receive := Message.Get (L => Message_List);
        if Bounded_String.Image (V => Message_Receive) = "SiVrai:" then
            Arg1 := Argument.Get (L => With_Arguments);
            Message.Next (L => Message_List, Mess => Message_Receive);
            if Bounded_String.Image (V => Message_Receive) = "SiFaux:" then
                Argument.Next (L => Args, Obj => Arg2);
                Result := Si_Vrai_Si_Faux
                             (Obj => To_Object, Blk1 => Arg1, Blk2 => Arg2);
            else
                Result := Si_Vrai (Obj => To_Object, Blk => Arg1);
            end if;
        end if;

        if Bounded_String.Image (V => Message_Receive) = "SiFaux:" then
            Arg1 := Argument.Get (L => With_Arguments);
            Message.Next (L => Message_List, Mess => Message_Receive);
            if Bounded_String.Image (V => Message_Receive) = "SiVrai:" then
                Argument.Next (L => Args, Obj => Arg2);
                Result := Si_Faux_Si_Vrai
                             (Obj => To_Object, Blk1 => Arg1, Blk2 => Arg2);
            else
                Result := Si_Faux (Obj => To_Object, Blk => Arg1);
            end if;
        end if;

        return (Result);

    end Send;


end Boolean_Classe;