ARGS: Difference between revisions
From Macros Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Command|syntax=[[Image:args.png|right|AGRS]]ARGS <nowiki><var name>, <var name>, <var name> (max 10 variables)</nowiki> | {{Command|syntax=[[Image:args.png|right|AGRS]]ARGS <nowiki><var name>, <var name>, <var name> (max 10 variables)</nowiki> | ||
|description=: | |description=:When you call another macro, you can optionally pass one ore move values to that macro. The ARGS command is used to define the names of variables that are local to the macro being called, to contain the values being passed. | ||
|param1=<nowiki><var name></nowiki>|param1_desc={{var name}} | |param1=<nowiki><var name></nowiki>|param1_desc={{var name}} | ||
Line 8: | Line 8: | ||
===Example=== | ===Example=== | ||
:ARGS r1, e3, | :CALL "NewMacro.mac", MyNum, 2.53, "abc", MyVal | ||
:In the macro that is called ("NewMacro.mac")<br> | |||
:ARGS r1, e3, ab$, ResultVal | |||
<br> | |||
:In "NewMacro.mac": | |||
:r1 will be set to the value stored in the variable MyNum in the calling macro. | |||
:e3 will be set to 2.53 | |||
:ab$ will be set to "abc" | |||
:ResultVal will be set to the value stored in the variable MyVal in the calling macro. | |||
<br> | |||
:If you change the values in the variables r1 and/or ResultVal in the macro "NewMacro.mac" | |||
:these new values will be passed back to the calling macro and used to update the variables | |||
:MyNum and Myval. | |||
:For an example macro see [[Modify_op_path2]] | :For an example macro see [[Modify_op_path2]] | ||
[[Category:Variable_Definitions]] | [[Category:Variable_Definitions]] |
Revision as of 21:25, 29 July 2010
Command
- When you call another macro, you can optionally pass one ore move values to that macro. The ARGS command is used to define the names of variables that are local to the macro being called, to contain the values being passed.
Parameters
- <var name>
- Set the value of a number variable
- <var name>
- Set the value of a number variable
- <var name>
- Set the value of a number variable
Example
- CALL "NewMacro.mac", MyNum, 2.53, "abc", MyVal
- In the macro that is called ("NewMacro.mac")
- ARGS r1, e3, ab$, ResultVal
- In "NewMacro.mac":
- r1 will be set to the value stored in the variable MyNum in the calling macro.
- e3 will be set to 2.53
- ab$ will be set to "abc"
- ResultVal will be set to the value stored in the variable MyVal in the calling macro.
- If you change the values in the variables r1 and/or ResultVal in the macro "NewMacro.mac"
- these new values will be passed back to the calling macro and used to update the variables
- MyNum and Myval.
- For an example macro see Modify_op_path2