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: ┃ T V

⟦c0df2651a⟧ TextFile

    Length: 11557 (0x2d25)
    Types: TextFile
    Names: »V«

Derivation

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

TextFile

with Alias;
with Constant_String;
with Output_Stream;
with Fact_Reference;
with Slot;
generic

    type Class_Names is (<>);
    Null_Class_Name : Class_Names := Class_Names'Last;

    Max_Slots : Natural := 20;


    type Predicate_Object is private;
    Null_Predicate : Predicate_Object;
    type Predicate_Objects is array (Natural range <>) of Predicate_Object;


    with function Predicate_Collection (Of_Objects : Predicate_Objects)
                                       return Predicate_Object is <>;

    with function Predicate_Get_Collection (From_Object : Predicate_Object)
                                           return Predicate_Objects is <>;

    with function Predicate_Match (Value   : Slot.Object;  
                                   Against : Predicate_Object)  
                                  return Boolean is <>;

    with procedure Predicate_Put (The_Expression : Predicate_Object;
                                  Where          : Output_Stream.Object) is <>;

    type Expression_Object is private;

    with function Slot_Object_Expression
                     (For_Object : Slot.Object) return Expression_Object;

    with function Alias_Expression
                     (For_Alias : Alias.Name) return Expression_Object;

    with function Expression_Evaluate
                     (The_Object : Expression_Object) return Slot.Object;

    with procedure Expression_Put (The_Object : Expression_Object;
                                   Where      : Output_Stream.Object);


package Generic_Fact_Base is

    package Query is
        subtype Query_Size      is Natural range 0 .. Max_Slots;
        type    Query_Qualifier is (Find, Check_No, Evaluate);

        subtype Slot_Names is Query_Size range 1 .. Max_Slots;
        subtype Patterns   is Predicate_Objects;

        type Object (Size : Query_Size := 0; Kind : Query_Qualifier := Find) is
            record
                case Kind is
                    when Find | Check_No =>
                        Class : Class_Names;
                        Value : Patterns (1 .. Size);
                    when Evaluate =>
                        The_Expression : Expression_Object;
                        The_Predicate  : Predicate_Object;
                end case;
            end record;

        type Objects is array (Positive range <>) of Object;

        Null_Query   : constant Object  :=
           Query.Object'(Size  => 0,
                         Kind  => Find,
                         Class => Null_Class_Name,
                         Value => (1 .. 0 => Null_Predicate));
        Null_Queries : constant Objects := (1 .. 0 => Null_Query);

        package Operators is  
            function Match (The_Expression : Expression_Object;
                            The_Predicate  : Predicate_Object) return Boolean;

            function Satisfying (E : Expression_Object; P : Predicate_Object)
                                return Object;
            function Satisfying (The_Slot : Slot.Object; P : Predicate_Object)
                                return Object;
            function Satisfying (The_Alias : Alias.Name; P : Predicate_Object)
                                return Object;
            function Satisfying (The_Integer : Integer; P : Predicate_Object)
                                return Object;
            function Satisfying (The_Float : Float; P : Predicate_Object)  
                                return Object;
            function Satisfying (The_Boolean : Boolean; P : Predicate_Object)
                                return Object;
            function Satisfying
                        (The_Character : Character; P : Predicate_Object)
                        return Object;
            function Satisfying (The_String : String; P : Predicate_Object)
                                return Object;
            function Satisfying (The_Duration : Duration; P : Predicate_Object)
                                return Object;

        end Operators;

        procedure Put (The_Query : Object; Where : Output_Stream.Object);
        procedure Put (The_Queries : Objects; Where : Output_Stream.Object);
    end Query;


    package Class is

        type Object is private;
        Null_Class : constant Object;

        subtype User_Object is Fact_Reference.Object;
        Null_User_Object : constant User_Object := Fact_Reference.Null_Object;

        type User_Objects is array (Positive range <>) of User_Object;
        function No_User_Objects return User_Objects;

        type    Instance_Name     is new Natural;
        subtype Instance_Size     is Natural range 0 .. Max_Slots;
        subtype Slot_Names        is Instance_Size range 1 .. Max_Slots;
        type    Slots             is array (Slot_Names range <>) of Slot.Object;
        type    Slot_Names_Images is
              array (Slot_Names range <>) of Constant_String.Object;

        function "=" (Left, Right : User_Object) return Standard.Boolean
            renames Fact_Reference."=";

        function As_User_Object
                    (The_Instance : Instance_Name; For_Class : Class.Object)
                    return User_Object;
        function As_User_Object (The_Slot : Slot.Object) return User_Object;


        function Class_Of      (The_Object : User_Object) return Class.Object;
        function Class_Name_Of (The_Object : User_Object) return Class_Names;
        function Class_Name_Of (The_Object : Object)      return Class_Names;
        function Last_Instance (Of_Class : Object)        return Instance_Name;

        function  Make       (Name       : Class_Names;
                              Class_Size : Natural;
                              Names      : Slot_Names_Images) return Object;
        procedure Make_Empty (The_Class : in out Class.Object);

        function Slot_Name_Image
                    (From_Class : Class.Object; For_Slot : Slot_Names)
                    return String;
        function Match (The_Instance     : Instance_Name;
                        Against_Patterns : Query.Patterns;
                        Using_Class      : Class.Object) return Boolean;

        function Get (The_Object : User_Object) return Slots;

        function Get (The_Object : User_Object; The_Slot : Slot_Names)
                     return Slot.Object;

        procedure Add (To_Class      :     Class.Object;
                       The_Instance  :     Slots;
                       Its_Reference : out Slot.Object);

        procedure Delete (The_Object : User_Object);

        procedure Change (The_Object : User_Object; To_Value : Slots);
        procedure Change (The_Object : User_Object;
                          The_Slot   : Slot_Names;
                          To_Value   : Slot.Object);

        procedure Default_Put (The_Object : User_Object;
                               Where      : Output_Stream.Object);  
        procedure Default_Put (The_Collection : User_Objects;
                               Where          : Output_Stream.Object);
        procedure Default_Put (The_Class : Class.Object;
                               Where     : Output_Stream.Object);
        generic
            with procedure Put (The_Object : User_Object;
                                Where : Output_Stream.Object) is Default_Put;
        procedure Generic_Put (The_Class : Class.Object;
                               Where     : Output_Stream.Object);
        Overflow : exception;

    private

        Null_Instance_Name : constant Instance_Name := 0;

        type Object_Structure (Class_Size : Instance_Name);
        type Object is access Object_Structure;
        Null_Class : constant Object := null;
    end Class;


    generic
        Class_Name : Class_Names;
        Class_Size : Natural;
        type Slot_Names is (<>);
    package Generic_Class is

        type Slots    is array (Slot_Names) of Slot.Object;
        type Patterns is array (Slot_Names) of Predicate_Object;

        function Class_Object              return Class.Object;
        function Exist   (What : Patterns) return Query.Object;
        function Not_Any (What : Patterns) return Query.Object;
        function Absent  (What : Patterns) return Query.Object renames Not_Any;

        function Such_As (What : Patterns) return Predicate_Object;


        function Get (The_Fact : Class.User_Object) return Slots;
        function Get (The_Fact : Class.User_Object; The_Slot : Slot_Names)
                     return Slot.Object;
        function Get (The_Fact : Class.User_Object; The_Slot : Slot_Names)
                     return Class.User_Object;
        function Get (The_Object : Class.User_Object; The_Slot : Slot_Names)
                     return Integer;
        function Get (The_Object : Class.User_Object; The_Slot : Slot_Names)
                     return Boolean;
        function Get (The_Object : Class.User_Object; The_Slot : Slot_Names)
                     return Float;
        function Get (The_Object : Class.User_Object; The_Slot : Slot_Names)
                     return Character;
        function Get (The_Object : Class.User_Object; The_Slot : Slot_Names)
                     return Duration;
        function Get (The_Object : Class.User_Object; The_Slot : Slot_Names)
                     return String;

        procedure Add    (The_Fact : Slots; Its_Reference : out Slot.Object);
        procedure Add    (The_Fact : Slots);
        procedure Delete (The_Fact : Class.User_Object);
        procedure Change (The_Fact : Class.User_Object; Value : Slots);
        procedure Change (The_Fact : Class.User_Object;
                          The_Slot : Slot_Names;
                          To_Value : Slot.Object);
        procedure Change (The_Fact : Class.User_Object;
                          The_Slot : Slot_Names;
                          To_Value : Integer);

        procedure Change (The_Fact : Class.User_Object;
                          The_Slot : Slot_Names;
                          To_Value : Boolean);

        procedure Change (The_Fact : Class.User_Object;
                          The_Slot : Slot_Names;
                          To_Value : Float);

        procedure Change (The_Fact : Class.User_Object;
                          The_Slot : Slot_Names;
                          To_Value : Character);

        procedure Change (The_Fact : Class.User_Object;
                          The_Slot : Slot_Names;
                          To_Value : Duration);

        procedure Change (The_Fact : Class.User_Object;
                          The_Slot : Slot_Names;
                          To_Value : String);

        generic
            with function Image (For_Slot : Slot_Names; Value : Slot.Object)
                                return String;
        procedure Generic_Put (The_Fact : Class.User_Object;
                               Where    : Output_Stream.Object);

        Illegal_Access : exception;
    end Generic_Class;


    package Working_Memory is

        procedure Make_Empty;

        procedure Register (The_Class : Class.Object);
        function  Get      (Using : Class_Names)    return Class.Object;
        function  Retrieve (Filter : Query.Objects) return Class.User_Objects;

        generic
            with procedure Put (The_Fact : Class.User_Object;
                                Where    : Output_Stream.Object) is
               Class.Default_Put;
        procedure Generic_Put (Where : Output_Stream.Object);

        procedure Default_Put (Where : Output_Stream.Object);

    end Working_Memory;
end Generic_Fact_Base;