ARGS
From Macros Wiki
Jump to navigationJump to search
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>
- The name of the variable to be defined.
- For a string variable, the name must end with a dollar sign "$".
- For an array variable, you must specify the number of elements in the array.
- For example MyNumericArray(10) or MyStringArray$(15).
- When using arrays, the first element is always 1.
A maximum of 10 variable names may be defined, each separetd by a comma.
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 GlobalLocal_Sub.mac