\S1{stackinst} Stack Support

\S2{Exch} Exch

\c [user_var | stack_index]

When no parameter is specified, exchanges the top two elements of the stack. When a parameter is specified and is a user variable, exchanges the top element of the stack with the parameter. When a parameter is specified and is a positive integer, \R{Exch}{Exch} will swap the item on the top of the stack with the item that is specified by the offset from the top of the stack in the parameter. If there are not enough items on the stack to accomplish the exchange, a fatal error will occur (to help you debug your code :).

\c Push 1
\c Push 2
\c Exch
\c Pop $0 # = 1

\c Push 1
\c Push 2
\c Push 3
\c Exch 2
\c Pop $0 # = 1

\c StrCpy $0 1
\c Push 2
\c Exch $0 # = 2
\c Pop $1 # = 1

\S2{Pop} Pop

\c user_var(out)

Pops a string off of the stack into user variable $x. If the stack is empty, the error flag will be set.

\c Push 1
\c Pop $0 # = 1

\S2{Push} Push

\c string

Pushes a string onto the stack. The string can then be Pop'ed off of the stack.

\c Push "a string"
