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

⟦60b2f7f8d⟧ Ada Source

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

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, Display;


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;

-- Pour eviter de chercher dans un tableau qui n'existe pas!
    Verbe_Locked : Boolean := False;
    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;
    exception
        when others =>
            Text_Io.Put_Line ("Erreur create_table");

    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);
    exception
        when others =>
            Text_Io.Put_Line ("Erreur file_interprete");

    end File_Interprete;

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


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

        procedure Affiche (A_String : String) is
        begin
            Display.Write_On_Player (A_String);
        end Affiche;

    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
                        Affiche
                           ("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
                                Affiche ("mot correct");
                            elsif Preposition_Locked and then
                                  Gestion_De_Tables.Chercher_Dans_Table
                                     (Preposition_Table, Mot_Lu) then
                                Affiche ("mot correct");
                            elsif Complement_Locked and then
                                  Gestion_De_Tables.Chercher_Dans_Table
                                     (Complement_Table, Mot_Lu) then
                                Affiche ("mot correct");
                            elsif Complement2_Locked and then
                                  Gestion_De_Tables.Chercher_Dans_Table
                                     (Complement2_Table, Mot_Lu) then
                                Affiche ("mot correct");
                            else
                                Affiche ("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 ("ERREUR INTERPRETE");
    end Interprete;

end Interpreteur;

E3 Meta Data

    nblk1=9
    nid=7
    hdr6=c
        [0x00] rec0=1c rec1=00 rec2=01 rec3=07c
        [0x01] rec0=1b rec1=00 rec2=05 rec3=00a
        [0x02] rec0=1c rec1=00 rec2=03 rec3=010
        [0x03] rec0=18 rec1=00 rec2=04 rec3=030
        [0x04] rec0=10 rec1=00 rec2=06 rec3=024
        [0x05] rec0=14 rec1=00 rec2=02 rec3=000
        [0x06] rec0=17 rec1=00 rec2=07 rec3=000
        [0x07] rec0=17 rec1=00 rec2=07 rec3=001
        [0x08] rec0=84 rec1=1a rec2=80 rec3=004
    tail 0x21743854086306a1d9816 0x42a00088462060003
Free Block Chain:
  0x7: 0000  00 08 02 ae 80 0d 20 20 20 20 20 20 20 20 20 65  ┆               e┆
  0x8: 0000  00 09 00 04 80 01 65 01 02 03 4d 6f 74 20 63 6f  ┆      e   Mot co┆
  0x9: 0000  00 00 00 47 80 05 69 63 68 65 3b 05 00 00 00 00  ┆   G  iche;     ┆