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

⟦a233ea6c4⟧ Ada Source

    Length: 7168 (0x1c00)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Lexical, seg_04cc8e, seg_04cd74

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;


package body Lexical is

    procedure Init is
        Le_Fichier : String (1 .. 40);
        Dernier_Car : Natural;
    begin

        Matrice.Chargement_Matrice (La_Matrice);
        Position.Set (Lexical.La_Position, 0, 1);
        Text_Io.Put_Line ("Donnez le nom du fichier de configuration");
        Text_Io.Get_Line (Le_Fichier, Dernier_Car);
        Text_Io.Open (File_Config, Text_Io.In_File,
                      Le_Fichier (1 .. Dernier_Car));
        if (Text_Io.Is_Open (File_Config)) then
            Text_Io.Put_Line ("Lecture du fichier de configuration");
        else
            Text_Io.Put_Line
               ("Echec d'ouverture du fichier de configuration !");
        end if;
    end Init;

    procedure Close is
    begin
        Text_Io.Close (File_Config);
        Text_Io.Put_Line ("Fermeture du fichier de configuration");
    end Close;

    function Conversion return Matrice.Nature_Char is
    begin
        if (Dernier_Car < Position.Get_Colonne (La_Position)) then
            return Matrice.Fin;
        end if;
        case La_String (Position.Get_Colonne (La_Position)) is
            when 'A' .. 'Z' | 'a' .. 'z' | '_' =>
                return Matrice.Lettre;
            when '0' .. '9' =>
                return Matrice.Chiffre;
            when ' ' =>
                return Matrice.Espace;
            when ',' | '-' | '=' | ':' | ';' =>
                return Matrice.Separateur;
            when '#' =>
                return Matrice.Fin;
            when others =>
                return Matrice.Autre;
        end case;
    end Conversion;

    procedure Lex is
        Etat : Integer;
    begin
        Etat := 0;
        Indice_Unite := 1;
        Outer:
            loop
                Etat := Matrice.Get_Etat (La_Matrice, Etat, Conversion);
                if (Etat > 0) then
                    Unite (Indice_Unite) :=
                       La_String (Position.Get_Colonne (La_Position));
                    Position.Incremente_Colonne (La_Position);
                    Indice_Unite := Indice_Unite + 1;
                end if;
                if (Etat = 0) then
                    Position.Incremente_Colonne (La_Position);
                end if;
                if (Etat = -3) then
                    Unite (Indice_Unite) :=
                       La_String (Position.Get_Colonne (La_Position));
                    Position.Incremente_Colonne (La_Position);
                    Indice_Unite := Indice_Unite + 1;
                end if;
                if (Etat < 0) then
                    exit Outer;
                end if;
            end loop Outer;
        -- recherche du type de l'unite lexicale
        case (Etat) is
            when -1 =>
                Typ_Unite := Identificateur;
            when -2 =>
                Typ_Unite := Entier;
            when -3 =>
                Typ_Unite := Separator;
            when -4 =>
                Typ_Unite := Erreur;
            when -5 =>
                Typ_Unite := Termine;
            when others =>
                Typ_Unite := Erreur;
        end case;
        -- Recherche d'un mot cle
        Typ_Mot_Cle := Typ_Inconnu;
        if ((Typ_Unite = Identificateur) or (Typ_Unite = Separator)) then
            if (Unite (1 .. (Indice_Unite - 1)) = "CODE_SITE") then
                Typ_Mot_Cle := Typ_Code_Site;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "PLAGES_HORAIRES") then
                Typ_Mot_Cle := Typ_Plages_Horaires;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "LECTEURS") then
                Typ_Mot_Cle := Typ_Lecteurs;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "FIN") then
                Typ_Mot_Cle := Typ_Fin;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "PORTES") then
                Typ_Mot_Cle := Typ_Portes;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "ZONES") then
                Typ_Mot_Cle := Typ_Zones;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "PORTEURS") then
                Typ_Mot_Cle := Typ_Porteurs;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "GROUPES") then
                Typ_Mot_Cle := Typ_Groupes;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "ACCES") then
                Typ_Mot_Cle := Typ_Acces;
            elsif (Unite (1 .. (Indice_Unite - 1)) = ":") then
                Typ_Mot_Cle := Typ_Double_Point;
            elsif (Unite (1 .. (Indice_Unite - 1)) = ";") then
                Typ_Mot_Cle := Typ_Point_Virgule;
            elsif (Unite (1 .. (Indice_Unite - 1)) = ",") then
                Typ_Mot_Cle := Typ_Virgule;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "-") then
                Typ_Mot_Cle := Typ_Tiret;
            elsif (Unite (1 .. (Indice_Unite - 1)) = "=") then
                Typ_Mot_Cle := Typ_Egal;
            else
                Typ_Mot_Cle := Typ_Inconnu;
            end if;
        end if;
    end Lex;

    procedure Lex_File is
    begin
        Lecture_Unite_Lexicale:
            loop
                if (Text_Io.End_Of_File (File_Config) and
                    (Typ_Unite = Termine)) then
                    Is_Eof := True;
                    exit Lecture_Unite_Lexicale;
                end if;
                if (Typ_Unite = Termine) then
                    Position.Incremente_Ligne (La_Position);
                    Position.Set_Colonne (La_Position, 1);
                    Text_Io.Get_Line (File_Config, La_String, Dernier_Car);
                end if;
                Lex;
                if (Typ_Unite /= Termine) then
                    exit Lecture_Unite_Lexicale;
                end if;
            end loop Lecture_Unite_Lexicale;
    end Lex_File;

end Lexical;

E3 Meta Data

    nblk1=6
    nid=0
    hdr6=c
        [0x00] rec0=21 rec1=00 rec2=01 rec3=012
        [0x01] rec0=1e rec1=00 rec2=02 rec3=024
        [0x02] rec0=18 rec1=00 rec2=03 rec3=026
        [0x03] rec0=15 rec1=00 rec2=04 rec3=042
        [0x04] rec0=13 rec1=00 rec2=05 rec3=010
        [0x05] rec0=1b rec1=00 rec2=06 rec3=000
    tail 0x217540caa874f6e40c71d 0x42a00088462060003