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

⟦08ac9717f⟧ Ada Source

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

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦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;

    procedure File_Interprete (File_Name : in String) is
        Read_Word : Mots.Mot;
        Num_Line : Numeros_De_Lignes.Numero;

        function Equal (Chaine1, Chaine2 : String) return Boolean
            renames Standard."=";

    begin
        Document.Fopen (File_Name);
        while not Document.En_Fin_De_Fichier loop
            Document.File_Get (Read_Word, Num_Line);
            --Text_Io.Put_Line (Mots.Valeur (Read_Word));
            if Mots.Valeur (Read_Word) = "Debut_Verbes" then
                loop
                    Document.File_Get (Read_Word, Num_Line);  
                    exit when Equal (Mots.Valeur (Read_Word), "Fin_Verbes");
                    Verbe_Table (Compteur) :=
                       new String'(Mots.Valeur (Read_Word));
                    Compteur := Compteur + 1;
                    Text_Io.Put_Line (Mots.Valeur (Read_Word));
                end loop;
                Verbe_Table (Compteur .. 80) := (others => (new String'(" ")));
            end if;
        end loop;
        Document.Fclose;
        Compteur := 1;
        Document.Fopen (File_Name);
        while not Document.En_Fin_De_Fichier loop
            Document.File_Get (Read_Word, Num_Line);  
            if Mots.Valeur (Read_Word) = "Debut_Prepositions" then
                loop
                    Document.File_Get (Read_Word, Num_Line);  
                    exit when Equal (Mots.Valeur (Read_Word),
                                     "Fin_Prepositions");
                    Preposition_Table (Compteur) :=
                       new String'(Mots.Valeur (Read_Word));
                    Compteur := Compteur + 1;
                    Text_Io.Put_Line (Mots.Valeur (Read_Word));
                end loop;
                Preposition_Table (Compteur .. 80) :=
                   (others => (new String'(" ")));
            end if;
        end loop;
        Document.Fclose;
        Compteur := 1;
        Document.Fopen (File_Name);
        while not Document.En_Fin_De_Fichier loop
            Document.File_Get (Read_Word, Num_Line);  
            if Mots.Valeur (Read_Word) = "Debut_Complements" then
                loop
                    Document.File_Get (Read_Word, Num_Line);  
                    exit when Equal (Mots.Valeur (Read_Word),
                                     "Fin_Complements");
                    Complement_Table (Compteur) :=
                       new String'(Mots.Valeur (Read_Word));
                    Compteur := Compteur + 1;
                    Text_Io.Put_Line (Mots.Valeur (Read_Word));
                end loop;
                Complement_Table (Compteur .. 80) :=
                   (others => (new String'(" ")));
            end if;
        end loop;
        Document.Fclose;
        Compteur := 1;
        Document.Fopen (File_Name);
        while not Document.En_Fin_De_Fichier loop
            Document.File_Get (Read_Word, Num_Line);  
            if Mots.Valeur (Read_Word) = "Debut_Complements2" then
                loop
                    Document.File_Get (Read_Word, Num_Line);  
                    exit when Equal (Mots.Valeur (Read_Word),
                                     "Fin_Complements2");
                    Complement2_Table (Compteur) :=
                       new String'(Mots.Valeur (Read_Word));

                    Compteur := Compteur + 1;
                    Text_Io.Put_Line (Mots.Valeur (Read_Word));
                end loop;
                Complement2_Table (Compteur .. 80) :=
                   (others => (new String'(" ")));
            end if;
        end loop;
        Document.Fclose;
        Compteur := 1;
    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 Gestion_De_Tables.Chercher_Dans_Table
                                  (Verbe_Table, Mot_Lu) then
                                Text_Io.Put_Line ("Mot correct");
                            elsif Gestion_De_Tables.Chercher_Dans_Table
                                     (Preposition_Table, Mot_Lu) then
                                Text_Io.Put_Line ("Mot correct");
                            elsif Gestion_De_Tables.Chercher_Dans_Table
                                     (Complement_Table, Mot_Lu) then
                                Text_Io.Put_Line ("Mot correct");
                            elsif 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=8
    hdr6=e
        [0x00] rec0=1e rec1=00 rec2=01 rec3=02e
        [0x01] rec0=14 rec1=00 rec2=07 rec3=062
        [0x02] rec0=16 rec1=00 rec2=09 rec3=002
        [0x03] rec0=16 rec1=00 rec2=03 rec3=052
        [0x04] rec0=1e rec1=00 rec2=05 rec3=02a
        [0x05] rec0=0f rec1=00 rec2=04 rec3=054
        [0x06] rec0=15 rec1=00 rec2=02 rec3=000
        [0x07] rec0=14 rec1=00 rec2=08 rec3=001
        [0x08] rec0=84 rec1=1a rec2=80 rec3=004
    tail 0x2174119ac86125e8badab 0x42a00088462060003
Free Block Chain:
  0x8: 0000  00 06 02 08 80 08 20 65 6e 64 20 69 66 3b 08 00  ┆       end if;  ┆
  0x6: 0000  00 00 00 2f 80 16 20 20 20 20 20 20 20 20 20 20  ┆   /            ┆