-- JaMStackDefs.mesa
-- Written by John Warnock, January, 1979.
-- Last changed by Doug Wyatt, September 30, 1980 5:38 PM

DIRECTORY
JaMMasterDefs: FROM "JaMMasterDefs" USING [Object, Stack, StackLink];

JaMStackDefs: DEFINITIONS =
BEGIN OPEN JaMMasterDefs;

JaMStack: PROGRAM;

-- "Push" pushes a descriptor onto the current operand stack.
Push: PROCEDURE [ob:Object,stack:Stack] ;

-- "Pop" returns the descriptor from the top of the operand stk.
Pop: PROCEDURE [stack:Stack] RETURNS [Ob:Object] ;

-- "Top" returns the top of stack without popping. i.e. Dup Pop.
Top: PROCEDURE [stack:Stack] RETURNS [Ob:Object] ;

-- "Dup" Duplicates the top descriptor onto the stack.
Dup: PROCEDURE [stack:Stack] ;

-- "Exch" Exchanges the top entries on the stack.
Exch: PROCEDURE [stack:Stack] ;

-- "ClrStk" clears the stack.
ClrStk: PROCEDURE [stack:Stack];

-- "CopyStk" copies the top n entries on the given stack.
CopyStk: PROCEDURE [ n:CARDINAL,stack:Stack];

-- "CountStk" counts the entries on the given stack.
CountStk: PROCEDURE [stack:Stack] RETURNS [n:CARDINAL];

-- "CountToMark" counts the entries on the given stack to the first mark.
CountToMark: PROCEDURE [stack:Stack] RETURNS [n:CARDINAL];

ClrToMark
: PROCEDURE [stack:Stack];

-- "Indx" makes a copy of the ith stack element, counting from 0.
Indx: PROCEDURE [stack:Stack, i: CARDINAL];

-- "MoveStkOps" transfers a number of descriptors from one stack
-- to another. This is an internal procedure.
MoveStkOps: PROCEDURE [ From, To:Stack,Count:CARDINAL] ;

-- "StackForall" executes a given procedure for each element on the stack,
-- i.e. each element is passed to the given procedure.
-- The given stack is left unaltered.
StackForall: PROCEDURE[stack:Stack, proc:PROCEDURE[Object] RETURNS [BOOLEAN]]
RETURNS [BOOLEAN];

-- The following routines make the above routines into intrinsics.

PopOpStk: PROCEDURE;

DupOpStk: PROCEDURE;

ExchOpStk: PROCEDURE;

ClearOpStk: PROCEDURE;
CopyOpStk: PROCEDURE;

RollOpStk: PROCEDURE;

CountOpStk: PROCEDURE;

CountToMrk
: PROCEDURE;

ClearToMrk
: PROCEDURE;

Mark
: PROCEDURE;

Index
: PROCEDURE;


-- The next two procedures are used in conjunction with error recovery.

FreeLoc: PROCEDURE RETURNS [sl:StackLink];

RestoreStk: PROCEDURE [sl:StackLink,s:Stack];

END.

DKW March 27, 1980 6:19 PM
added JaMStack: PROGRAM;
DKW September 30, 1980 5:38 PM
added Indx, Index