-- JaMStackDefs.mesa
-- Written by John Warnock, January, 1979.
-- Last changed by Doug Wyatt, February 10, 1981 6:39 PM
-- Last changed by Doug Brotz, June 5, 1981 2:40 PM

DIRECTORY
JaMMasterDefs USING[Object, Stack, StackLink];

JaMStackDefs: DEFINITIONS = {
OPEN JaMMasterDefs;

-- "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];

CleanupStack: PROCEDURE;

JaMStack: PROGRAM;

}.

DKW March 27, 1980 6:19 PM
added JaMStack: PROGRAM;
DKW September 30, 1980 5:38 PM
added Indx, Index
DKB June 5, 1981 2:39 PM
added CleanupStack