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

⟦c6a642155⟧ TextFile

    Length: 5519 (0x158f)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Context;
with Engine_Lex_Mea;
with Instance;
with Text_Io;
with Tuple;
with Tuple_Collection;


with Pilote, Avion, Permis;

procedure Aeroport_Lex is

    package Pilotes_Et_Avions is
        procedure Recherche_Des_Pilotes;
    end Pilotes_Et_Avions;


    package body Pilotes_Et_Avions is

-----------------------------------------------------------------------------
--          REGLES
-----------------------------------------------------------------------------

--  Regle 1 : recherche pilote de plus de 35 ans pilotant un B747
-------------------------------------------------------------------------
        function Match_1 (P : Pilote.Object; Pe : Permis.Object)
                         return Boolean is
        begin
            return Pilote.L_Age (P) >= 35 and then
                      not Pilote.Flag_Traite (P) and then
                      (Permis.La_Licence (Pe) = Pilote.La_Licence (P) and
                       Permis.Le_Nom (Pe) = "B747                          ");
        end Match_1;

        function Rule_1 is
           new Tuple_Collection.Join_2 (Collection_1 => Pilote.Les_Pilotes,
                                        Collection_2 => Permis.Les_Permis,
                                        Match        => Match_1);

        function Pilote_35_B747_C return Tuple_Collection.Object is
        begin
            return Rule_1;
        end Pilote_35_B747_C;


        procedure Pilote_35_B747_A (Mg : Tuple.Object) is
            P : Pilote.Object;
        begin
            Tuple.Split (The_Tuple => Mg, In_Ref1 => P);
            Pilote.Modifier (P, True);
            Text_Io.Put_Line ("PILOTES_35_747 : " & Pilote.Le_Nom (P));
        end Pilote_35_B747_A;


--  Regle 2 : recherche tous les pilotes pilotant un B747
-------------------------------------------------------------------------
        function Match_2 (P : Pilote.Object; Pe : Permis.Object)
                         return Boolean is
        begin
            return not Pilote.Flag_Traite (P) and then
                      (Permis.La_Licence (Pe) = Pilote.La_Licence (P) and
                       Permis.Le_Nom (Pe) = "B747                          ");
        end Match_2;

        function Rule_2 is
           new Tuple_Collection.Join_2 (Collection_1 => Pilote.Les_Pilotes,
                                        Collection_2 => Permis.Les_Permis,
                                        Match        => Match_2);

        function Pilotes_747_C return Tuple_Collection.Object is
        begin
            return Rule_2;
        end Pilotes_747_C;

        procedure Pilotes_747_A (Mg : Tuple.Object) is
            P  : Pilote.Object;  
            Pe : Permis.Object;
        begin  
            Tuple.Split (The_Tuple => Mg, In_Ref1 => P, In_Ref2 => Pe);
            Pilote.Modifier (P, True);
            Text_Io.Put_Line ("PILOTES_747 : " & Pilote.Le_Nom (P) &
                              " avec le permis " & Permis.La_Licence (Pe));
        end Pilotes_747_A;



-----------------------------------------------------------------------------
--          FAITS
-----------------------------------------------------------------------------

        procedure Creer_Faits is
        begin
            Pilote.Effacer_Faits;
            Avion.Effacer_Faits;
            Permis.Effacer_Faits;
            Pilote.Creer_Faits;
            Avion.Creer_Faits;
            Permis.Creer_Faits;
        end Creer_Faits;


-----------------------------------------------------------------------------
--          MOTEUR D'INFERENCE
-----------------------------------------------------------------------------

        package Recherche_Pilote_1 is
           new Engine_Lex_Mea (Context_Name => "Pilote_1",
                               Resolution   => Context.Lex,
                               Used_Rules   => 1,
                               Name_1       => "Pilotes_35_747",
                               Condition_1  => Pilote_35_B747_C,
                               Action_1     => Pilote_35_B747_A);

        package Recherche_Pilote_2 is
           new Engine_Lex_Mea (Context_Name => "Pilote_2",
                               Resolution   => Context.Lex,
                               Used_Rules   => 1,
                               Name_1       => "Pilotes_747",
                               Condition_1  => Pilotes_747_C,
                               Action_1     => Pilotes_747_A);



-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------

        procedure Recherche_Des_Pilotes is
            Result : Boolean;
        begin
            Text_Io.Put_Line
               ("-------------------------------------------------");
            Creer_Faits;
            --Rulemanager.Mask (Context => "Pilote_1  ", Rule => 1);
            Result := Recherche_Pilote_1.Inference (Instance.Any);
            --Rulemanager.Unmask (Context => "Pilote_1  ", Rule => 1);
            Creer_Faits;
            Result := Recherche_Pilote_2.Inference (Instance.Any);
            Text_Io.Put_Line
               ("-------------------------------------------------");
        end Recherche_Des_Pilotes;


    end Pilotes_Et_Avions;



begin


    -- Debugger.Resetdebug (Debugger.Text);
    -- Debugger.Setdebugon (Debugger.Completly);
    -- Debugger.Refreshdebug;
    -- Debugger.Setdebugoff (Debugger.Conditionevalued);

    Pilotes_Et_Avions.Recherche_Des_Pilotes;

end Aeroport_Lex;