Arguments (System function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (guess subtitle, syntax and footer template names, match syntax terms to template, lots of tags and edits.)
Line 1: Line 1:
<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Get Invocation Arguments<section end=dpl_desc/></b></span>
{{Template:System:Arguments subtitle}}
[[Category:System methods|Arguments function]]
The <var>Arguments</var> shared function returns the arguments passed in the <code>INCLUDE</code> command for the procedure that contained the <code>Begin</code> statement for the current request.
[[Category:System/Subsystem methods]]
<!--DPL?? Category:System methods|Arguments function: Get Invocation Arguments-->
<p>
Arguments is a member of the [[System class]].
</p>
   
   
This shared function returns the arguments passed in the INCLUDE command for the
==Syntax==
procedure that contained the Begin statement for the current request.
{{Template:System:Arguments syntax}}
===Syntax Terms===
The Arguments method is available in ''Sirius Mods'' 7.2 and later.
<table class="syntaxTable">
===Syntax===
<tr><th>%string</th><td>A string to receive the arguments passed on the INCLUDE command.</td></tr>
  %args = %(system):Arguments
<tr><th>%(system)</th><td>The class name in parentheses denotes a shared method.</td></tr>
====Syntax Terms====
</table>
<dl>
 
<dt><i><b>%args</b></i>
==Usage Notes==
<dd>A string to contain the arguments passed on the INCLUDE command.
<dt>%(system)
<dd>The class name in parentheses denotes a shared method.
</dl>
===Usage Notes===
<ul>
<ul>
<li>The Arguments method provides functionality similar to that provided
<li><var>Arguments</var> provides functionality similar to that provided by <code>??</code> dummy string arguments, with some important differences:
by &ldquo;??&rdquo; dummy string arguments, with some important differences:
<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
<li>The entire argument string is returned in one string, providing much more flexibility in how the argument list is parsed.
flexibility in how the argument list is parsed.
<li><var>Arguments</var> does not &ldquo;eat&rdquo; 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>Arguments does not &ldquo;eat&rdquo; the arguments.
<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.
That is, it can be invoked as often as you want, and it always returns the same values
<li><var>Arguments</var> makes request invocation arguments available to procedures Included by the outermost evaluating procedure.
for a particular request invocation.
<li>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.
<li>Arguments makes request invocation arguments available to procedures
Included by the outermost evaluating procedure.
</ul>
</ul>
<li>As shown in the &ldquo;Examples&rdquo; section, below,
<li>As shown in the [[Arguments_(System_function)#Example|Examples]] section, below, the Arguments method returns everything after the INCLUDEd procedure name, including any blanks or commas after the procedure name.
the Arguments method returns everything after the INCLUDEd procedure name,
<li><var>Arguments</var>  is available in <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.2 and later.
including any blanks or commas after the procedure name.
</ul>
</ul>
===Examples===
 
==Examples==
If procedure FOO contains the following:
<ol><li>If procedure FOO contains the following:
<p class="code"><nowiki>b
<p class="code">begin
printText {~} = '{%(system):arguments}'
  printText {~} = '{%(system):arguments}'
end
end
</nowiki></p>
</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">> I FOO This is a test
<p class="code"><nowiki>> I FOO This is a test
%(system):arguments = ' This is a test'
%(system):arguments = ' This is a test'
   
   
Line 65: Line 45:
> I FOO
> I FOO
%(system):arguments = ''
%(system):arguments = ''
</nowiki></p>
</p>
<li>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">begin
<p class="code"><nowiki>b
  i fooInner
i fooInner
end
end
</nowiki></p>
</p>
and procedure FOOINNER contained:
and procedure FOOINNER contained:
<p class="code"><nowiki>printText {~} = '{%(system):arguments}'
<p class="code">printText {~} = '{%(system):arguments}'
</nowiki></p>
</p>
</ol>
 
==See also==
{{Template:System:Arguments footer}}

Revision as of 00:51, 19 March 2011

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

%stringA 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 INCLUDEd procedure name, including any blanks or commas after the procedure name.
  • Arguments is available in "Sirius Mods" Version 7.2 and later.

Examples

  1. 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 =

  2. Note that the same values, above, would be printed if FOO contained:

    begin i fooInner end

    and procedure FOOINNER contained:

    printText {~} = '{%(system):arguments}'

See also