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

⟦9fa82c5aa⟧ TextFile

    Length: 11875 (0x2e63)
    Types: TextFile
    Names: »B«

Derivation

└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Search_Tree;
package body Symbol_Table is


    procedure Insert (The_Name : in String; Ok : out Boolean) is
        One_Element : Element := (The_Value => Integer'Last,
                                  The_Type => Sans_Type,
                                  The_Table => Index'First,
                                  The_Class => (others => ' '),
                                  The_Adresse => 0);
    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 : Value;
                       Ok : out Boolean) is  
        Succes : Boolean := False;
        One_Element : Element;
        Local_Current_Table : Index := Current_Table;
        Found : Boolean;

    begin
        while Local_Current_Table /= 0 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 : Integer;
                          Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element;
        Local_Current_Table : Index := Current_Table;
        Found : Boolean;

    begin
        while Local_Current_Table /= 0 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 : Type_Element;
                        Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element;
    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 : Index; Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element;
    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 String;
                         Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element;
        Local_Current_Table : Index := Current_Table;
        Found : Boolean;

    begin
        while Local_Current_Table /= 0 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 :=
                       Tree.Normaliser (The_Class, 80);  -- a remplacer le 80
                    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 Get_Val (The_Name : in String;
                       The_Value : out Value;
                       Ok : out Boolean) is
        Local_Current_Table : Index := Current_Table;
        Found : Boolean;
        Succes : Boolean := False;
        One_Element : Element;
    begin
        while Local_Current_Table /= 0 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 Integer;
                          Ok : out Boolean) is
        Local_Current_Table : Index := Current_Table;
        Found : Boolean;
        Succes : Boolean := False;
        One_Element : Element;
    begin
        while Local_Current_Table /= 0 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 Type_Element;
                        Ok : out Boolean) is  
        Local_Current_Table : Index := Current_Table;
        Succes : Boolean := False;
        Found : Boolean;
        One_Element : Element;
    begin  
        while Local_Current_Table /= 0 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 String;
                         Ok : out Boolean) is
        Local_Current_Table : Index := Current_Table;
        Succes : Boolean := False;
        Found : Boolean;
        One_Element : Element;
    begin
        while Local_Current_Table /= 0 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 Index;
                         Ok : out Boolean) is
        Succes : Boolean := False;
        One_Element : Element;
    begin
        Tree.Consulter_Element (The_Trees (Current_Table).The_Tree,
                                The_Name, One_Element, Succes);
        Ok := Succes;
        if Succes then
            The_Table := One_Element.The_Table;
        end if;
    end Get_Table;

    function Visible_Element (The_Name : in String) return Boolean is
        Local_Current_Table : Index := Current_Table;  
        Found : Boolean;
    begin  
        while Local_Current_Table /= 0 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 Visible_Element;

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

    procedure Set_Table (The_Name : in String; Ok : out Boolean) is
        Succes : Boolean;
    begin
        if Current_Top_Index <= Index'Last then
            Set_New_Table (The_Name, Current_Top_Index + 1, Succes);
            if Succes then
                Current_Top_Index := Current_Top_Index + 1;
                Ok := True;
            else
                Ok := False;
            end if;  
        else
            raise Table_Pleine;
        end if;
    end Set_Table;

    procedure Set_Current_Table (The_Name : in String; Ok : out Boolean) is
        A_Table : Index;  
        Succes : Boolean;
    begin
        Get_Table (The_Name, A_Table, Succes);
        if Succes then
            if A_Table /= Index'First then    -- table existe ?
                Current_Table := A_Table;
                Ok := True;
            else
                Ok := False;
            end if;  
        else
            Ok := False;
        end if;
    end Set_Current_Table;


    procedure Leave_Table (Ok : out Boolean) is
    begin
        Current_Table := 1;
        Ok := True;
    end Leave_Table;

begin
    for I in 1 .. Index'Last loop
        Tree.Create (The_Trees (I).The_Tree);
    end loop;
    The_Trees (1).Imbrication := 0;
end Symbol_Table;