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

⟦e49b9ad41⟧ Ada Source

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

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 Text_Io, Nos_Chaines;

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
        Table_Of_Word : Mots.T_Tab_Commande;
        Num_Word : Nombre_De_Mots.Numero;
    begin
        Document.Open;
        loop
            Text_Io.Put ("/:> ");
            Document.Get (Table_Of_Word, Num_Word);

            if (Num_Word > Nombre_De_Mots.Nombre_Max_Mots) then
                Text_Io.Put_Line
                   ("Une instruction ne comporte pas plus de quatre mots !");
            elsif Num_Word = 0 then
                Text_Io.Put_Line ("Il n y aucune instruction.");
            else
                for I in 1 .. Num_Word loop
                    if Mots.String_Value (Table_Of_Word, I) = "quit" then
                        raise End_Of_Play;  
                    elsif Mots.String_Value (Table_Of_Word, I) = "nothing" then
                        exit;
                    elsif Gestion_De_Tables.Chercher_Dans_Table
                             (Verbe_Table, Mots.String_Value
                                              (Table_Of_Word, I)) then
                        Text_Io.Put_Line ("Mot correct");
                    elsif Gestion_De_Tables.Chercher_Dans_Table
                             (Preposition_Table, Mots.String_Value
                                                    (Table_Of_Word, I)) then
                        Text_Io.Put_Line ("Mot correct");
                    elsif Gestion_De_Tables.Chercher_Dans_Table
                             (Complement_Table, Mots.String_Value
                                                   (Table_Of_Word, I)) then
                        Text_Io.Put_Line ("Mot correct");
                    elsif Gestion_De_Tables.Chercher_Dans_Table
                             (Complement2_Table, Mots.String_Value
                                                    (Table_Of_Word, I)) then
                        Text_Io.Put_Line ("Mot correct");
                    else
                        Text_Io.Put_Line ("Mot incorrect");  
                    end if;
                end loop;
            end if;
            Num_Word := 0;
        end loop;
        Document.Close;  
    exception
        when End_Of_Play =>
            return;
    end Interprete;

    function Get_Commande return Mots.T_Commande is
        [declaration]
    begin
        [statement]
    end Get_Commande;


end Interpreteur;

E3 Meta Data

    nblk1=9
    nid=6
    hdr6=10
        [0x00] rec0=1f rec1=00 rec2=01 rec3=070
        [0x01] rec0=01 rec1=00 rec2=09 rec3=02e
        [0x02] rec0=14 rec1=00 rec2=04 rec3=064
        [0x03] rec0=16 rec1=00 rec2=05 rec3=006
        [0x04] rec0=16 rec1=00 rec2=03 rec3=058
        [0x05] rec0=1c rec1=00 rec2=07 rec3=062
        [0x06] rec0=10 rec1=00 rec2=02 rec3=012
        [0x07] rec0=18 rec1=00 rec2=08 rec3=001
        [0x08] rec0=84 rec1=1a rec2=80 rec3=004
    tail 0x21747c25e864c4b2c0319 0x42a00088462060003
Free Block Chain:
  0x6: 0000  00 00 00 04 80 01 22 01 02 03 20 20 20 20 20 20  ┆      "         ┆