DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦799d1933d⟧ Ada Source

    Length: 10240 (0x2800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Interpreteur, seg_042f12

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦this⟧ 

E3 Source Code



with Document, Mots, Nombre_De_Mots,
     Numeros_De_Lignes, Text_Io, Gestion_De_Tables;


package body Interpreteur is

    Verbe_Table : Gestion_De_Tables.Tableau;
    Preposition_Table : Gestion_De_Tables.Tableau;
    Complement_Table : Gestion_De_Tables.Tableau;
    Complement2_Table : Gestion_De_Tables.Tableau;
    Compteur : Natural := 1;

    Verbe_Locked : Boolean :=
       False;        -- Pour eviter de chercher dans un tableau qui n'existe pas!
    Preposition_Locked : Boolean := False;
    Complement_Locked : Boolean := False;
    Complement2_Locked : Boolean := False;


    procedure Create_Table (Name_File : in String;
                            Begin_Def, End_Def : in String;
                            Une_Table : in out Gestion_De_Tables.Tableau;
                            Lock : in out Boolean) is
        Read_Word : Mots.Mot;
        Num_Line : Numeros_De_Lignes.Numero;

        function Equal (Chaine1 : String; Chaine2 : String) return Boolean

            renames Standard."=";

    begin
        Document.Fopen (Name_File);
        while not Document.En_Fin_De_Fichier loop
            Document.File_Get (Read_Word, Num_Line);
            if Equal (Mots.Valeur (Read_Word), Begin_Def) then
                loop
                    Document.File_Get (Read_Word, Num_Line);
                    exit when Equal (Mots.Valeur (Read_Word), End_Def);
                    Une_Table (Compteur) := new
                                               String'(Mots.Valeur (Read_Word));
                    Compteur := Compteur + 1;
                    Text_Io.Put_Line (Mots.Valeur (Read_Word));
                end loop;
                Une_Table (Compteur .. 80) := (others => (new String'(" ")));
            end if;
        end loop;
        Document.Fclose;
        Compteur := 1;
        Lock := True;

    end Create_Table;

    procedure File_Interprete (File_Name : in String) is


    begin
        Create_Table (File_Name, "Debut_Verbes", "Fin_Verbes",
                      Verbe_Table, Verbe_Locked);
        Create_Table (File_Name, "Debut_Prepositions", "Fin_Prepositions",
                      Preposition_Table, Preposition_Locked);
        Create_Table (File_Name, "Debut_Complements", "Fin_Complements",
                      Complement_Table, Complement_Locked);
        Create_Table (File_Name, "Debut_Complements2", "Fin_Complements2",
                      Complement2_Table, Complement2_Locked);

    end File_Interprete;

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


    procedure Interprete is
        Mot_Lu : Mots.Mot;
        Num_Word : Nombre_De_Mots.Numero;
        Line_Fini : Boolean := False;

    begin
        Mots.Creer (Mot_Lu, "");
        loop
            Document.Open;
            Text_Io.Put ("/:> ");
            Loop_A_Instruction:
                loop
                    Document.Get (Mot_Lu, Num_Word, Line_Fini);

                    if (Num_Word > Nombre_De_Mots.Nombre_Max_Mots) then
                        Text_Io.Put_Line
                           ("Une instruction ne comporte pas plus de quatre mots !");
                        exit Loop_A_Instruction;
                    elsif Mots.Valeur (Mot_Lu) = "quit" then
                        raise End_Of_Play;  
                    elsif (Num_Word > 0) then
                        if Mots.Valeur (Mot_Lu) /= "nothing" then  
                            if Verbe_Locked and then
                               Gestion_De_Tables.Chercher_Dans_Table
                                  (Verbe_Table, Mot_Lu) then
                                Text_Io.Put_Line ("Mot correct");
                            elsif Preposition_Locked and then
                                  Gestion_De_Tables.Chercher_Dans_Table
                                     (Preposition_Table, Mot_Lu) then
                                Text_Io.Put_Line ("Mot correct");
                            elsif Complement_Locked and then
                                  Gestion_De_Tables.Chercher_Dans_Table
                                     (Complement_Table, Mot_Lu) then
                                Text_Io.Put_Line ("Mot correct");
                            elsif Complement2_Locked and then
                                  Gestion_De_Tables.Chercher_Dans_Table
                                     (Complement2_Table, Mot_Lu) then
                                Text_Io.Put_Line ("Mot correct");
                            else
                                Text_Io.Put_Line ("Mot incorrect");
                            end if;
                        end if;
                    end if;
                    exit Loop_A_Instruction when Line_Fini = True;

                end loop Loop_A_Instruction;
            Line_Fini := False;
            Num_Word := 0;
            Document.Close;  
        end loop;

    exception
        when End_Of_Play =>
            return;
--        when others =>
            Text_Io.Put_Line ("fin de commande");
    end Interprete;

end Interpreteur;


E3 Meta Data

    nblk1=9
    nid=5
    hdr6=e
        [0x00] rec0=1c rec1=00 rec2=01 rec3=072
        [0x01] rec0=1d rec1=00 rec2=03 rec3=00a
        [0x02] rec0=1b rec1=00 rec2=09 rec3=020
        [0x03] rec0=00 rec1=00 rec2=02 rec3=02e
        [0x04] rec0=11 rec1=00 rec2=04 rec3=048
        [0x05] rec0=14 rec1=00 rec2=08 rec3=014
        [0x06] rec0=0b rec1=00 rec2=07 rec3=000
        [0x07] rec0=15 rec1=00 rec2=02 rec3=001
        [0x08] rec0=84 rec1=1a rec2=80 rec3=004
    tail 0x2174267ce8626772cbe8e 0x42a00088462060003
Free Block Chain:
  0x5: 0000  00 06 00 0a 80 07 20 20 4c 69 6e 65 5f 07 09 20  ┆        Line_   ┆
  0x6: 0000  00 00 00 74 80 0f 75 74 5f 56 65 72 62 65 73 22  ┆   t  ut_Verbes"┆