$List Print: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Display contents of a $list<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Display contents of a $list<section end="desc" /></span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $List_Print function is [[to be entered]].</p>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $List_Print function is the [[Print (Stringlist 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.  


$List_Print accepts five arguments and returns a numeric result. It is a callable $function (:hdref refid=callfun.).  
$List_Print accepts five arguments and returns a numeric result. It is a callable $function (see [[Calling Sirius Mods $functions]]).  


The first argument is the $list identifier of the input $list. This is a required argument.  
The first argument is the $list identifier of the input $list. This is a required argument.  
Line 17: Line 17:


The fifth argument is the maximum number of items to display. A zero or negative value means to display all items to the end of the $list. This is an optional argument and defaults to zero meaning display to the end of the $list.
The fifth argument is the maximum number of items to display. A zero or negative value means to display all items to the end of the $list. This is an optional argument and defaults to zero meaning display to the end of the $list.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> [%RESULT =] $List_Print(listid, num_len, len_len, -
<p class="syntax"><section begin="syntax" /> [%RESULT =] $List_Print(listid, num_len, len_len, -
Line 24: Line 25:
</p>
</p>
<p class="caption">%RESULT is set to the number of $list items displayed.</p>
<p class="caption">%RESULT is set to the number of $list items displayed.</p>
<p class="code">  
<p class="code">  
  0 or greater - Number of items printed
  0 or greater - Number of items printed
Line 32: Line 34:
</p>
</p>


$List_Print, as its name would suggest, is functionally equivalent to a PRINT statement with the exception that $list items longer than 255 bytes are displayed in their entirety. This means that any output redirection or capturing whether it be a USE command or 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 via [[$List_Capture]], only the $list items on the $list before the $List_Print is issued will be displayed and and appended on to its own end.
The following code


$LIST_PRINT, as its name would suggest, is functionally equivalent to a PRINT statement with the exception that $list items longer than 255 bytes are displayed in their entirety. This means that any output redirection or capturing whether it be a USE command or 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 via $LIST_CAPTURE, only the $list items on the $list before the $List_Print is issued will be displayed and and appended on to its own end.
The following code
<p class="code"> %LIST = $ListNew
<p class="code"> %LIST = $ListNew
  %RC = $List_Capture(%LIST)
  %RC = $List_Capture(%LIST)
  PRINT 'I will not talk out of turn in class'
  PRINT 'I will not talk out of turn in class'
  FOR %I FROM 1 TO 10
  FOR %I FROM 1 TO 10
%RC = $List_Print(%LIST)
    %RC = $List_Print(%LIST)
  END FOR
  END FOR
  %RC = $List_Capture
  %RC = $List_Capture
</p>
</p>
would populate the $list %LIST with 1024 $list items that each contain "I will not talk out of turn in class".  
would populate the $list %LIST with 1024 $list items that each contain "I will not talk out of turn in class".  



Revision as of 20:13, 10 February 2011

<section begin="desc" />Display contents of a $list<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $List_Print function is the Print (Stringlist 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 (see Calling Sirius Mods $functions).

The first argument is the $list identifier of the input $list. This is a required argument.

The second argument is 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 is an optional argument and defaults to 0 meaning the item numbers will not be displayed.

The third argument is 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 is an optional argument and defaults to 0 meaning the item lengths will not be displayed.

The fourth argument is the first item number to display. This is an optional argument and defaults to 1.

The fifth argument is the maximum number of items to display. A zero or negative value means to display all items to the end of the $list. This is an optional argument and defaults to zero meaning display to the end of the $list.

Syntax

<section begin="syntax" /> [%RESULT =] $List_Print(listid, num_len, len_len, - first_item, max_items) <section end="syntax" />

$List_Print Function

%RESULT is set to the number of $list items displayed.

0 or greater - Number of items printed All errors result in request cancellation

$List_Print return codes

$List_Print, as its name would suggest, is functionally equivalent to a PRINT statement with the exception that $list items longer than 255 bytes are displayed in their entirety. This means that any output redirection or capturing whether it be a USE command or 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 via $List_Capture, only the $list items on the $list before the $List_Print is issued will be displayed and and appended on to its own end. The following 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

would populate the $list %LIST with 1024 $list items that each contain "I will not talk out of turn in class".

This $function is new in Version 6.2 of the Sirius Mods.

Products authorizing $List_Print