DIRECTORY IPBasic USING [Any, Identifier, Integer, Marker, Number, Operator, State, Vector]; IPStack: CEDAR DEFINITIONS = BEGIN OPEN IPBasic; Init: PROC[self: State, max: Integer]; PushAny: PROC[self: State, x: Any]; PopAny: PROC[self: State] RETURNS[Any]; PushBool: PROC[State, BOOL]; PushInteger: PROC[State, Integer]; PushReal: PROC[State, REAL]; PushNumber: PROC[State, Number]; PushIdentifier: PROC[State, Identifier]; PushVector: PROC[State, Vector]; PushOperator: PROC[State, Operator]; PopBool: PROC[State] RETURNS[BOOL]; PopInteger: PROC[State] RETURNS[Integer]; PopReal: PROC[State] RETURNS[REAL]; PopNumber: PROC[State] RETURNS[Number]; PopIdentifier: PROC[State] RETURNS[Identifier]; PopVector: PROC[State] RETURNS[Vector]; PopOperator: PROC[State] RETURNS[Operator]; Copy: PROC[self: State, n: Integer]; Roll: PROC[self: State, depth, moveFirst: Integer]; Mark: PROC[self: State, n: Integer]; Unmark: PROC[self: State, n: Integer]; Count: PROC[self: State] RETURNS[Integer]; PopToMark: PROC[self: State] RETURNS[Marker]; PopMark: PROC[self: State]; END. ²IPStack.mesa Last edited by: Doug Wyatt, March 23, 1983 1:04 pm Initialize a stack with the capacity to hold up to max items. Push an element onto the stack. ! MasterError[StackOverflow] if the stack is full Pop an element from the stack. ! MasterError[StackUnderflow] if the stack is empty Copy the top n elements on the stack. ! MasterError[StackUnderflow] if there are fewer than n elements on the stack ! MasterError[StackOverflow] if there is not enough room to push n more elements Treat the top depth elements as a circular queue; roll moveFirst elements to the bottom. ! MasterError[InvalidArgs] if moveFirst > depth ! MasterError[StackUnderflow] if there are fewer than depth elements on the stack Place a mark n elements down in the stack. ! MasterError[StackUnderflow] if there are fewer than n elements on the stack Remove a mark n elements down in the stack. The given marker must match the one pushed by the corresponding Mark. ! MasterError[StackUnderflow] if there are fewer than n elements on the stack ! MasterError[WrongType] if there is not a mark at depth n ! MasterError[MarkMismatch] if the mark was not pushed by the current context Count the stack elements above the top mark. ! MasterError[MarkMismatch] if the mark was not pushed by the current context Pop the stack until a mark is on top. Used for error recovery. Pop the mark on top of the stack. Used for error recovery. ! Bug if there is not a mark on top of the stack ΚΓ˜headšœ ™ šœ™Jšœ"™"—J˜šΟk ˜ JšœœE˜R—J˜—šœ œ ˜Jšœœœ ˜J˜šΟnœœ˜&Jšœ=™=—J˜šžœœ˜#Jšœ™J™1—J˜šžœœœ˜'Jšœ™Jšœ3™3—J˜Jšžœœœ˜Jšž œœ˜"Jšžœœœ˜Jšž œœ˜ Jšžœœ˜(Jšž œœ˜ Jšž œœ˜$J˜Jšžœœœœ˜#Jšž œœœ ˜)Jšžœœœœ˜#Jšž œœœ ˜'Jšž œœœ ˜/Jšž œœœ ˜'Jšž œœœ ˜+J™šžœœ˜$Jšœ%™%JšœM™MJšœP™P—J˜šžœœ)˜3JšœΟrœ$Ÿ œ™XJšœŸ™/Jšœ6Ÿœ™Q—J˜šžœœ˜$Jšœ*™*JšœM™M—J˜šžœœ˜&Jšœ+™+JšœE™EJšœM™MJšœ:™:JšœM™M—J˜šžœœœ ˜*Jšœ,™,JšœM™M—J˜šž œœœ ˜-Jšœ>™>—J˜šžœœ˜Jšœ:™:Jšœ0™0—J˜Jšœ˜——…—: ―