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

⟦63753378e⟧ TextFile

    Length: 31186 (0x79d2)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Text_Io;

separate (Expertsystem)


package body Debugger is

    Textmode : Boolean := True; -- T if 100 % text mode, F if 100 % graphic
    Graffortext : Boolean :=
       False; -- T if we are passing for N step in graphic mode
    Firstmenu : Boolean :=
       False; -- T when 1st context entered has try to start menu
    Wascalled : Boolean :=
       False; -- T when someone has explicitly call the debugger

    type Statearray is array (Itemdebugged) of Boolean;
    State : Statearray;
    Counter : Natural := 0;

    Lastcontext : Natural := 1;
    Lastnumber : Natural := 1;
    Currentcontext : Natural := 1;
    Lastcontextentered : Natural := 0;
    Laststrategy : Strategyname;

    Bell : constant Character := Character'Val (7);
    Aaah : constant Natural := Character'Pos ('A');
    Space : constant Natural := Character'Pos (' ');
    Zero : constant Natural := Character'Pos ('0');


    package Entier_Io is new Text_Io.Integer_Io (Integer);


    Firstitem : constant Itemdebugged := Contextentered;
    Lastitem : constant Itemdebugged := Actionfact;

    Grafnr : Natural := Itemdebugged'Pos (Lastitem) + 1;
    Contnr : Natural := Itemdebugged'Pos (Lastitem) + 2;
    Runnr : Natural := Itemdebugged'Pos (Lastitem) + 3;
    Brkpnr : Natural := Itemdebugged'Pos (Lastitem) + 4;
    Exitnr : Natural := Itemdebugged'Pos (Lastitem) + 5;
    Listnr : Natural := Itemdebugged'Pos (Lastitem) + 6;

    subtype Commandname is String (1 .. 22);
    Cmdname : array (Itemdebugged) of Commandname :=
       ("ENTREE EN CONTEXTE    ", "STRATEGIE UTILISEE    ",
        "DEBUT ENS. DE CONFLIT ", "FIN   ENS. DE CONFLIT ",
        "CONDITIONS EVALUEES   ", "REGLES CHOISIES       ",
        "ACTIONS CHOISIES      ", "INSTANCES DES REGLES  ",
        "INSTANCE  DES ACTIONS ",
        others => "                      ");


    Steptojump : Natural := 1;
    Stepcounter : Natural := 0;

    type Bpinfo is
        record
            Bprulenumber : Ruleid := 0;
            Bpcontextnumber : Contextid := 0;
            Bptimesnumber : Natural := 0;
            Bpcounter : Natural := 0;
            Bpused : Boolean := False;
        end record;

    Bplist : array (Contextid) of Bpinfo;
    Bpcount : Natural := 0;
    Bpstate : Statearray;
    Bpsaved : Boolean := False;

    Contlist : array (Contextid) of Contextname;
    Rulelist : array (Contextid, Ruleid) of Rulename;

    package Dbtext is

        procedure Sendcontextentered (Name : Contextname; Number : Contextid);
        procedure Sendstrategyused (Name : Strategyname);
        procedure Sendconflictsetstarted;
        procedure Sendconflictsetfinished;
        procedure Sendconditionevalued (Name : Rulename;
                                        Number : Natural;
                                        Result : Boolean;
                                        Facts : Tuplecollection.Object);
        procedure Sendchoosedrule (Number : Natural; Fact : Tuple.Object);
        procedure Sendchoosedaction
                     (Name : Rulename; Number : Natural; Fact : Tuple.Object);
        procedure Sendnewstep;
        procedure Sendfailed;
        procedure Resetdebug;
        procedure Refreshdebug;

    end Dbtext;


    package Dbgraph is

        procedure Sendcontextentered (Name : Contextname; Number : Contextid);
        procedure Sendstrategyused (Name : Strategyname);
        procedure Sendconflictsetstarted;
        procedure Sendconflictsetfinished;
        procedure Sendconditionevalued (Name : Rulename;
                                        Number : Natural;
                                        Result : Boolean;
                                        Facts : Tuplecollection.Object);
        procedure Sendchoosedrule (Number : Natural; Fact : Tuple.Object);
        procedure Sendchoosedaction
                     (Name : Rulename; Number : Natural; Fact : Tuple.Object);
        procedure Sendnewstep;
        procedure Sendfailed;
        procedure Resetdebug;
        procedure Refreshdebug;

    end Dbgraph;


    procedure Menulist is
        Choice : Character;
        Cont : Contextid;
        Touche : Character;
    begin
        Put_Line ("");
        Put_Line ("       LISTE DES REGLES ET ETAT DE CHACUNES    ");
        Put_Line ("");
        Put ("Donnez le numero du contexte desire 1..8 > ");
        Get (Choice);
        if Choice > '0' and Choice <= '8' then
            Cont := Contextid'Val (Character'Pos (Choice) - Zero);
        else
            Cont := 1;
        end if;
        Put ("Le nom de ce contexte est ");
        Put_Line (Contlist (Cont));

        for I in 1 .. Ruleid'Last loop
            Put (I);
            Put (" : ");
            Put (Rulelist (Cont, I));
            if Rulemanager.Ismasked (Cont, I) then
                Put (" M ");
            else
                Put (" - ");
            end if;
            if (I mod 2) = 0 then
                Put_Line ("");
            end if;
        end loop;
        Put_Line ("");
        Put ("Pressez S et RETURN pour revenir au MENU du DEBUGGER > ");
        Get (Touche);
    end Menulist;

    procedure Menubreak is
        Letter : Natural;
        Choice : Character;
    begin
        loop
            Put_Line ("");
            Put_Line
               ("MENU DES POINTS D'ARRET. Repondre 0,0,xxx pour desarmer un point d'arret");
            Put_Line ("");
            Put_Line
               ("   Numero   Numero   Numero     Compteur     Maxi   Etat");
            Put_Line
               ("    point    regle   contexte   passage    passage  point");
            Put_Line
               ("===========================================================");
            for I in 1 .. Contextid'Last loop
                Put (I);
                Put ("    ");
                Put (Bplist (I).Bprulenumber);
                Put ("    ");
                Put (Bplist (I).Bpcontextnumber);
                Put ("    ");
                Put (Bplist (I).Bpcounter);
                Put ("    ");
                Put (Bplist (I).Bptimesnumber);
                Put ("    ");
                if Bplist (I).Bpused then
                    Put_Line ("  ON");
                else
                    Put_Line ("  OFF");
                end if;
            end loop;
            Put ("  Tapez un chiffre (1..8 ou 0 pour sortir) >");

            Get (Choice);
            if Choice >= '0' and Choice <= '8' then
                Letter := Character'Pos (Choice) - Zero;
            else
                Letter := 500;
            end if;

            if Letter >= 1 and Letter <= 8 then
                Put ("Indiquer les caracteristiques du POINT d'ARRET No ");
                Put (Letter);
                Put_Line ("");
                Put ("   Numero de la regle a attendre (0 ou 1-30) ==>");
                Entier_Io.Get (Bplist (Letter).Bprulenumber);
                Put ("   Numero du contexte concerne (0 ou 1-8)    ==>");
                Entier_Io.Get (Bplist (Letter).Bpcontextnumber);
                Put ("   Nombre de passage avant arret (0 ou +)    ==>");
                Entier_Io.Get (Bplist (Letter).Bptimesnumber);
                Put_Line ("");

                Bplist (Letter).Bpcounter := 0;

                if Bplist (Letter).Bprulenumber = 0 and
                   Bplist (Letter).Bpcontextnumber = 0 then
                    Bplist (Letter).Bpused := False;
                    Bpcount := Bpcount - 1;
                else
                    Bplist (Letter).Bpused := True;
                    Bpcount := Bpcount + 1;
                end if;
            else
                if Letter = 0 then
                    exit;
                end if;
            end if;
        end loop;
    end Menubreak;



    procedure Menu is
        Letter : Natural;
        Choice : Character;

        procedure Turntograf is
        begin
            Put ("  Combien de pas (1..32000) >");
            Entier_Io.Get (Steptojump);
            Dbgraph.Refreshdebug;
            Textmode := False;
            Graffortext := True;
            if Bpsaved = False then
                Bpstate := State;
                State := (others => True);
            end if;
        end Turntograf;

        procedure Jumpnstep is
        begin
            Put ("  Combien de pas (1..32000) >");
            if Bpsaved = False then
                Bpstate := State;
                Bpsaved := True;
                State := (others => False);
                State (Choosedrule) := True;
            end if;
            Entier_Io.Get (Steptojump);
        end Jumpnstep;

    begin
        loop
            Put_Line ("");
            Put ("               MENU DEBUGGER          COMPTE-TOUR MOTEUR : ");
            Put (Counter);
            Put_Line ("");
            Put_Line ("");
            for I in Firstitem .. Lastitem loop
                Put (Character'Val (Aaah + Itemdebugged'Pos (I)));
                Put (" : ");
                Put (Cmdname (I));
                if State (I) then
                    Put ("  oui        ");
                else
                    Put ("     non     ");
                end if;
                if (Itemdebugged'Pos (I) mod 2) = 1 then
                    Put_Line ("");
                end if;
                Letter := Itemdebugged'Pos (I);
            end loop;

            Put (Character'Val (Aaah + Grafnr));
            Put (" : ");
            Put ("pour CONTINUER de X pas en GRAPHIQUE");

            Put_Line ("");
            Put (Character'Val (Aaah + Contnr));
            Put (" : ");
            Put ("pour CONTINUER de 1 pas            ");

            Put (Character'Val (Aaah + Runnr));
            Put (" : ");
            Put_Line ("pour CONTINUER de X pas");

            Put (Character'Val (Aaah + Brkpnr));
            Put (" : ");
            Put ("pour le menu des POINTS D'ARRET    ");

            Put (Character'Val (Aaah + Exitnr));
            Put (" : ");
            Put_Line ("pour TOUT ARRETER D'URGENCE");

            Put (Character'Val (Aaah + Listnr));
            Put (" : ");
            Put ("pour la liste d'ETAT des REGLES ");

            Put_Line ("");
            Put ("  Tapez une lettre SVP >");

            Get (Choice);

            if Choice >= 'a' and Choice <= 'z' then
                Letter := Character'Pos (Choice) - Aaah - Space;
            elsif Choice >= 'A' and Choice <= 'Z' then
                Letter := Character'Pos (Choice) - Aaah;
            else
                Letter := 500;
            end if;

            if Letter >= Itemdebugged'Pos (Firstitem) and
               Letter <= Itemdebugged'Pos (Lastitem) then
                State (Itemdebugged'Val (Letter)) :=
                   not State (Itemdebugged'Val (Letter));
            else
                if Letter = Exitnr then
                    raise Program_Error;
                elsif Letter = Grafnr then
                    Turntograf;
                    exit;
                elsif Letter = Contnr then
                    Steptojump := 1;
                    exit;
                elsif Letter = Runnr then
                    Jumpnstep;
                    exit;
                elsif Letter = Brkpnr then
                    Menubreak;
                elsif Letter = Listnr then
                    Menulist;
                else
                    Put (Bell);
                end if;
            end if;
        end loop;
        Put_Line ("");
    end Menu;


    procedure Breakptsupdate (Number : Natural) is
    begin
        if Bpcount /= 0 then
            for I in 1 .. Contextid'Last loop
                if Bplist (I).Bpcontextnumber = Lastcontextentered and
                   Bplist (I).Bprulenumber = Number  
                    then
                    Bplist (I).Bpcounter := Bplist (I).Bpcounter + 1;
                end if;
            end loop;
        end if;
    end Breakptsupdate;

    function Breakptsarrived return Boolean is
    begin
        if Bpcount = 0 then
            return False;
        else
            for I in 1 .. Contextid'Last loop
                if Bplist (I).Bpcounter >= Bplist (I).Bptimesnumber and
                   Bplist (I).Bpcounter /= 0 and Bplist (I).Bpused then
                    Bplist (I).Bpcounter := 0;
                    Put (Bell);
                    Put_Line ("D# *******************************");
                    Put_Line ("D# *** POINT D'ARRET RENCONTRE ***");
                    Put_Line ("D# *******************************");
                    return True;
                end if;
            end loop;
            return False;
        end if;
    end Breakptsarrived;




    package body Dbtext is

        procedure Displayref (Aref : Expertsystem.Reference) is
        begin
            Put (Classidentity.Unknownclassname (Aref));
            Put (".");
            Put (Classidentity.Unknownobjectname (Aref));
            Put (" ");
        end Displayref;

        procedure Displaytuple0 is new Tuple.Forall (Displayref);
        procedure Displaytuple (Atuple : Tuple.Object) is
        begin
            Put ("D#   Instance : ");
            Displaytuple0 (Atuple);
            Put_Line (" ");
        end Displaytuple;

        procedure Displaytuplecollection0 is
           new Tuplecollection.Forall (Displaytuple);
        procedure Displaytuplecollection (Tc : Tuplecollection.Object) is
        begin
            Displaytuplecollection0 (Tc);
        end Displaytuplecollection;


        procedure Sendcontextentered (Name : Contextname; Number : Contextid) is
        begin
            if Number /= Lastcontextentered then
                Lastcontextentered := Number;
                if State (Contextentered) then
                    Put_Line (" ");
                    Put ("D# Nouveau contexte No ");
                    Put (Number);
                    Put (" : ");
                    Put_Line (Name);
                end if;
            end if;
            if not Firstmenu then
                if Wascalled then
                    Menu;
                end if;
                Firstmenu := True;
            end if;
        end Sendcontextentered;

        procedure Sendstrategyused (Name : Strategyname) is
        begin
            if State (Strategyused) and Laststrategy /= Name then
                Put ("D# Strategie utilisee : ");
                Put_Line (Name);
                Laststrategy := Name;
            end if;
        end Sendstrategyused;

        procedure Sendconflictsetstarted is
        begin
            if State (Conflictsetstarted) then
                Put_Line (" ");
                Put_Line ("D# Construction de l'ensemble de conflit ... ");
            end if;
        end Sendconflictsetstarted;

        procedure Sendconflictsetfinished is
        begin
            if State (Conflictsetfinished) then
                Put_Line ("D# Ensemble de conflit termine.");
                Put_Line (" ");
            end if;
        end Sendconflictsetfinished;

        procedure Sendconditionevalued (Name : Rulename;
                                        Number : Natural;
                                        Result : Boolean;
                                        Facts : Tuplecollection.Object) is
        begin
            if State (Conditionevalued) then
                Put ("D# Evaluation regle No ");
                Put (Number);
                if Result then
                    Put (" => VRAI : ");
                else
                    Put (" => FAUX : ");
                end if;
                Put_Line (Name);

            end if;
            if State (Rulefacts) and Tuplecollection.Isnotnull (Facts) then
                Put_Line ("D# Faits impliques :");
                Displaytuplecollection (Facts);
            end if;
        end Sendconditionevalued;

        procedure Sendchoosedrule (Number : Natural; Fact : Tuple.Object) is
        begin
            Breakptsupdate (Number);
            if State (Choosedrule) and Steptojump = 1 then
                Put ("D# Regle choisie : No ");
                Put (Number);
                Put_Line (" ");
            end if;
            if State (Rulefacts) and Tuple.Isnotnull (Fact) then
                Put_Line ("D# Faits impliques :");
                Displaytuple (Fact);
            end if;
            if Breakptsarrived then
                if Bpsaved then
                    State := Bpstate;
                    Bpsaved := False;
                end if;
                Menu;
                Stepcounter := 0;
            end if;

        end Sendchoosedrule;

        procedure Sendchoosedaction
                     (Name : Rulename; Number : Natural; Fact : Tuple.Object) is
        begin
            if State (Choosedaction) then
                Put_Line (" ");
                Put ("D# Action executee : No ");
                Put (Number);
                Put (" = ");
                Put_Line (Name);
            end if;
            if State (Actionfact) and Tuple.Isnotnull (Fact) then
                Put_Line ("D# Fait concerne :");
                Displaytuple (Fact);
            end if;
        end Sendchoosedaction;

        procedure Sendnewstep is
        begin
            if Counter >= Natural'Last then
                Counter := 0;
            end if;
            Counter := Counter + 1;
            if State (Newstep) and Steptojump = 1 then
                Put ("D# Compte-tour moteur : ");
                Put (Counter);
                Put_Line (" ");
            end if;
            Stepcounter := Stepcounter + 1;
            if Stepcounter = Steptojump then
                if Bpsaved then
                    State := Bpstate;
                    Bpsaved := False;
                end if;
                Menu;
                Stepcounter := 0;
            end if;
        end Sendnewstep;

        procedure Sendfailed is
        begin
            if State (Failed) or Steptojump /= 1 then
                Put ("D# Plus de regle valide. ");
                Put_Line (" ");
            end if;
        end Sendfailed;

        procedure Resetdebug is
        begin
            Setdebugoff (Completly);
            Counter := 0;
            Steptojump := 1;
            Stepcounter := 0;
            Lastcontextentered := 0;
            Laststrategy := "     ";
            for I in Contextid loop
                Bplist (I).Bpused := False;
            end loop;
            Bpcount := 0;
            Bpsaved := False;
        end Resetdebug;

        procedure Refreshdebug is
        begin
            null;
        end Refreshdebug;

    end Dbtext;

    package body Dbgraph is


        procedure Sendcontextentered (Name : Contextname; Number : Contextid) is
        begin
            Currentcontext := Number;
            if Number /= Lastcontextentered then
                Lastcontextentered := Number;
                if State (Contextentered) then
                    Terminal.Atxy (1, 11);
                    Put ("Contexte courant : ");
                    Put_Line (Name);
                    Terminal.Atxy (1, 15);
                end if;
            end if;

        end Sendcontextentered;

        procedure Sendstrategyused (Name : Strategyname) is
        begin
            if State (Strategyused) and Name /= Laststrategy then
                Terminal.Atxy (50, 11);
                Put ("Strategie courante : ");
                Put_Line (Name);
                Terminal.Atxy (1, 15);
                Laststrategy := Name;
            end if;
        end Sendstrategyused;

        procedure Sendconflictsetstarted is
        begin
            if State (Conflictsetstarted) then
                Terminal.Atxy (1, 12);
                Put ("                                                  ");
                Terminal.Atxy (1, 12);
                Put ("Construction de l'ensemble de conflit ... ");
                Terminal.Atxy (1, 15);
            end if;
        end Sendconflictsetstarted;

        procedure Sendconflictsetfinished is
        begin
            if State (Conflictsetfinished) then
                Terminal.Atxy (1, 12);
                Put ("                                                  ");
                Terminal.Atxy (1, 12);
                Put ("Ensemble de conflit termine. ");
                Terminal.Atxy (1, 15);
            end if;
        end Sendconflictsetfinished;

        procedure Sendconditionevalued (Name : Rulename;
                                        Number : Natural;
                                        Result : Boolean;
                                        Facts : Tuplecollection.Object) is
            Nb : Natural;
        begin
            Terminal.Atxy (Number + 1, Currentcontext + 1);
            Nb := Tuplecollection.Cardinality (Facts);
            if Nb = 0 then
                Put ('.');
            else
                if Nb > 9 then
                    Put ('+');
                else
                    Put (Character'Val (Nb + Zero));
                end if;
            end if;
            Terminal.Atxy (1, 15);
        end Sendconditionevalued;

        procedure Sendchoosedrule (Number : Natural; Fact : Tuple.Object) is
            Nb : Natural;
            Touche : Character;
        begin
            Breakptsupdate (Number);
            if State (Choosedrule) and Number /= 0 then
                Terminal.Atxy (Lastnumber + 41, Lastcontext + 1);
                Put ('.');
                Terminal.Atxy (Number + 41, Currentcontext + 1);
                Put ('*');
                Lastnumber := Number;
                Lastcontext := Currentcontext;
                Terminal.Atxy (1, 15);
                Put
                   ("                                                                    ");
                Terminal.Atxy (1, 15);
            end if;
            if Breakptsarrived then
                if Bpsaved then
                    State := Bpstate;
                    Bpsaved := False;
                end if;
                Graffortext := False;
                Textmode := True;
                Put
                   ("Pressez S et RETURN pour revenir au DEBUGGER en mode TEXT > ");
                Get (Touche);
                Menu;
                Stepcounter := 0;
            end if;

        end Sendchoosedrule;

        procedure Sendchoosedaction
                     (Name : Rulename; Number : Natural; Fact : Tuple.Object) is
        begin
            null;
        end Sendchoosedaction;

        procedure Sendnewstep is
            Touche : Character;
        begin
            if Counter >= Natural'Last then
                Counter := 0;
            end if;
            Counter := Counter + 1;
            if State (Newstep) then
                Terminal.Atxy (53, 12);
                Put ("Compte-tour moteur : ");
                Put (Counter);
                delay 1.0;
                Terminal.Atxy (1, 15);
            end if;

            if Graffortext then
                Stepcounter := Stepcounter + 1;
                if Stepcounter = Steptojump then
                    if Bpsaved then
                        State := Bpstate;
                        Bpsaved := False;
                    end if;
                    Graffortext := False;
                    Textmode := True;
                    Put
                       ("Pressez S et RETURN pour revenir au DEBUGGER en mode TEXT > ");
                    Get (Touche);
                    Menu;
                    Stepcounter := 0;
                end if;
            end if;

        end Sendnewstep;

        procedure Sendfailed is
        begin
            Counter := 0;
            if State (Failed) then
                Terminal.Atxy (1, 12);
                Put ("                                                  ");
                Terminal.Atxy (1, 12);
                Put ("Plus de regle valide. ");
                Terminal.Atxy (1, 15);
            end if;
        end Sendfailed;

        procedure Resetdebug is
        begin
            Counter := 0;
            Setdebugoff (Completly);
        end Resetdebug;


        procedure Refreshdebug is
        begin
            Terminal.Clear;
            Terminal.Atxy (1, 1);
            Put (' ');
            for I in 1 .. Ruleid'Last loop
                Put (Character'Val (Zero + (I mod 10)));
            end loop;
            Terminal.Atxy (41, 1);
            Put (' ');
            for I in 1 .. Ruleid'Last loop
                Put (Character'Val (Zero + (I mod 10)));
            end loop;
            for I in 1 .. Contextid'Last loop
                Terminal.Atxy (1, I + 1);
                Put (Character'Val (Zero + (I mod 10)));
                Terminal.Atxy (41, I + 1);
                Put (Character'Val (Zero + (I mod 10)));
            end loop;
            Terminal.Atxy (1, 10);
            Put
               ("          REGLES EVALUEES                          REGLES CHOISIES");
            Terminal.Atxy (1, 15);
            Laststrategy := "     ";
            Lastcontextentered := 0;
        end Refreshdebug;

    end Dbgraph;




    procedure Sendcontextentered (Name : Contextname; Number : Contextid) is
    begin
        if Textmode then
            Dbtext.Sendcontextentered (Name, Number);
        else
            Dbgraph.Sendcontextentered (Name, Number);
        end if;
    end Sendcontextentered;

    procedure Sendstrategyused (Name : Strategyname) is
    begin
        if Textmode then
            Dbtext.Sendstrategyused (Name);
        else
            Dbgraph.Sendstrategyused (Name);
        end if;
    end Sendstrategyused;

    procedure Sendconflictsetstarted is
    begin
        if Textmode then
            Dbtext.Sendconflictsetstarted;
        else
            Dbgraph.Sendconflictsetstarted;
        end if;
    end Sendconflictsetstarted;

    procedure Sendconflictsetfinished is
    begin
        if Textmode then
            Dbtext.Sendconflictsetfinished;
        else
            Dbgraph.Sendconflictsetfinished;
        end if;
    end Sendconflictsetfinished;

    procedure Sendconditionevalued (Name : Rulename;
                                    Number : Natural;
                                    Result : Boolean;
                                    Facts : Tuplecollection.Object) is
    begin
        if Textmode then
            Dbtext.Sendconditionevalued (Name, Number, Result, Facts);
        else
            Dbgraph.Sendconditionevalued (Name, Number, Result, Facts);
        end if;
    end Sendconditionevalued;

    procedure Sendchoosedrule (Number : Natural; Fact : Tuple.Object) is
    begin
        if Textmode then
            Dbtext.Sendchoosedrule (Number, Fact);
        else
            Dbgraph.Sendchoosedrule (Number, Fact);
        end if;
    end Sendchoosedrule;

    procedure Sendchoosedaction
                 (Name : Rulename; Number : Natural; Fact : Tuple.Object) is
    begin
        if Textmode then
            Dbtext.Sendchoosedaction (Name, Number, Fact);
        else
            Dbgraph.Sendchoosedaction (Name, Number, Fact);
        end if;
    end Sendchoosedaction;

    procedure Sendnewstep is
    begin
        if Textmode then
            Dbtext.Sendnewstep;
        else
            Dbgraph.Sendnewstep;
        end if;
    end Sendnewstep;

    procedure Sendfailed is
    begin
        if Textmode then
            Dbtext.Sendfailed;
        else
            Dbgraph.Sendfailed;
        end if;
    end Sendfailed;

    procedure Refreshdebug is
    begin
        if Textmode then
            Dbtext.Refreshdebug;
        else
            Dbgraph.Refreshdebug;
        end if;
    end Refreshdebug;



    function Isdebugged (What : Itemdebugged) return Boolean is
    begin
        return State (What);
    end Isdebugged;

    procedure Setdebugon (Item : Itemdebugged) is
    begin
        if Item = Completly then
            for I in Itemdebugged loop
                State (I) := True;
            end loop;
        else
            State (Item) := True;
        end if;
    end Setdebugon;

    procedure Setdebugon (Item : Itemset) is
    begin
        for I in Item'Range loop
            Setdebugon (Item (I));
        end loop;
    end Setdebugon;

    procedure Setdebugoff (Item : Itemdebugged) is
    begin
        if Item = Completly then
            for I in Itemdebugged loop
                State (I) := False;
            end loop;
        else
            State (Item) := False;
        end if;
    end Setdebugoff;

    procedure Setdebugoff (Item : Itemset) is
    begin
        for I in Item'Range loop
            Setdebugoff (Item (I));
        end loop;
    end Setdebugoff;

    procedure Resetdebug (Mode : Debuggingmode) is
    begin
        Graffortext := False;
        Wascalled := True;
        if Mode = Text then
            Textmode := True;
            Firstmenu := False;
            Dbtext.Resetdebug;
        else
            Textmode := False;
            Firstmenu := True;
            Dbgraph.Resetdebug;
        end if;  
    end Resetdebug;

    procedure Sendrulesnames
                 (Contextnumber : Contextid;
                  Ctxname : Contextname;
                  Name_1, Name_2, Name_3, Name_4, Name_5, Name_6,
                  Name_7, Name_8, Name_9, Name_10, Name_11, Name_12,
                  Name_13, Name_14, Name_15, Name_16, Name_17, Name_18,
                  Name_19, Name_20, Name_21, Name_22, Name_23, Name_24,
                  Name_25, Name_26, Name_27, Name_28, Name_29, Name_30 :
                     Rulename) is
    begin
        Contlist (Contextnumber) := Ctxname;
        Rulelist (Contextnumber, 1) := Name_1;
        Rulelist (Contextnumber, 2) := Name_2;
        Rulelist (Contextnumber, 3) := Name_3;
        Rulelist (Contextnumber, 4) := Name_4;
        Rulelist (Contextnumber, 5) := Name_5;
        Rulelist (Contextnumber, 6) := Name_6;
        Rulelist (Contextnumber, 7) := Name_7;
        Rulelist (Contextnumber, 8) := Name_8;
        Rulelist (Contextnumber, 9) := Name_9;
        Rulelist (Contextnumber, 10) := Name_10;
        Rulelist (Contextnumber, 11) := Name_11;
        Rulelist (Contextnumber, 12) := Name_12;
        Rulelist (Contextnumber, 13) := Name_13;
        Rulelist (Contextnumber, 14) := Name_14;
        Rulelist (Contextnumber, 15) := Name_15;
        Rulelist (Contextnumber, 16) := Name_16;
        Rulelist (Contextnumber, 17) := Name_17;
        Rulelist (Contextnumber, 18) := Name_18;
        Rulelist (Contextnumber, 19) := Name_19;
        Rulelist (Contextnumber, 20) := Name_20;
        Rulelist (Contextnumber, 21) := Name_21;
        Rulelist (Contextnumber, 22) := Name_22;
        Rulelist (Contextnumber, 23) := Name_23;
        Rulelist (Contextnumber, 24) := Name_24;
        Rulelist (Contextnumber, 25) := Name_25;
        Rulelist (Contextnumber, 26) := Name_26;
        Rulelist (Contextnumber, 27) := Name_27;
        Rulelist (Contextnumber, 28) := Name_28;
        Rulelist (Contextnumber, 29) := Name_29;
        Rulelist (Contextnumber, 30) := Name_30;
    end Sendrulesnames;

begin
    Resetdebug (Text);
    Wascalled := False;
end Debugger;