<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JXX-Commands: "Jump If ..." |
MiniRobotLanguage (MRL)
RRS. Command
Reset Return Stack
Intention
Error-handling in Subroutines, called with GSB./JSR. or equivalent Jump-Subroutine-Instructions, like:
• STW. - Description with the "W", or "V"-Option
• ! SCW - Search-Child-Window with the "W", or "V"-Option
• ITW. with the "W", or "V"-Option
• ICW. with the "W", or "V"-Option
• any other of the JIX. - Jumps, when using the ":"-Label Option
Imagine you have called a subroutine using JSR.
Normally you would return from there using RET. And then continue your script.
Now there is an error or special condition. You want to jump directly to the error-handler in the main-script. Or you want to just re-run the complete script from start?
If you do just that, there will be more and more useless entries on the so called "Return stack". That is the place, where each JSR./GSB. remembers where to jump back in case of a return (RET.). Now comes RRS. and JRR.
With RRS. you can clear the RET.-Stack and make the robot forget all previous GSB./JSR. Usage is simple, use:
' This will clear the complete Return Stack
RRS.
You can also choose to remove only the the last P1-number of entries from the return stack if a number is given for P1.
' ... will only remove the last entry
RRS.1
Then you can just re-run the Script or do whatever is needed.
You can use RRS. on any of the following cases. Note in the case of FEX.-Instructions that you should prefer to use EFX. if you want to stop the enumeration.
• STW. - Description with the "W", or "V"-Option
• ! SCW - Search-Child-Window with the "W", or "V"-Option
• ITW. with the "W", or "V"-Option
• ICW. with the "W", or "V"-Option
• any other of the JIX. - Jumps, when using the ":"-Label Option
• any of the FEX.-Enumeration Instructions, important: use EFX. in that case
Syntax
RRS.[P1]
Parameter Explanation
P1 - number of Entries to be removed from the Return Stack.
Example
'*************************************
' RRS. Example
'*************************************
DBM.2
$$LOP=1
:retry
DOL.$$LOP=1
JSR.suba
OOP.
MBX.?
END.
:suba
IVV.$$ERR=1
RRS.
JMP.retry
ELS.
JSR.sub
EVV.
' return normal way
RET.
:sub
' Do something
RET.
Remarks
Alternatively you can use JMP.retry|r
Limitations:
-
See also:
• JRR. - Jump and Reset Return-Stack
• JSR. - Jump SubRoutine (Label)
• JME. - Jump on More or Equal
• JLE. - Jump on Less or Equal