Bugs item #1807761, was opened at 2007-10-04 14:03
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=1807761&group_id=6744

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: EMC2 G-code Interpreter
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Local named parameters not scoping correctly in subroutines

Initial Comment:
The scoping of a named parameter used in a do/while loop behaves differently 
when the do/while loop is inside a subroutine or not inside a subroutine.  In 
the example code below, the do/while loop decrements a local named parameter 
used as a counter variable.  This loop works when used in the main body of the 
gcode but this same code does not work when used inside of a subroutine.  When 
used inside the subroutine #<i> reverts back to it's previous value after 
leaving the o<TestLoop> scope.

SAMPLE GCODE WORKING EXAMPLE
----------------------------
(THIS WORKS, PRINTS 5 4 3 2 1 0 CORRECTLY )
#<i>=5
o<MainLoop> do
   #<i> = [ #<i> - 1 ]
   (PRINT, i = #<i>)
o<MainLoop> while [ #<i> GT 0 ]
M02

SAMPLE GCODE DOES NOT WORK EXAMPLE
----------------------------------
( THIS DOES NOT WORK, GOES INTO INFINITE LOOP )
o<TestSub> call
M02

o<TestSub> sub
   #<i>=5
   o<TestLoop> do
      #<i> = [ #<i> - 1 ]
      (PRINT, i = #<i>)
   o<TestLoop> while [ #<i> GT 0 ]
o<TestSub> endsub

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=1807761&group_id=6744

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to