Next: , Previous: , Up: Routine Groups   [Contents][Index]

11.18 Stack

These routines deal with the stack of variables.


Show the contents of the stack.


Pop values from the stack.


Push values on the stack.

PUSH,a,b pushes a and b onto the stack in that order, so that b ends up on top of the stack. The contents of the stack are listed in reverse order of pushing (i.e., the last pushed one is listed first) by dump_stack. The pop routine pops values from the stack. Arguments to pop that are named variables receive successive values from the stack, so that after PUSH,a,b, POP,c,d restores the pushed value of a into c, and the pushed value of b into d. Arguments that are unnamed must reduce to a number, and that number of values are then popped from the stack into their original named source variables. So, after PUSH,a,b, POP,2 restores a and b from the stack. If you want to restore the number of elements that is contained in a named variable n, then use POP,NUM=n. An argument to keyword num is always treated first.

You can mix named variables and unnamed values in the argument list of pop. Named variables are treated in blocks, unnamed values are treated one by one. For example, POP,a,b,3,c,d,e restores first to b, then to a, then three elements to their original sources, then to e, then to d, and finally to c.