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

⟦2d9a28e5b⟧ TextFile

    Length: 9291 (0x244b)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

-- with Block_Class;
with Bounded_String;
with Object;
with String_Utilities;
with Text_Io;

package body Class_Integer is
    function Send (This_Message : Object.Unary; To : Object.Reference)
                  return Object.Reference is
        type Message is (Moins, En_Texte);

        Token : Message;

        package Bs renames Bounded_String;
        package Su renames String_Utilities;

    begin
        if Bs.Length (Object.Get (This_Message)) /= 0 then  
            declare  
                use Object;  
                An_Object : Object.Reference := To;
            begin
                Token := Message'Value (Bs.Image (Object.Get (This_Message)));
                case Token is
                    when En_Texte =>
                        Text_Io.Put ("Objet Integer (");
                        Text_Io.New_Line;

                        Text_Io.Put ("    Classe =>");
                        Text_Io.Put (Object.E_Class'Image (Object.Get (To)));
                        Text_Io.New_Line;

                        Text_Io.Put ("    Valeur =>");
                        Text_Io.Put (Object.Index'Image (Object.Get (To)));
                        Text_Io.New_Line;

                        Text_Io.Put (")");
                        Text_Io.New_Line (2);  
                        return An_Object;
                    when Moins =>  
                        Object.Put (-Object.Index'(Object.Get (An_Object)),
                                    An_Object);
                        return An_Object;
                end case;
            exception
                when Constraint_Error =>
                    return Object.Void_Reference;
            end;
        end if;
    end Send;

    function Send (This_Message : Object.Binary; To : Object.Reference)
                  return Object.Reference is
        type Message is (Prendre, Plus, Moins, Mul, Div, Egal,
                         Diff, Sup, Sup_Egal, Inf, Inf_Egal);

        Token : Message;

        package Bs renames Bounded_String;
        package Su renames String_Utilities;

    begin
        if Bs.Length (Object.Get (This_Message)) /= 0 then
            declare
                use Object;
                An_Object : Object.Reference := To;
                Value : Object.Index;
            begin
                Token := Message'Value (Bs.Image (Object.Get (This_Message)));
                case Token is
                    when Prendre =>
                        null;
                    when Plus =>
                        Object.Put (Object.Get (An_Object) +
                                    Object.Get (Object.Get (This_Message)),
                                    An_Object);
                        return An_Object;
                    when Moins =>
                        Object.Put (Object.Get (An_Object) -
                                    Object.Get (Object.Get (This_Message)),
                                    An_Object);
                        return An_Object;
                    when Mul =>
                        Object.Put (Object.Get (An_Object) *
                                    Object.Get (Object.Get (This_Message)),
                                    An_Object);
                        return An_Object;
                    when Div =>  
                        Object.Put (Object.Get (An_Object) /
                                    Object.Get (Object.Get (This_Message)),
                                    An_Object);
                        return An_Object;
                    when Egal =>
                        Value := Object.Get (Object.Get (This_Message));
                        Object.Put (Value, An_Object);
                        return An_Object;
                    when Diff =>
                        if Object.Index'(Object.Get
                                            (Object.Get (This_Message))) /=
                           Object.Get (An_Object) then
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 1);
                        else
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 0);
                        end if;
                    when Sup =>
                        if Object.Index'(Object.Get
                                            (Object.Get (This_Message))) >
                           Object.Get (An_Object) then
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 1);
                        else
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 0);
                        end if;
                    when Sup_Egal =>
                        if Object.Index'(Object.Get
                                            (Object.Get (This_Message))) >=
                           Object.Get (An_Object) then
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 1);
                        else
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 0);
                        end if;
                    when Inf =>
                        if Object.Index'(Object.Get
                                            (Object.Get (This_Message))) <
                           Object.Get (An_Object) then
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 1);
                        else
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 0);
                        end if;
                    when Inf_Egal =>
                        if Object.Index'(Object.Get
                                            (Object.Get (This_Message))) <=
                           Object.Get (An_Object) then
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 1);
                        else
                            return Object.Create (Class => Object.Boolean_Class,
                                                  Object => 0);
                        end if;
                end case;
            exception
                when Constraint_Error =>
                    return Object.Void_Reference;
            end;
        end if;
    end Send;


    function Send (This_Message : Object.Keyword; To : Object.Reference)
                  return Object.Reference is
        type Message is (Fois, A_Repeter);

        Token : Message;

        package Bs renames Bounded_String;
        package Su renames String_Utilities;

    begin
        if Bs.Length (Object.Get (This_Message)) /= 0 then
            declare
                Value : Object.Reference;
            begin
                Token := Message'Value (Bs.Image (Object.Get (This_Message)));
                case Token is
                    when Fois =>
                        for I in 1 .. Object.Get (To) loop
                            null;
                            -- Value := Block_Class.Send (This_Message, To);
                        end loop;  
                        return Value;
                    when A_Repeter =>
                        -- for I in Object.Get (To) ..
                        --            Object.Get (Object.Get (This_Message)) loop
                        null;
                        -- Value := Block_Class.Send (This_Message, To);
                        -- end loop;
                        return Value;
                end case;
            exception
                when Constraint_Error =>
                    return Object.Void_Reference;
            end;
        end if;
    end Send;


    function Create (Value : Object.Index := 0) return Object.Reference is
        An_Object : Object.Reference;
    begin
        Object.Put (Object.Integer_Class, An_Object);
        Object.Put (Value, An_Object);
        return An_Object;
    end Create;


    function Image (Objet : Object.Reference)
                   return Bounded_String.Variable_String is
        use Object;
        Chaine : Bounded_String.Variable_String (25);
        Valeur : Object.Index;
    begin
        Valeur := Object.Get (Objet);
        Bounded_String.Copy (Chaine, String_Utilities.Number_To_String
                                        (Value => Integer (Valeur)));
        return Chaine;
    end Image;


    function Value (Chaine : Object.Tiny_String) return Object.Reference is
        An_Object : Object.Reference;
        Bool : Boolean;
        Entier : Integer;
    begin
        String_Utilities.String_To_Number
           (Source => Bounded_String.Image (Chaine),
            Worked => Bool,
            Target => Entier);  
        Object.Put (Object.Integer_Class, An_Object);
        Object.Put (Object.Index (Entier), An_Object);
        return An_Object;
    end Value;

end Class_Integer;