Stephen,

You got it more or less correct. Actually, the arguments to subroutines are
expressions; not values. So, you can write: o100 call [25] [#1-17/2].

The brackets must be there to separate the expressions.

Ken

[EMAIL PROTECTED]
Mark Kenny Products Company, LLC
55 Main Street       Voice: (888)ISO-SEVO (888)476-7386
Newtown, CT 06470                    Fax: (203)426-9138
http://www.MarkKenny.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Stephen
Wille Padnos
Sent: Thursday, August 16, 2007 10:29 AM
To: Enhanced Machine Controller (EMC)
Subject: Re: [Emc-users] Proglem with EMC script - understandingerror
message




Gene Heskett wrote:

>[big snip]
>
>Then, down in the call statements, the syntax I've found that works
involves
>passing the vars to the subroutine like this example:
>
>N0400 o100 call [#1][#2][#3][#4][#5][#6][#7][#8][#9][#10][#11][#12][#13]
>
>The brackets are required to protect the variables from interpretation
within
>the call statement itself.  You want to pass the variable, not its value,
to
>the subroutine.
>
>This seems to be required because of the isolation between the subroutines
>idea of variables and the main loops idea.  Also, anything a subroutine
does
>to a variable is thrown away at the endsub, and that the call, sub, and
>endsub statements all need to have matching o word numbers.  Ditto for the
>start and end of 'conditional' statements.
>
>
I think the variables #1 through #30 (maybe #0 through #30 - I'm not
sure if they start at 0 or 1) are "locals", so any changes made to them
in a subroutine are not visible to the calling program.  If you want to
use a subroutine to modify a "global" variable, use #31 and higher.  You
also don't need to pass in anything #31 or higher since they're global,
so you can use higher var numbers for any constants and simplify the calls.

Using [#10] passes the value of var 10, just as #10 (without the
brackets) does, AFAIK.  The difference is that after variable
substitution is done, there is no way for the interpreter to decide that
you really wanted one long number (made by concatenating the digits of
all the vars you passed) - remember, the interp removes all spaces from
the input line.  I'm not sure what order the variable replacement vs.
numerical interpretation is done, but I'm pretty sure this is the reason
that things work with brackets and may not without.

[medium snip]


-------------------------------------------------------------------------
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-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

-------------------------------------------------------------------------
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-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to