Next: , Previous: , Up: Stack Manipulation   [Contents][Index]


6.6.3 Return stack

A Forth system is allowed to keep local variables on the return stack. This is reasonable, as local variables usually eliminate the need to use the return stack explicitly. So, if you want to produce a standard compliant program and you are using local variables in a word, forget about return stack manipulations in that word (refer to the standard document for the exact rules).

>r ( w – R:w ) core “to-r”
r> ( R:w – w ) core “r-from”
r@ ( – w ; R: w – w  ) core “r-fetch”
r'@ ( r:w r:w2 – r:w r:w2 w ) gforth-1.0 “r-tick-fetch”

The second item on the return stack

rpick ( u – wu ; R: wu ... w0 – wu ... w0  ) gforth-1.0 “rpick”

wu is the uth element on the return stack; 0 rpick is equivalent to r@.

rdrop ( R:w – ) gforth-0.2 “rdrop”
2>r ( w1 w2 – R:w1 R:w2 ) core-ext “two-to-r”
2r> ( R:w1 R:w2 – w1 w2 ) core-ext “two-r-from”
2r@ ( R:w1 R:w2 – R:w1 R:w2 w1 w2 ) core-ext “two-r-fetch”
2rdrop ( R:w1 R:w2 – ) gforth-0.2 “two-r-drop”
n>r ( x1 .. xn n – r:xn..x1 r:n  ) tools-ext “n-to-r”
nr> ( r:xn..x1 r:n – x1 .. xn n  ) tools-ext “n-r-from”

Next: , Previous: , Up: Stack Manipulation   [Contents][Index]