Arguments (System function): Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 6: | Line 6: | ||
Arguments is a member of the [[System class]]. | Arguments is a member of the [[System class]]. | ||
</p> | </p> | ||
This shared function returns the arguments passed in the INCLUDE command for the | This shared function returns the arguments passed in the INCLUDE command for the | ||
procedure that contained the Begin statement for the current request. | procedure that contained the Begin statement for the current request. | ||
The Arguments method is available in ''Sirius Mods'' 7.2 and later. | The Arguments method is available in ''Sirius Mods'' 7.2 and later. | ||
===Syntax=== | ===Syntax=== | ||
Line 19: | Line 19: | ||
<dt>%(system) | <dt>%(system) | ||
<dd>The class name in parentheses denotes a shared method. | <dd>The class name in parentheses denotes a shared method. | ||
</dl> | </dl> | ||
===Usage Notes=== | ===Usage Notes=== | ||
Line 43: | Line 43: | ||
</ul> | </ul> | ||
===Examples=== | ===Examples=== | ||
If procedure FOO contains the following: | If procedure FOO contains the following: | ||
< | <p class="code"><nowiki>b | ||
printText {~} = '{%(system):arguments}' | |||
end | |||
</nowiki></p> | |||
</ | |||
The requests (preceded by >) below produce the outputs shown | The requests (preceded by >) below produce the outputs shown | ||
on the line that follows the request: | on the line that follows the request: | ||
< | <p class="code"><nowiki>> I FOO This is a test | ||
%(system):arguments = ' This is a test' | |||
> I FOO,This is a test | |||
%(system):arguments = ',This is a test' | |||
> I FOO This is a test | |||
%(system):arguments = ' This is a test' | |||
> I FOO This,is,a,test | |||
%(system):arguments = ' This,is,a,test' | |||
> I FOO | |||
%(system):arguments = '' | |||
</nowiki></p> | |||
</ | |||
Note that the same values, above, would be printed if FOO contained: | Note that the same values, above, would be printed if FOO contained: | ||
< | <p class="code"><nowiki>b | ||
i fooInner | |||
end | |||
</nowiki></p> | |||
</ | |||
and procedure FOOINNER contained: | and procedure FOOINNER contained: | ||
< | <p class="code"><nowiki>printText {~} = '{%(system):arguments}' | ||
</nowiki></p> | |||
</ |
Revision as of 16:38, 28 February 2011
<section begin=dpl_desc/>Get Invocation Arguments<section end=dpl_desc/>
Arguments is a member of the System class.
This shared function returns the arguments passed in the INCLUDE command for the procedure that contained the Begin statement for the current request.
The Arguments method is available in Sirius Mods 7.2 and later.
Syntax
%args = %(system):Arguments
Syntax Terms
- %args
- A string to contain the arguments passed on the INCLUDE command.
- %(system)
- The class name in parentheses denotes a shared method.
Usage Notes
- The Arguments method provides functionality similar to that provided
by “??” dummy string arguments, with some important differences:
- It is processed at evaluation time, not compile time.
- The entire argument string is returned in one string, providing much more flexibility in how the argument list is parsed.
- Arguments does not “eat” the arguments. That is, it can be invoked as often as you want, and it always returns the same values for a particular request invocation.
- Arguments does not prompt the user for arguments if none were specified; it simply returns a null. This makes it possible for arguments to be optional.
- Arguments makes request invocation arguments available to procedures Included by the outermost evaluating procedure.
- As shown in the “Examples” section, below, the Arguments method returns everything after the INCLUDEd procedure name, including any blanks or commas after the procedure name.
Examples
If procedure FOO contains the following:
b printText {~} = '{%(system):arguments}' end
The requests (preceded by >) below produce the outputs shown on the line that follows the request:
> I FOO This is a test %(system):arguments = ' This is a test' > I FOO,This is a test %(system):arguments = ',This is a test' > I FOO This is a test %(system):arguments = ' This is a test' > I FOO This,is,a,test %(system):arguments = ' This,is,a,test' > I FOO %(system):arguments = ''
Note that the same values, above, would be printed if FOO contained:
b i fooInner end
and procedure FOOINNER contained:
printText {~} = '{%(system):arguments}'