Author Topic: NEW STACK-Commands for the SPR.  (Read 796 times)

0 Members and 1 Guest are viewing this topic.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1035
  • User-Rate: +30/-4
    • it-berater
NEW STACK-Commands for the SPR.
« on: October 18, 2020, 08:39:21 AM »
Who used FORTH several years ago or had a calculator in UPN-Notation, knows the importance of a STACK.
A stack that can be used with all commands, that will take the result of operations also if you do not take them.
The SPR has two such stacks, a LOCAL Stack and a GLOBAL stack.
For these some new commands have been added and will be available with the next Update.

How to use the Stack with the SPR?
Any command that returns a result will place it on the TOS (Top of stack) when you do not give a variable for the result.
But don't worry the stack will not "overflow" it has a builtin maximum size".
Also you can add values, or strings, or formulas, or whatever to the stack using "PUV.","POV." and now new: "PSS.","PVS." and more commands.
You can get them back using the POP. Command.

There has been a general change about this in the Past.

In early times, Variables were just pushed onto the stack and eventually expanded when you POP. the values from stack.
Now the POP.-Command does not do any variable expansion anymore.
That's why there are now several commands to place variables and values on the stack.
For example if you use "POV." to place a variablöe on teh stack like this:
Code: [Select]
$$TXT=Hallo
POV.$$TXT
and then return it somewhere using
Code: [Select]
POP.$$VARthen you will have "$$TXT" inside of $$VAR, as PUV. does not do any variable expansion and POP. will also not.
This way you can just "transfer a variable name". Which you could use (to return some result) or expand it later using
Code: [Select]
VAV.$$RES=$$TXTIf you use "PUV." instead, the variable will be expanded before its placed on the stack.
So you will find "Hallo" on the TOS and not the Name of the Variable ($$TXT).

While PVS. and PUS. explicitly does NOT resolve variables and special-folder, POP. also does not,  PUV. PSS., PNS do just that.
PVS. - Put Variable-Name on Stack without resolving anything
PSS. - Resolve Variables and Special-Folders before putting the Variable on Stack
PNS. - Do a numerical resolution and calculate Formulas in the Variable (if they are in ()). Then put the result on TOS.
PUV. - Do a Variable-Type dependent Variable resolution. Variables that are defined in some way have a Variable-Type (See GVT.-Command)
PUS. - Put Variable-Name on Stack without resolving anything. Unlike PVS., Variables will not be split if separated with |"|". Just the whole Parameter will be placed on TOS.




« Last Edit: October 18, 2020, 09:05:10 AM by Theo Gottwald »