DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦30f62c6f0⟧ TextFile

    Length: 19801 (0x4d59)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Abstract_Tree;
with Element;
with Search_Tree;
with Stack_Gen;
with Station_Identifier;
with Table;
with Text_Io;
package body Symbol_Table is

    Current_Table : Table.Object := Table.Globale;

    Current_Top_Table : Table.Object := Table.Globale;

    package Stack_Table is new Stack_Gen (Table.Object);

    The_Stack_Table : Stack_Table.Object;


    procedure Insert (The_Name : in String; Ok : out Boolean) is
        One_Element : Element.Object;
    begin
        if not Tree.Exist_Element
                  (The_Trees (Current_Table).The_Tree, The_Name) then
            Tree.Insert_Element (The_Trees (Current_Table).The_Tree,
                                 One_Element, The_Name);
            Ok := True;
        else
            Ok := False;
        end if;
    end Insert;


    procedure Set_Val (The_Name : in String;
                       The_Value : Element.Value;
                       Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    One_Element.The_Value := The_Value;
                    Tree.Modifier_Element
                       (The_Trees (Local_Current_Table).The_Tree,
                        The_Name, One_Element, Succes);
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Set_Val;


    procedure Set_Adress (The_Name : in String;
                          The_Adress : Element.Adress;
                          Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    One_Element.The_Adresse := The_Adress;
                    Tree.Modifier_Element
                       (The_Trees (Local_Current_Table).The_Tree,
                        The_Name, One_Element, Succes);
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Set_Adress;


    procedure Set_Type (The_Name : in String;
                        The_Type : Element.Element_Type;
                        Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
    begin
        Tree.Consulter_Element (The_Trees (Current_Table).The_Tree,
                                The_Name, One_Element, Succes);
        if Succes then
            One_Element.The_Type := The_Type;
            Tree.Modifier_Element (The_Trees (Current_Table).The_Tree,
                                   The_Name, One_Element, Succes);
        end if;
        Ok := Succes;
    end Set_Type;


    procedure Set_New_Table (The_Name : in String;
                             The_Table : Table.Object;
                             Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
    begin
        Tree.Consulter_Element (The_Trees (Current_Table).The_Tree,
                                The_Name, One_Element, Succes);
        if Succes then
            One_Element.The_Table := The_Table;
            Tree.Modifier_Element (The_Trees (Current_Table).The_Tree,
                                   The_Name, One_Element, Succes);
        end if;
        Ok := Succes;
    end Set_New_Table;


    procedure Set_Class (The_Name : in String;
                         The_Class : in Element.Class;
                         Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    One_Element.The_Class :=
                       Element.Convert_To_Class (The_Class);
                    Tree.Modifier_Element
                       (The_Trees (Local_Current_Table).The_Tree,
                        The_Name, One_Element, Succes);
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Set_Class;


    procedure Set_Num_Acteur
                 (The_Name : in String; The_Num : Natural; Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    One_Element.The_Num_Acteur := The_Num;
                    Tree.Modifier_Element
                       (The_Trees (Local_Current_Table).The_Tree,
                        The_Name, One_Element, Succes);
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Set_Num_Acteur;


    procedure Set_Num_Station (The_Name : in String;
                               The_Num_Station : Station_Identifier.Object;
                               Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    One_Element.The_Num_Station := The_Num_Station;
                    Tree.Modifier_Element
                       (The_Trees (Local_Current_Table).The_Tree,
                        The_Name, One_Element, Succes);
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Set_Num_Station;


    procedure Set_Instr_List (The_Name : in String;
                              The_Instr : Abstract_Tree.P_Instruction_List;
                              Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then

                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    One_Element.The_Instr_List := The_Instr;
                    Tree.Modifier_Element
                       (The_Trees (Local_Current_Table).The_Tree,
                        The_Name, One_Element, Succes);
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Set_Instr_List;


    procedure Get_Val (The_Name : in String;
                       The_Value : out Element.Value;
                       Ok : out Boolean) is
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
        Succes : Boolean := False;
        One_Element : Element.Object;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Value := One_Element.The_Value;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Val;


    procedure Get_Adress (The_Name : in String;
                          The_Adress : out Element.Adress;
                          Ok : out Boolean) is
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
        Succes : Boolean := False;
        One_Element : Element.Object;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Adress := One_Element.The_Adresse;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Adress;


    procedure Get_Type (The_Name : in String;
                        The_Type : out Element.Element_Type;
                        Ok : out Boolean) is
        Local_Current_Table : Table.Object := Current_Table;
        Succes : Boolean := False;
        Found : Boolean;
        One_Element : Element.Object;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Type := One_Element.The_Type;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Type;


    procedure Get_Class (The_Name : in String;
                         The_Class : out Element.Class;
                         Ok : out Boolean) is
        Local_Current_Table : Table.Object := Current_Table;
        Succes : Boolean := False;
        Found : Boolean;
        One_Element : Element.Object;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Class := One_Element.The_Class;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Class;


    procedure Get_Table (The_Name : in String;
                         The_Table : out Table.Object;
                         Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element.Object;
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Table := One_Element.The_Table;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Table;


    procedure Get_Num_Acteur (The_Name : in String;
                              The_Num : out Natural;
                              Ok : out Boolean) is
        Local_Current_Table : Table.Object := Current_Table;
        Succes : Boolean := False;
        Found : Boolean;
        One_Element : Element.Object;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Num := One_Element.The_Num_Acteur;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Num_Acteur;


    procedure Get_Num_Station (The_Name : in String;
                               The_Num_Station : out Station_Identifier.Object;
                               Ok : out Boolean) is
        Local_Current_Table : Table.Object := Current_Table;
        Succes : Boolean := False;
        Found : Boolean;
        One_Element : Element.Object;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Num_Station := One_Element.The_Num_Station;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Num_Station;


    procedure Get_Instr_List (The_Name : in String;
                              The_Instr : out Abstract_Tree.P_Instruction_List;
                              Ok : out Boolean) is
        Local_Current_Table : Table.Object := Current_Table;
        Succes : Boolean := False;
        Found : Boolean;
        One_Element : Element.Object;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                Tree.Consulter_Element
                   (The_Trees (Local_Current_Table).The_Tree,
                    The_Name, One_Element, Succes);
                if Succes then
                    The_Instr := One_Element.The_Instr_List;
                end if;
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        Ok := Succes;
    end Get_Instr_List;


    function Is_Visible (The_Name : in String) return Boolean is
        Local_Current_Table : Table.Object := Current_Table;
        Found : Boolean;
    begin
        while Local_Current_Table /= Table.Vide loop
            Found := Tree.Exist_Element
                        (The_Trees (Local_Current_Table).The_Tree, The_Name);
            if Found then
                exit;
            else
                Local_Current_Table :=
                   The_Trees (Local_Current_Table).Imbrication;
            end if;
        end loop;
        return Found;
    end Is_Visible;


    function Is_Visible_Local (The_Name : in String) return Boolean is
        Found : Boolean;
    begin
        return Tree.Exist_Element
                  (The_Trees (Current_Table).The_Tree, The_Name);
    end Is_Visible_Local;


    procedure Set_Table (The_Name : in String; Ok : out Boolean) is
        Succes : Boolean;
    begin
        if Current_Top_Table <= Table.Max then
            Set_New_Table (The_Name, Current_Top_Table + 1, Succes);
            if Succes then
                Current_Top_Table := Current_Top_Table + 1;
                Ok := True;
            else
                Ok := False;
            end if;
        else
            raise Table_Non_Disponible;
        end if;
    end Set_Table;


    procedure Change_Current_Table (The_Name : in String; Ok : out Boolean) is
        One_Table : Table.Object;
        Succes : Boolean;
    begin
        Get_Table (The_Name, One_Table, Succes);
        if Succes then
            if One_Table /= Table.Vide then
                Stack_Table.Push (The_Stack_Table, Current_Table);
                Current_Table := One_Table;
                Ok := True;
            else
                Ok := False;
            end if;
        else
            Ok := False;
        end if;
    end Change_Current_Table;


    procedure Leave_Table (Ok : out Boolean) is
        Inter : Table.Object;
    begin
        begin
            Stack_Table.Pop (The_Stack_Table, Inter);
            Current_Table := Inter;
            Ok := True;
        exception
            when Stack_Table.Empty_Stack =>
                Text_Io.Put_Line ("La pile des tables est vide");
                Current_Table := Table.Globale;
                Ok := False;
        end;
    end Leave_Table;


begin
    for I in Table.Globale .. Table.Max loop
        Tree.Create (The_Trees (I).The_Tree);
    end loop;
    The_Trees (Table.Globale).Imbrication := Table.Vide;
end Symbol_Table;