Arguments (System function): Difference between revisions
m (1 revision) |
|||
(10 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:System:Arguments subtitle}} | {{Template:System:Arguments subtitle}} | ||
The <var>Arguments</var> shared function returns the arguments passed in the INCLUDE command for the procedure that contained the <var>Begin</var> statement for the current request. | The <var>Arguments</var> shared function returns the arguments passed in the <var>[[INCLUDE command|INCLUDE]]</var> command for the procedure that contained the <var>Begin</var> statement for the current request. | ||
==Syntax== | ==Syntax== | ||
{{Template:System:Arguments syntax}} | {{Template:System:Arguments syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%string</th><td>A string to receive the arguments passed on the INCLUDE command.</td></tr> | <tr><th>%string</th> | ||
<tr><th><var>%(System)</var></th><td>The class name in parentheses denotes a [[Notation conventions for methods#Shared methods|shared]] method.</td></tr> | <td>A string to receive the arguments passed on the <var>INCLUDE</var> command.</td></tr> | ||
<tr><th><var class="nobr">%(System)</var></th> | |||
<td>The class name in parentheses denotes a [[Notation conventions for methods#Shared methods|shared]] method.</td></tr> | |||
</table> | </table> | ||
Line 15: | Line 18: | ||
<ul> | <ul> | ||
<li>It is processed at evaluation time, not compile time. | <li>It is processed at evaluation time, not compile time. | ||
<li>The entire argument string is returned in one string, providing much more flexibility in how the argument list is parsed. | <li>The entire argument string is returned in one string, providing much more flexibility in how the argument list is parsed. | ||
<li><var>Arguments</var> 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. | <li><var>Arguments</var> 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. | ||
<li><var>Arguments</var> 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. | <li><var>Arguments</var> 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. | ||
<li><var>Arguments</var> makes request invocation arguments available to procedures Included by the outermost evaluating procedure. | <li><var>Arguments</var> makes request invocation arguments available to procedures Included by the outermost evaluating procedure. | ||
</ul> | </ul> | ||
<li>As shown in the [[Arguments_(System_function)#Examples|"Examples"]] section, below, the <var>Arguments</var> method returns everything after the | |||
<li>As shown in the [[Arguments_(System_function)#Examples|"Examples"]] section, below, the <var>Arguments</var> method returns everything after the procedure name on the <var>INCLUDE</var> command, including any blanks or commas after the procedure name. | |||
<li><var>Arguments</var> is available in <var class="product">[[Sirius Mods|Sirius Mods]]</var> Version 7.2 and later. | <li><var>Arguments</var> is available in <var class="product">[[Sirius Mods|Sirius Mods]]</var> Version 7.2 and later. | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
<ol><li>If procedure FOO contains the following: | <ol><li>If procedure <code>FOO</code> contains the following: | ||
<p class="code">begin | <p class="code">begin | ||
printText {~} = '{%(system):arguments}' | [[Targeted Text statements#AuditText, PrintText, and TraceText|printText]] {~} = '{%(system):arguments}' | ||
end | end | ||
</p> | </p> | ||
Line 44: | Line 53: | ||
> I FOO | > I FOO | ||
%(system):arguments = | %(system):arguments = '' | ||
</p> | </p> | ||
<li>Note that the same values, above, would be printed if FOO contained: | <li>Note that the same values, above, would be printed if <code>FOO</code> contained: | ||
<p class="code">begin | <p class="code">begin | ||
i fooInner | i fooInner | ||
end | end | ||
</p> | </p> | ||
and procedure FOOINNER contained: | and procedure <code>FOOINNER</code> contained: | ||
<p class="code">printText {~} = '{%(system):arguments}' | <p class="code">printText {~} = '{%(system):arguments}' | ||
</p> | </p> |
Latest revision as of 16:04, 24 October 2018
The arguments passed to this request (System class)
The Arguments shared function returns the arguments passed in the INCLUDE command for the procedure that contained the Begin statement for the current request.
Syntax
%string = %(System):Arguments
Syntax terms
%string | A string to receive the arguments passed on the INCLUDE command. |
---|---|
%(System) | The class name in parentheses denotes a shared method. |
Usage Notes
- Arguments 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 procedure name on the INCLUDE command, including any blanks or commas after the procedure name.
- Arguments is available in Sirius Mods Version 7.2 and later.
Examples
- If procedure
FOO
contains the following:begin 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:begin i fooInner end
and procedure
FOOINNER
contained:printText {~} = '{%(system):arguments}'