PatchLines (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 12: Line 12:
{{Template:Stringlist:PatchLines syntax}}
{{Template:Stringlist:PatchLines syntax}}
===Syntax terms===
===Syntax terms===
<dl>
<table class="syntaxTable">
<dt>updSL
<tr><th>updSL </th>
<dd>A Stringlist object that reproduces the original updated file, that is, '''baseSL''' updated by the '''patchSL''' updates.
<td>A Stringlist object that reproduces the original updated file, that is, '''baseSL''' updated by the '''patchSL''' updates. </td></tr>
<dt>patchSL
<tr><th>patchSL </th>
<dd>A Stringlist object that contains the patch file (one line per '''patchSL''' item).
<td>A Stringlist object that contains the patch file (one line per '''patchSL''' item). </td></tr>
<dt>baseSL
<tr><th>baseSL </th>
<dd>A Stringlist object that contains the original base file, each line stored as a '''baseSL''' item.
<td>A Stringlist object that contains the original base file, each line stored as a '''baseSL''' item. </td></tr>
<dt>Options='ErrRet'
<tr><th>Options='ErrRet' </th>
<dd>The optional Options argument (name required) is the string value <tt>.ErrRet</tt>, which may be specified in uppercase or lowercase. If you specify <tt>.Options='ErrRet'</tt>, Patch method errors return a null '''updSL''' Stringlist and no error message instead of canceling the request. If you do not specify <tt>.Options='ErrRet'</tt> and a method error occurs, you receive an error message and the run is cancelled.  
<td>The optional Options argument (name required) is the string value <tt>.ErrRet</tt>, which may be specified in uppercase or lowercase. If you specify <tt>.Options='ErrRet'</tt>, Patch method errors return a null '''updSL''' Stringlist and no error message instead of canceling the request. If you do not specify <tt>.Options='ErrRet'</tt> and a method error occurs, you receive an error message and the run is cancelled.</td></tr>
</dl>
</table>




[[Category:Stringlist methods|PatchLines function]]
[[Category:Stringlist methods|PatchLines function]]

Revision as of 21:08, 16 January 2011

Apply patch Stringlist to a base Stringlist (Stringlist class)


This method uses Unix-style .diff output to update text lines that are stored in a Stringlist.

PatchLines applies a given patch file (converted to a Stringlist) to a base file (also a Stringlist), and it returns a Stringlist that is the base file updated by the differences contained in the patch file. PatchLines has the same functionality as the Patch (Stringlist function), but its syntax is slightly different: it reverses the method object and principal argument of Patch. In PatchLines, the patch file Stringlist is the method object and the base file Stringlist is the principal method argument; in Patch the base file Stringlist is the method object and the patch file Stringlist is a method argument. Both PatchLines and Patch support only a line-oriented patch. For usage notes and an example, see the Patch (Stringlist function) description. For working with character-oriented .diff output, use the PatchString (Stringlist function).

The PatchLines method is available as of Sirius Mods Version 7.2.

PatchLines is a member of the Stringlist class.

Syntax

%updList = sl:PatchLines( baseList, [Options= string])

Syntax terms

updSL A Stringlist object that reproduces the original updated file, that is, baseSL updated by the patchSL updates.
patchSL A Stringlist object that contains the patch file (one line per patchSL item).
baseSL A Stringlist object that contains the original base file, each line stored as a baseSL item.
Options='ErrRet' The optional Options argument (name required) is the string value .ErrRet, which may be specified in uppercase or lowercase. If you specify .Options='ErrRet', Patch method errors return a null updSL Stringlist and no error message instead of canceling the request. If you do not specify .Options='ErrRet' and a method error occurs, you receive an error message and the run is cancelled.