$List Print: Difference between revisions
(Automatically generated page update) |
m (add square brackets) |
||
(11 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Display contents of a $list</span> | <span class="pageSubtitle">Display contents of a $list</span> | ||
<p class="warn"><b>Note: </b> | <p class="warn"><b>Note:</b> Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the <var>$List_Print</var> function is the <var>[[Print (Stringlist function)|Print]]</var> function. </p> | ||
This function displays the contents of a $list on the user's standard output device, typically a terminal. | This function displays the contents of a $list on the user's standard output device, typically a terminal. | ||
Line 8: | Line 8: | ||
<var>$List_Print</var> accepts five arguments and returns a numeric result. It is a [[Calling Sirius Mods $functions|callable]] $function. | <var>$List_Print</var> accepts five arguments and returns a numeric result. It is a [[Calling Sirius Mods $functions|callable]] $function. | ||
==Syntax== | |||
<p class="syntax">[%result =] $List_Print(listid, [num_len], [len_len], [first_item], [max_items]) | |||
</p> | |||
<table> | |||
<tr><th>%result</th> | |||
<td>A numeric value that is set to the number of $list items displayed. <p> | |||
All errors result in request cancellation. </p></td></tr> | |||
The | <tr><th>listid</th> | ||
<td>The $list identifier of the input $list. This is a required argument. </td></tr> | |||
The | <tr><th>num_len</th> | ||
<td>The number of bytes in the display of each line to use for the item number. This must be a number between 0 and 10 inclusive and, if greater than 0, a blank is placed after the item number. | |||
<p> | |||
Item numbers are right-justified in 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> | |||
<p> | |||
This optional argument defaults to 0, which means the item numbers will not be displayed. </p></td></tr> | |||
<tr><th>len_len</th> | |||
< | <td>The number of bytes in the display of each line to use for the item length. This must be a number between 0 and 4 inclusive and, if greater than 0, a blank is placed after the item length. | ||
</p> | <p> | ||
Item lengths are right-justified in 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> | |||
<p> | |||
This optional argument defaults to 0, which means the item lengths will not be displayed. </p></td></tr> | |||
< | <tr><th>first_item</th> | ||
<td>The first item number to display. This optional argument defaults to 1. </td></tr> | |||
</ | |||
<tr><th>max_items</th> | |||
<p | <td>The maximum number of items to display. A zero or negative value means to display all items to the end of the $list. | ||
</ | <p> | ||
This optional argument defaults to zero, which means display to the end of the $list. </p></td></tr> | |||
</table> | |||
==Usage notes== | ==Usage notes== | ||
$List_Print, as its name would suggest, is functionally equivalent to a | <ul> | ||
<li><var>$List_Print</var>, as its name would suggest, is functionally equivalent to a <var>Print</var> statement, except that $list items longer than 255 bytes are displayed in their entirety. Any output redirection or capturing, whether it be a <var>USE</var> command, a <var>[[$List_Capture]]</var>, or a <var>[[$Sock_Capture]]</var>, will apply to the output of a <var>$List_Print</var>. </li> | |||
<li>If the input $list for a <var>$List_Print</var> is also the current output target of a <var>[[$List_Capture]]</var>, only the $list items that are on the $list before the <var>$List_Print</var> is issued will be displayed and appended to its own end. </li> | |||
</ul> | |||
==Example== | ==Example== | ||
This code fragment would populate the $list % | This code fragment would populate the $list <code>%list</code> with 1024 $list items that each contain "I will not talk out of turn in class": | ||
<p class="code">% | <p class="code">%list = $ListNew | ||
% | %rc = $List_Capture(%list) | ||
Print 'I will not talk out of turn in class' | |||
For %i From 1 To 10 | |||
% | %rc = $List_Print(%list) | ||
End For | |||
% | %rc = $List_Capture | ||
</p> | </p> | ||
==Products authorizing {{PAGENAMEE}}== | ==Products authorizing {{PAGENAMEE}}== | ||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius | <li>[[Sirius Functions]]</li> | ||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[ | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$List_Print]] | [[Category:$Functions|$List_Print]] |
Latest revision as of 23:04, 5 June 2018
Display contents of a $list
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $List_Print function is the Print function.
This function displays the contents of a $list on the user's standard output device, typically a terminal.
$List_Print accepts five arguments and returns a numeric result. It is a callable $function.
Syntax
[%result =] $List_Print(listid, [num_len], [len_len], [first_item], [max_items])
%result | A numeric value that is set to the number of $list items displayed. All errors result in request cancellation. |
---|---|
listid | The $list identifier of the input $list. This is a required argument. |
num_len | The number of bytes in the display of each line to use for the item number. This must be a number between 0 and 10 inclusive and, if greater than 0, a blank is placed after the item number.
Item numbers are right-justified in 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 optional argument defaults to 0, which means the item numbers will not be displayed. |
len_len | The number of bytes in the display of each line to use for the item length. This must be a number between 0 and 4 inclusive and, if greater than 0, a blank is placed after the item length.
Item lengths are right-justified in 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 optional argument defaults to 0, which means the item lengths will not be displayed. |
first_item | The first item number to display. This optional argument defaults to 1. |
max_items | The maximum number of items to display. A zero or negative value means to display all items to the end of the $list.
This optional argument defaults to zero, which means display to the end of the $list. |
Usage notes
- $List_Print, as its name would suggest, is functionally equivalent to a Print statement, except that $list items longer than 255 bytes are displayed in their entirety. Any output redirection or capturing, whether it be a USE command, a $List_Capture, or a $Sock_Capture, will apply to the output of a $List_Print.
- If the input $list for a $List_Print is also the current output target of a $List_Capture, only the $list items that are on the $list before the $List_Print is issued will be displayed and appended to its own end.
Example
This code fragment would populate the $list %list
with 1024 $list items that each contain "I will not talk out of turn in class":
%list = $ListNew %rc = $List_Capture(%list) Print 'I will not talk out of turn in class' For %i From 1 To 10 %rc = $List_Print(%list) End For %rc = $List_Capture