$ListCmp: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
(Automatically generated page update)
 
(35 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$ListCmp}}
{{DISPLAYTITLE:$ListCmp}}
<span class="pageSubtitle"><section begin="desc" />Compare two $lists and produce $list describing differences<section end="desc" /></span>
<span class="pageSubtitle">Compare two $lists and produce $list describing differences</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListCmp function is the [[Compare (Stringlist function)]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListCmp function is the <var>[[Compare (Stringlist function)|Compare]]</var> function.</p>


This function compares two $lists and produces a $list describing the differences between the $lists.  
This function compares two $lists and produces a $list describing the differences between the $lists.  


The $ListCmp function accepts five arguments and returns a numeric result. It is a callable $function (see [[Calling Sirius Mods $functions]]).  
The <var>$ListCmp</var> function accepts five arguments and returns a numeric result. It is a [[Calling Sirius Mods $functions|callable]] $function.  


The first argument is the identifier of a $list containing data with 8 byte sequence numbers. This is a required argument.  
The first argument is the identifier of a $list containing data with 8 byte sequence numbers. This is a required argument.  
Line 19: Line 19:


==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> [%RESULT =] $ListCmp(list_id1, list_id2, list_id3, -
<p class="syntax">[%RESULT =] $ListCmp(list_id1, list_id2, list_id3, sync_count, pad)
sync_count, pad)
<section end="syntax" /></p>
<p class="caption">$ListCmp Function
</p>
</p>
<p class="caption">%RESULT is set either to the number of items in the output $list, or to a negative error code if an error has occurred.</p>


The output $list produced by $ListCmp is in a format that is suitable as input to $ListUpd. For example, if input $list 1 contains
<p><var class="term">%result</var> is set either to the number of items in the output $list, or to a negative error code if an error has occurred.</p>


<p class="code"> 00010000B
===Error codes===
00020000
<p class="code">-3 - No room to create $list items
00030000PRINT 'QUENTIN COMPSON'
      (if LISTFC <var>$SirParm</var> parameter not set)
00040000
-5 - Required argument not specified
00050000END
-6 - $List identifier invalid
-7 - Invalid synchronization count
-8 - Input $list 1 has invalid format
</p>
</p>


and input $list 2 contains
==Usage notes==
<ul>
<li>The output $list produced by <var>$ListCmp</var> is in a format that is suitable as input to <var>[[$ListUpd]]</var>. For example, if input $list 1 contains:


<p class="code"> B
<p class="code">00010000B
00020000
00030000PRINT 'QUENTIN COMPSON'
00040000
00050000END
</p>
 
and input $list 2 contains:
 
<p class="code">B
   
   
PRINT 'QUENTIN COMPSON'
PRINT 'QUENTIN COMPSON'
PRINT 'HARVARD DIVING TEAM, 1908'
PRINT 'HARVARD DIVING TEAM, 1908'
   
   
END
END
</p>
</p>


the statement
Then this statement:


<p class="code"> %RESULT = $ListCmp(%INLIST1, %INLIST2, %OUTLIST)
<p class="code">%RESULT = $ListCmp(%INLIST1, %INLIST2, %OUTLIST)
</p>
</p>


would result in the $list identified by %OUTLIST containing
results in the $list identified by %OUTLIST containing:


<p class="code"> .li;./ I 00030000 $ 00030001 00010000
<p class="code">./ I 00030000 $ 00030001 00010000
PRINT 'HARVARD DIVING TEAM, 1908'
PRINT 'HARVARD DIVING TEAM, 1908'
</p>
</p>


The first input $list to $ListCmp can be most easily created with the $ProcDat function using the third $ProcDat parameter to indicate a sequence number.
The first input $list to <var>$ListCmp</var> can be most easily created with the <var>$ProcDat</var> function using the third <var>$ProcDat</var> parameter to indicate a sequence number.
 
</ul>
<p class="code">
-3 - No room to create $list items
        (if LISTFC $SirParm parameter not set)
-5 - Required argument not specified
-6 - $List identifier invalid
-7 - Invalid synchronization count
-8 - Input $list 1 has invalid format
</p>
<p class="caption">$ListCmp Error Codes
</p>


<p class="code">
==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[SirLib]]</li>
<li>[[SirLib]]</li>
</ul>
</ul>
</p>
<p class="caption">Products authorizing $ListCmp
</p>


[[Category:$Functions|$ListCmp]]
[[Category:$Functions|$ListCmp]]

Latest revision as of 22:51, 20 September 2018

Compare two $lists and produce $list describing differences

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListCmp function is the Compare function.

This function compares two $lists and produces a $list describing the differences between the $lists.

The $ListCmp function accepts five arguments and returns a numeric result. It is a callable $function.

The first argument is the identifier of a $list containing data with 8 byte sequence numbers. This is a required argument.

The second argument is the identifier of a $list containing data without 8 byte sequence numbers. This is a required argument.

The third argument is the identifier of the output $list. This is a required argument.

The fourth argument is a number indicating a synchronization count. When the two input $lists are being compared and a difference has been found, this count indicates the number of lines that must match before they are treated as a true match. This is an optional argument and defaults to 1.

The fifth argument is a pad character to be used to pad any input line that is too short. This is an optional argument and defaults to blank.

Syntax

[%RESULT =] $ListCmp(list_id1, list_id2, list_id3, sync_count, pad)

%result is set either to the number of items in the output $list, or to a negative error code if an error has occurred.

Error codes

-3 - No room to create $list items (if LISTFC $SirParm parameter not set) -5 - Required argument not specified -6 - $List identifier invalid -7 - Invalid synchronization count -8 - Input $list 1 has invalid format

Usage notes

  • The output $list produced by $ListCmp is in a format that is suitable as input to $ListUpd. For example, if input $list 1 contains:

    00010000B 00020000 00030000PRINT 'QUENTIN COMPSON' 00040000 00050000END

    and input $list 2 contains:

    B PRINT 'QUENTIN COMPSON' PRINT 'HARVARD DIVING TEAM, 1908' END

    Then this statement:

    %RESULT = $ListCmp(%INLIST1, %INLIST2, %OUTLIST)

    results in the $list identified by %OUTLIST containing:

    ./ I 00030000 $ 00030001 00010000 PRINT 'HARVARD DIVING TEAM, 1908'

    The first input $list to $ListCmp can be most easily created with the $ProcDat function using the third $ProcDat parameter to indicate a sequence number.

Products authorizing $ListCmp