the fellow over at 
http://www.linuxcnc.org/component/option,com_kunena/Itemid,20/func,view/catid,38/id,14365/limit,6/limitstart,6/lang,english/#14623
came up with the following gcode (101.ngc in the attachment; non-essential 
lines deleted)


O<101> sub (tool change sub)

o<101> if [#5400 eq #9 and #9 ne 0]
..
o<101> endif

o<101> if [#5400 EQ #9 AND #5399 EQ -1]
...
...
o<101> endif

o<101> if [#5400 EQ #9 and #9 ne 0 AND #5399 NE -1]
        o<101> endsub
o<101> endif

As the interpreter stands now, this isnt detected, and as long as there are no 
nested block structures, it isnt necessarily an error. It will fail miserably 
as soon as nested block structures are used.

however, I propose to firm up the usage of oword labels as follows:

1. labels marking a while/if/repeat shall not be reused
2. 'endwhile','break', and 'continue' require a 'while' with the same label 
name and lower line number
3. 'elsif', 'else' and ' endif' require an 'if' with the same label name and 
lower line number (yes, there's an undocumented 'elsif')
4. 'endrepeat' requires a preceding 'repeat' with same label and lower line 
number

I've done it for 'if' to detect above example label reuse. It's about 8 lines 
before making it a function.

I'll make it warning for now (with canon MESSAGE() or to stderr) and see how it 
works out

-m
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to