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

⟦0e15ddb10⟧ TextFile

    Length: 2722 (0xaa2)
    Types: TextFile
    Names: »B«

Derivation

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

TextFile

with Bloc;
with Table;  
with Object;
package body Symbol is

    function Eval (Name : Message.Tiny_String) return Object.Reference is
        New_Reference : Object.Reference := Object.Void_Reference;
        Success : Boolean := False;
        Current_Table : Table.Symbol_Kind;
    begin
        Find (Name, New_Reference, Current_Table, Success);
        return New_Reference;
        -- if not success return object.void_reference
    end Eval;

    procedure Find (Name : Message.Tiny_String;
                    New_Reference : in out Object.Reference;
                    Current_Table : out Table.Symbol_Kind;
                    Is_Found : out Boolean) is
        use Bloc;
        Current_Node : Bloc.Node := Bloc.Current;
        Success : Boolean := False;  
        Table_In_Use : Table.Symbol_Kind;
    begin  
        Table_In_Use := Bloc.Symbol (Current_Node);
        while (Current_Node /= Bloc.Empty_Node) loop
            Table.Find (The_Table => Table_In_Use,
                        Name => Name,
                        New_Reference => New_Reference,
                        Success => Success);
            exit when Success;

            Current_Node := Bloc.Parent (Current_Node);
            if Current_Node /= Bloc.Empty_Node then
                Table_In_Use := Bloc.Symbol (Current_Node);
            end if;
        end loop;
        Is_Found := Success;
        Current_Table := Table_In_Use;
    end Find;

    procedure Insert (Name : Message.Tiny_String;
                      New_Reference : Object.Reference) is
        Object_Found : Object.Reference := Object.Void_Reference;
        Table_In_Use : Table.Symbol_Kind;
        Is_Found : Boolean := False;
    begin
        Find (Name, Object_Found, Table_In_Use, Is_Found);
        Table.Insert (Table_In_Use, Name, New_Reference);
    end Insert;

    procedure Remove (Name : Message.Tiny_String) is
        Success : Boolean := False;
        Object_Found : Object.Reference := Object.Void_Reference;
        Table_In_Use : Table.Symbol_Kind;
    begin

        Find (Name, Object_Found, Table_In_Use, Success);
        if Success then
            Table.Remove (Table_In_Use, Name);
        end if;
    end Remove;

    procedure In_Text is  
        Current_Node : Bloc.Node := Bloc.Current;
        Table_In_Use : Table.Symbol_Kind;
    begin
        Table_In_Use := Bloc.Symbol (Current_Node);
        while (Current_Node /= Bloc.Empty_Node) loop
            Table.In_Text (Table_In_Use);
            Current_Node := Bloc.Parent (Current_Node);
            if Current_Node /= Bloc.Empty_Node then
                Table_In_Use := Bloc.Symbol (Current_Node);
            end if;
        end loop;

    end In_Text;
end Symbol;