Zip (String function): Difference between revisions
Jump to navigation
Jump to search
m Automatically generated page update |
No edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{Template:String:Zip subtitle}} | {{Template:String:Zip subtitle}} | ||
==Syntax== | |||
<p class="syntax"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:Zip</span><span class="squareb">[</span><span class="literal">(</span> <span class="squareb">[</span><span class="literal" title="Boolean">FixedCode=</span> <span class="term" title="Boolean">boolean</span><span class="squareb">]</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="Boolean">LazyMatch=</span> <span class="term" title="Boolean">boolean</span><span class="squareb">]</span><span class="comma">,</span> - | |||
<span class="squareb">[</span><span class="literal" title="Number">MaxChain=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="String">Filename=</span> <span class="term" title="String">string</span><span class="squareb">]</span><span class="comma">,</span> - | |||
<span class="squareb">[</span><span class="literal" title="Number">LastModified=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="comma">,</span> - | |||
<span class="squareb">[</span><span class="literal" title="Boolean">Software=</span> <span class="term" title="Boolean">boolean</span><span class="squareb">]</span><span class="literal">)</span><span class="squareb">]</span></p> | |||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%outString</th><td>string</td></tr> | <tr><th>%outString</th> | ||
<td>The result of the ZIP operation, compressing the method object <var class="term">string</var>.</td></tr> | |||
<tr><th>string</th> | <tr><th>string</th> | ||
<td>string</td></tr> | <td>The string to be compressed by the ZIP operation.</td></tr> | ||
<tr><th><var>FixedCode</var></th> | <tr><th><var>FixedCode</var></th> | ||
<td><var>Boolean</var> value< | <td><var>FixedCode</var> is an optional, [[Notation conventions for methods#Named parameters|name required]], parameter that is a <var>[[Boolean_enumeration#Using_Boolean_enumerations|Boolean]]</var> value that specifies whether the compression uses fixed codes or is dynamic, based on the contents of the input <var class="term">string</var>. | ||
<ul> | |||
<li>With fixed code compression (<code>fixedCode=true</code>), the tables used for compression (defined as part of RFC 1951) are somewhat optimized for ASCII character data, but they slightly decrease the amount of CPU required to perform compression. Also, since the codes are already defined as part of the specification, they are not included in the compressed data. | |||
<li>With dynamic compression (<code>fixedCode=false</code>), the compression code tables are generated based on the input data. Dynamic tables typically provide somewhat better compression on most types of data. There is a very slight CPU overhead in computing the frequencies of byte values in the input data. Also, since the code tables are dynamic, they are included as part of the compressed data. This will increase the size of the compressed longstring, but these tables are small, since they are also stored in a compressed form. | |||
</ul> | |||
The default value for this argument is <var>False</var> (use dynamic compression).</td></tr> | |||
<tr><th><var>LazyMatch</var></th> | <tr><th><var>LazyMatch</var></th> | ||
<td><var> | <td><var>LazyMatch</var> is an optional, name required, parameter that is a <var>Boolean</var> value that specifies whether to use "lazy match" compression, as specified in RFC 1951. | ||
The default value for this argument is <var>False</var> (do not use "lazy match" compression).</td></tr> | |||
<tr><th><var>MaxChain</var></th> | <tr><th><var>MaxChain</var></th> | ||
<td> | <td><var>MaxChain</var> is an optional, name required, parameter that is a numeric value that specifies the maximum hash chain length, as explained in RFC 1951. | ||
The default value for this argument is 0. If specified, it must be between 0 and 99, inclusive.</td></tr> | |||
<tr><th><var>Filename</var></th> | <tr><th><var>Filename</var></th> | ||
<td> | <td><var>Filename</var> is an optional, name required, parameter that is a string to be stored as the internal name of the compressed string. Decompression programs will use this name for the output file when the string is un-zipped. The maximum length of the file name is 32 bytes.</td></tr> | ||
<tr><th><var>LastModified</var></th> | <tr><th><var>LastModified</var></th> | ||
<td>number< | <td>The date/time stamp to be stored as a component of <var class="term">%outString</var>, expressed as the number of milliseconds since 12:00 AM, Jan 1, 1900. The default is the current date and time (that is, <var>[[CurrentTimeMilliseconds (System function)|%(System):CurrentTimeMilliseconds]]</var>).</td></tr> | ||
<tr><th><var>Software</var></th> | |||
<td>[Introduced in Model 204 version 8.0] | |||
<p><var>Software</var> is an optional, [[Notation conventions for methods#Named parameters|name required]], parameter that is a <var>[[Boolean_enumeration#Using_Boolean_enumerations|Boolean]]</var> value that specifies whether to force the use of software compression instead of hardware compression.</p> | |||
<ul> | |||
<li>When <code>software=true</code>, compression is always performed in software, even if the DFLTCC hardware instruction is available on the processor. This can be useful for diagnostic purposes or when byte-for-byte reproducibility with pre-8.0 behavior is required.</li> | |||
<li>When <code>software=false</code> (the default), hardware compression is used automatically when DFLTCC is available (IBM z15 and above), falling back to software compression on older processors.</li> | |||
</ul> | |||
The default value for this argument is <var>False</var>. | |||
</td></tr> | |||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | |||
<li>The <var>[[NCMPBUF parameter|NCMPBUF]]</var> parameter must be set by User 0 before <var>Zip</var> can be used. If <var>Zip</var> is called and the <var>NCMPBUF</var> value is 0, the request is cancelled. | |||
</ul> | |||
==See also== | ==See also== | ||
<ul> | |||
<li>Other related methods: | |||
<ul> | |||
<li><var>[[Gunzip (String function)|Gunzip]]</var> | |||
<li><var>[[GunzipDatetimeNS (String function)|GunzipDatetimeNS]]</var> | |||
<li><var>[[GunzipFilename (String function)|GunzipFilename]]</var> | |||
<li><var>[[Gzip (String function)|Gzip]]</var> | |||
<li><var>[[Deflate (String function)|Deflate]]</var> | |||
<li><var>[[Inflate (String function)|Inflate]]</var> | |||
</ul> | |||
</ul> | |||
{{Template:String:Zip footer}} | {{Template:String:Zip footer}} | ||
Latest revision as of 13:58, 19 May 2026
Compress a longstring with ZIP (String class)
[Introduced in Sirius Mods 7.4]
Syntax
%outString = string:Zip[( [FixedCode= boolean], [LazyMatch= boolean], - [MaxChain= number], [Filename= string], - [LastModified= number], - [Software= boolean])]
Syntax terms
| %outString | The result of the ZIP operation, compressing the method object string. |
|---|---|
| string | The string to be compressed by the ZIP operation. |
| FixedCode | FixedCode is an optional, name required, parameter that is a Boolean value that specifies whether the compression uses fixed codes or is dynamic, based on the contents of the input string.
|
| LazyMatch | LazyMatch is an optional, name required, parameter that is a Boolean value that specifies whether to use "lazy match" compression, as specified in RFC 1951. The default value for this argument is False (do not use "lazy match" compression). |
| MaxChain | MaxChain is an optional, name required, parameter that is a numeric value that specifies the maximum hash chain length, as explained in RFC 1951. The default value for this argument is 0. If specified, it must be between 0 and 99, inclusive. |
| Filename | Filename is an optional, name required, parameter that is a string to be stored as the internal name of the compressed string. Decompression programs will use this name for the output file when the string is un-zipped. The maximum length of the file name is 32 bytes. |
| LastModified | The date/time stamp to be stored as a component of %outString, expressed as the number of milliseconds since 12:00 AM, Jan 1, 1900. The default is the current date and time (that is, %(System):CurrentTimeMilliseconds). |
| Software | [Introduced in Model 204 version 8.0]
Software is an optional, name required, parameter that is a Boolean value that specifies whether to force the use of software compression instead of hardware compression.
The default value for this argument is False. |
Usage notes
- The NCMPBUF parameter must be set by User 0 before Zip can be used. If Zip is called and the NCMPBUF value is 0, the request is cancelled.
See also
- Other related methods: