GOTO_CONSTRAINT new system variable

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

GOTO_CONSTRAINT new system variable

Post by gdyvig » Wed Mar 04, 2009 4:11 am

Proposal: New system variable GOTO_CONSTRAINT.

GOTO_CONSTRAINT=0 (goto any label)
GOTO_CONSTRAINT=1 (goto any label in a SRT)
GOTO_CONSTRAINT=2 (no goto's allowed)

The default would be 0 for backward compatibility.
Value 1 would allow things like early exits from SRTs and looping structures within a SRTs or a macro.
Value 2 would be for purists.

If GOTO_CONSTRAINT=1 or 2, the interpreter could assume the script is structured and that once in a SRT the code would never leave the SRT without going to END>.

Examples of what would be allowed with Value 1.

Code: Select all

Label>Start
if>%parm%=1
  //allowed
  GoTo>TheVeryEnd
endif
SRT>SUBBY
   Let>EndSub=END_SUBBY
   if>%parm%=2
        //allowed
       GoTo>%EndSub%
   endif
   //not allowed
   GoTo>TheVeryEnd
   //not allowed
   GoTo>MIDSUBBY2
   GoSub>SUBBY2
   Label>END_SUBBY
END>SUBBY
SRT>SUBBY2
   Label>MIDSUBBY2
   //not allowed
   GoTo>END_SUBBY 
   //allowed
   GoTo>MIDSUBBY2 
END>SUBBY2
if>%parm%=3
  //allowed
  GoTo>Start
endif
Label>TheVeryEnd
Related Post: Interpreter needs to know all SRTs will properly END so it can disable/re-enable OnEvent correctly. Expect other applications as well. See below.

http://www.mjtnet.com/usergroup/viewtopic.php?t=5350

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts