On 23.03.12 16:47, Erik Christiansen wrote:
> 
>        Sub drill_em_there (123.456, 789.012) {
>           Rel Drill X#1 Y#2 Z1.5 Retract 2.8 Repeat 3     // Drills 3 holes.
>        }

Ugh, too much typing of grammars and emails, and not enough observation.
Those parameters shouldn't be there ... unless we keep something like
"(a, b, c)" or "(3)", to allow checking the number of parameters in each
invocation, throughout the program. It's just a matter of adding the
parameter count to the symbol table entry. Is such checking valuable?

For now, I've cut back the grammar to take:

       Sub drill_em_there {
          Rel Drill X#1 Y#2 Z1.5 Retract 2.8 Repeat #3     // Drills N holes.
       }

       ...

       Call drill_em_there (123.456, 789.012, 4)

to generate:

O100   sub
       G91 G81 X#1 Y#2 Z1.5 R2.8 L#3                       ; Drills N holes.
O101   if [#<abs_modality> EQ 1]
          G90
O101   endif
O100   endsub

       (More code, running O-numbers up to 106 in here.)

O100   call  [123.456] [789.012] [4]

It also dawns on me that those squiggly brackets can serve as a reminder
that we're in a new gcode scope, with local copies of #1 to #30. Endsub
doesn't do that for me.

Erik

-- 
Chinese Proverb: He who is willing to work will always find employment.


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to