PatchLines (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
m (minor cleanup)
 
(22 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<span style="font-size:120%"><b>Update base Stringlist with patch</b></span>
{{Template:Stringlist:PatchLines subtitle}}


This method uses Unix-style <tt>.diff</tt> output to update text lines that are stored in a Stringlist.  
This method uses Unix-style [http://en.wikipedia.org/wiki/Diff diff] output to update text lines that are stored in a <var>Stringlist</var>.


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 <tt>.diff</tt> output, use the [[PatchString (Stringlist function)]].  
<var>PatchLines</var> applies a given patch file (converted to a <var>Stringlist</var>) to a base file (also a <var>Stringlist</var>), and it returns an output <var>Stringlist</var> that is the base file updated by the differences contained in the patch file. <var>PatchLines</var> has the same functionality as the <var>[[Patch (Stringlist function)|Patch]]</var> method, but its syntax is slightly different: it reverses the method object and principal arguments of Patch. In <var>PatchLines</var>, the patch file <var>Stringlist</var> is the method object and the base file <var>Stringlist</var> is the principal method argument; in <var>Patch</var> the base file <var>Stringlist</var> is the method object and the patch file <var>Stringlist</var> is a method argument. Both <var>PatchLines</var> and <var>Patch</var> support only a line-oriented patch.


The PatchLines method is available as of ''[[Sirius Mods]]'' Version 7.2.
For usage notes and an example, see the <var>Patch</var> description. For working with character-oriented <tt>diff</tt> output, use the <var>[[PatchString (Stringlist function)|PatchString]]</var> method.


PatchLines is a member of the [[Stringlist class]].
==Syntax==
{{Template:Stringlist:PatchLines syntax}}


==PatchLines Syntax==
===Syntax terms===
<pre>
<table class="syntaxTable">
updSL = patchSL:PatchLines(baseSL [, Options='ErrRet'])
<tr><th>%updList</th>
</pre>
<td>A <var>Stringlist</var> object that reproduces the original updated file, that is, <var class="term">baseList</var> updated by the <var class="term">sl</var> updates.</td></tr>


===Syntax Terms===
<tr><th>sl</th>
<dl>
<td>A <var>Stringlist</var> object that contains the patch file (one line per <var class="term">sl</var> item). </td></tr>
<dt>updSL
<dd>A Stringlist object that reproduces the original updated file, that is, '''baseSL''' updated by the '''patchSL''' updates.
<dt>patchSL
<dd>A Stringlist object that contains the patch file (one line per '''patchSL''' item).
<dt>baseSL
<dd>A Stringlist object that contains the original base file, each line stored as a '''baseSL''' item.
<dt>Options='ErrRet'
<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.
</dl>


<tr><th>baseList</th>
<td>A <var>Stringlist</var> object that contains the original base file, each line stored as a individual <var class="term">baseList</var> item. </td></tr>


[[Category:Stringlist methods|PatchLines function]]
<tr><th><var>Options</var></th>
<td>This optional argument ([[Notation conventions for methods#Named arguments|name required]]) is the string value <code>ErrRet</code>, which may be specified in uppercase or lowercase. If you specify <code>Options='ErrRet'</code>, Patch method errors return a null <var class="term">%updList</var> <var>Stringlist</var> and no error message instead of canceling the request. If you do not specify <code>Options='ErrRet'</code> and a method error occurs, you receive an error message and the run is cancelled.</td></tr>
</table>
 
==Usage notes==
<ul><li><var>PatchLines</var> is available as of <var class="product">Sirius Mods</var> Version 7.2.</ul>
 
==See also==
<ul>
<li>[http://en.wikipedia.org/wiki/Diff diff] for creation of the patch file <var>StringList</var>. </li>
<li><var>[[Patch (Stringlist function)|Patch]]</var> for usage notes and examples. </li>
<li><var>[[PatchString (Stringlist function)|PatchString]]</var> for working with character-oriented diff output. </li>
</ul>
 
{{Template:Stringlist:PatchLines footer}}

Latest revision as of 17:17, 3 February 2015

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 an output Stringlist that is the base file updated by the differences contained in the patch file. PatchLines has the same functionality as the Patch method, but its syntax is slightly different: it reverses the method object and principal arguments 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 description. For working with character-oriented diff output, use the PatchString method.

Syntax

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

Syntax terms

%updList A Stringlist object that reproduces the original updated file, that is, baseList updated by the sl updates.
sl A Stringlist object that contains the patch file (one line per sl item).
baseList A Stringlist object that contains the original base file, each line stored as a individual baseList item.
Options This optional 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 %updList 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.

Usage notes

  • PatchLines is available as of Sirius Mods Version 7.2.

See also

  • diff for creation of the patch file StringList.
  • Patch for usage notes and examples.
  • PatchString for working with character-oriented diff output.