push

push — Pushes a value into the global stack.

Description

Pushes a value into the global stack.

Syntax

push  xval1, [xval2, ... , xval31]
push  ival1, [ival2, ... , ival31]

Initialization

ival1 ... ival31 - values to be pushed into the stack.

Performance

xval1 ... xval31 - values to be pushed into the stack.

The given values are pushed into the global stack as a bundle. The global stack works in LIFO order: after multiple push calls, pop should be used in reverse order.

Each push or pop operation can work on a "bundle" of multiple variables. When using pop, the number, type, and order of items must match those used by the corresponding push. That is, after a 'push Sfoo, ibar', you must call something like 'pop Sbar, ifoo', and not e.g. two separate 'pop' statements.

push and pop opcodes can take variables of any type (i-, k-, a- and strings). Use of any combination of i, k, a, and S types is allowed. Variables of type 'a' and 'k' are passed at performance time only, while 'i' and 'S' are passed at init time only.

push/pop for a, k, i, and S types copy data by value. By contrast, push_f only pushes a "reference" to the f-signal, and then the corresponding pop_f will copy directly from the original variable to its output signal. For this reason, changing the source f-signal of push_f before pop_f is called is not recommended, and if the instrument instance owning the variable that was passed by push_f is deactivated before pop_f is called, undefined behavior may occur.

Any stack errors (trying to push when there is no more space, or pop from an empty stack, inconsistent number or type of arguments, etc.) are fatal and terminate performance.

See also

stack, pop, pop_f and push_f.

Credits

By: Istvan Varga.

2006