On Thursday 16 August 2007, Stephen Wille Padnos wrote: >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.
I was going to point that out too, but the verbosity meter was already pegged. However, I make active use of this isolation in most of my code, as I see that as an advantage. >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. The bottom line is that it doesn't work without them for what I've written, so I use them. Your explanation is the correct one I suspect, since I've not even looked over the fence, let alone walked around in that code. :) Thanks Stephen. -- Cheers, Gene "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) The good life was so elusive It really got me down I had to regain some confidence So I got into camouflage ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
