Print (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Template:Stringlist:Print subtitle}}
{{Template:Stringlist:Print subtitle}}


This callable method displays the contents of a <var>Stringlist</var> on the user's standard output device, typically a terminal.
This [[Notation conventions for methods#Callable functions|callable]] method displays the contents of a <var>Stringlist</var> on the user's standard output device, typically a terminal.


==Syntax==
==Syntax==
Line 7: Line 7:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%rc</th>
<tr><th>%count</th>
<td>A numeric variable that is set to the number of <var>Stringlist</var> items displayed. </td></tr>
<td>A numeric variable that is set to the number of <var>Stringlist</var> items displayed. </td></tr>
<tr><th>sl</th>
<tr><th>sl</th>
<td>A <var>Stringlist</var> object. </td></tr>
<td>The <var>Stringlist</var> object. </td></tr>
<tr><th>NumWidth=itemnumlen</th>
<tr><th><var>NumWidth</var></th>
<td>The number of bytes in the display of each line to use for the item number. The parameter name <tt>.NumWidth</tt> is optional. The length must be a number between 0 and 10 inclusive; if it is greater than 0, a blank is placed after the item number. Item numbers are right-justified within the indicated number of bytes, and they are truncated on the left if the length of the item number exceeds the space allocated for it. This is an optional argument; it defaults to zero, which means the item numbers are not displayed. </td></tr>
<td>The number of bytes in the display of each line to use for the item number. The parameter name, <var>NumWidth</var>, is optional. The length must be a number between 0 and 10 inclusive; if it is greater than 0, a blank is placed after the item number. Item numbers are right-justified within the indicated number of bytes, and they are truncated on the left if the length of the item number exceeds the space allocated for it. <p>This is an optional argument; it defaults to zero, which means the item numbers are not displayed. </p></td></tr>
<tr><th>LenWidth=itemlen</th>
<tr><th><var>LenWidth</var></th>
<td>The number of bytes in the display of each line to use for the item length. The parameter name <tt>.LenWidth</tt> is optional. The length must be a number between 0 and 4 inclusive; if it is greater than 0, a blank is placed after the item length. Item lengths are right-justified within the indicated number of bytes, and they are truncated on the left if the length of the item length exceeds the space allocated for it. This is an optional argument; it defaults to zero, which means the item lengths are not displayed. </td></tr>
<td>The number of bytes in the display of each line to use for the item length. The parameter name, <var>LenWidth</var>, is optional. The length must be a number between 0 and 4 inclusive; if it is greater than 0, a blank is placed after the item length. Item lengths are right-justified within the indicated number of bytes, and they are truncated on the left if the length of the item length exceeds the space allocated for it. <p>This is an optional argument; it defaults to zero, which means the item lengths are not displayed. </p></td></tr>
<tr><th>Start=firstitem</th>
<tr><th><var>Start</var></th>
<td>Alternatively named <tt>.Start</tt>, this is the number of the initial item to display. This is an optional argument, and it defaults to 1. </td></tr>
<td>The number of the initial item to display. The parameter name, <var>Start</var>, is optional. <p>This is an optional argument, and it defaults to 1. </p></td></tr>
<tr><th>MaxItems=maxitems</th>
<tr><th><var>MaxItems</var></th>
<td>Alternatively named <tt>.MaxItems</tt>, this is the maximum number of items to display. A zero or negative value means to display all the <var>Stringlist</var> items. This is an optional argument; it defaults to zero, which means display to the end of the <var>Stringlist</var>.</td></tr>
<td>The maximum number of items to display. The parameter name, <var>MaxItems</var>, is optional. A zero or negative value means to display all the <var class="term">sl</var> items. <p>This is an optional argument; it defaults to zero, which means display to the end of <var class="term">sl</var>.</p></td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul><li>All errors in <var>Print</var> result in request cancellation.
<li>The parameter names were introduced in <var class=product>Sirius Mods</var> Version 7.0; for versions prior to that, the parameters can only be specified positionally.
<li>The parameter names were introduced in <var class="product">Sirius Mods</var> Version 7.0; for versions prior to that, the parameters can only be specified positionally.
For example, to display the contents of a <var>Stringlist</var> with 6 bytes to be used for the column containing the item width, and limiting the display to 20 items, you can use positional parameters:
For example, to display the contents of a <var>Stringlist</var> with 6 bytes to be used for the column containing the item width, and limiting the display to 20 items, you can use positional parameters:
<p class="code">%listrint(,6,,20)
</p>


<pre>
Under <var class="product">Sirius Mods</var> 7.0 and later, you can do the same thing with named parameters:
%listrint(,6,,20)
<p class="code">%listrint(lenWidth=6, maxItems=20)
</pre>
</p>
 
Under <var class=product>Sirius Mods</var> 7.0 and later, you can do the same thing with named parameters:
 
<pre>
%listrint(lenWidth=6, maxItems=20)
</pre>
 
<li>All errors in Print result in request cancellation.
</ul>
</ul>


[[Category:Stringlist methods|Print function]]
==See also==
{{Template:Stringlist:Print footer}}

Latest revision as of 19:34, 31 October 2012

Display contents of a Stringlist (Stringlist class)


This callable method displays the contents of a Stringlist on the user's standard output device, typically a terminal.

Syntax

[%count =] sl:Print[( [[NumWidth=] number], [[LenWidth=] number], - [[Start=] number], [[MaxItems=] number])]

Syntax terms

%count A numeric variable that is set to the number of Stringlist items displayed.
sl The Stringlist object.
NumWidth The number of bytes in the display of each line to use for the item number. The parameter name, NumWidth, is optional. The length must be a number between 0 and 10 inclusive; if it is greater than 0, a blank is placed after the item number. Item numbers are right-justified within the indicated number of bytes, and they are truncated on the left if the length of the item number exceeds the space allocated for it.

This is an optional argument; it defaults to zero, which means the item numbers are not displayed.

LenWidth The number of bytes in the display of each line to use for the item length. The parameter name, LenWidth, is optional. The length must be a number between 0 and 4 inclusive; if it is greater than 0, a blank is placed after the item length. Item lengths are right-justified within the indicated number of bytes, and they are truncated on the left if the length of the item length exceeds the space allocated for it.

This is an optional argument; it defaults to zero, which means the item lengths are not displayed.

Start The number of the initial item to display. The parameter name, Start, is optional.

This is an optional argument, and it defaults to 1.

MaxItems The maximum number of items to display. The parameter name, MaxItems, is optional. A zero or negative value means to display all the sl items.

This is an optional argument; it defaults to zero, which means display to the end of sl.

Usage notes

  • All errors in Print result in request cancellation.
  • The parameter names were introduced in Sirius Mods Version 7.0; for versions prior to that, the parameters can only be specified positionally. For example, to display the contents of a Stringlist with 6 bytes to be used for the column containing the item width, and limiting the display to 20 items, you can use positional parameters:

    %listrint(,6,,20)

    Under Sirius Mods 7.0 and later, you can do the same thing with named parameters:

    %listrint(lenWidth=6, maxItems=20)

See also