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 - metrics - download
Index: B T

⟦59ffe3b61⟧ TextFile

    Length: 3682 (0xe62)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

-- $Source: /nosc/work/parser/RCS/StateStk.bdy,v $
-- $Revision: 4.0 $ -- $Date: 85/02/19 11:45:59 $ -- $Author: carol $

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

with Parsetables;  -- state tables generated
-- by parser generator
use Parsetables;
with Grammar_Constants;  -- constants generated by parser generator
use Grammar_Constants;  -- to have visiblity on operations
-- on type ParserInteger.

package body Statestack is

    --| Overview
    --|
    --| The data structure is implemented as an array.
    --|

    --| Notes
    --|
    --| Abbreviations used in this compilation unit:
    --|
    --| Init : used as prefix for Initialize
    --|

    ------------------------------------------------------------------
    -- Declarations Global to Package Body StateStack
    ------------------------------------------------------------------

    Index : Stateparsestacksindex := 0;
    --| top element in stack.
    Next_To_Copy : Stateparsestacksindex := 0;
    --| next element to copy in stack.

    Space : array (Stateparsestacksrange) of Statestackelement;
    --| Storage used to hold stack elements


    ------------------------------------------------------------------
    -- Subprogram Bodies Global to Package StateStack
    -- (declared in package specification).
    ------------------------------------------------------------------

    procedure Push (Element : in Statestackelement) is

    begin

        if (Index >= Stateparsestacksrange'Last) then
            raise Overflow;
        end if;

        Index := Index + 1;
        Space (Index) := Element;

    end Push;

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

    function Pop return Statestackelement is

    begin

        if (Index < Stateparsestacksrange'First) then
            raise Underflow;
        end if;

        Index := Index - 1;
        return Space (Index + 1);

    end Pop;

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

    function Copytop return Statestackelement is

    begin

        Initcopy;
        return Copynext;

    end Copytop;

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

    function Copynext return Statestackelement is

    begin

        Next_To_Copy := Next_To_Copy - 1;

        if (Next_To_Copy < Stateparsestacksrange'First) then
            raise Underflow;
        end if;

        return Space (Next_To_Copy);

    end Copynext;

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

    function Length return Stateparsestacksindex is

    begin

        return Index;

    end Length;

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

    procedure Initcopy is

    begin

        Next_To_Copy := Index + 1;

        -- start examination here
    end Initcopy;

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

    function Copythisone ( --| returns the which_oneth element
                          Which_One : in Stateparsestacksrange)
                         return Statestackelement is

    begin

        if Which_One > Index then
            raise Overflow;
        end if;

        return (Space (Which_One));

    end Copythisone;

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

    procedure Reduce (Topn : in Stateparsestacksindex) is

    begin

        if (Topn > Index) then
            raise Underflow;
        end if;

        Index := Index - Topn;

    end Reduce;

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

end Statestack;

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