$Deflate: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(25 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Compress a longstring with Deflate</span>
<span class="pageSubtitle">Compress a longstring with Deflate</span>


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


This function compresses a longstring using the "deflate" algorithm. The deflate algorithm is described completely in RFC 1951. It is very effective with HTML and XML data.  
This function compresses a longstring using the "deflate" algorithm. The deflate algorithm is described completely in RFC 1951. It is very effective with HTML and XML data.  


The <var>$Deflate</var> function accepts two arguments and returns a longstring result.
The <var>$Deflate</var> function accepts two arguments and returns a longstring result.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %LSTRC = $Deflate(%lstr, option)
<p class="syntax"><span class="term">%lstrc</span> = <span class="literal">$Deflate</span>(%lstr, option)
<section end="syntax" /></p>
<p class="caption">$Deflate Function
</p>
</p>
<p class="caption">%LSTRC is the returned longstring.</p>


The first argument is the longstring to be compressed, and it is required.  
===Syntax terms===
<table class="syntaxTable">
<tr><th>%lstrc</th>
<td>The returned longstring.</td></tr>


The second argument is a string that describes the type of compression to perform on the longstring. This argument is optional; if it is not specified, DYNAMIC compression is used. Valid options and their meanings are:
<tr><th>%lstr</th>
<td>The longstring to be compressed; it is required. </td></tr>
 
<tr><th>option</th>
<td>A string that describes the type of compression to perform on the longstring. This argument is optional; if it is not specified, DYNAMIC compression is used. Valid options and their meanings are:


<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>FIXED</th>
<tr><th><var>FIXED</var></th>
<td>Indicates that compression is done with fixed codes. The fixed code tables used for compression (defined as part of RFC 1951) are somewhat optimized for ASCII character data, but 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.</td></tr>
<td>Indicates that compression is done with fixed codes. The fixed code tables used for compression (defined as part of RFC 1951) are somewhat optimized for ASCII character data, but 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.</td></tr>
<tr><th>DYNAMIC</th>
 
<tr><th><var>DYNAMIC</var></th>
<td>Indicates that 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.
<td>Indicates that 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.
</td></tr></table>
</td></tr></table>
</td></tr></table>


Usage notes:
==Usage notes==
<ul>
<ul>
<li> If an invalid option is passed, or compression is not enabled for the current run, the request is cancelled.  
<li> If an invalid option is passed, or compression is not enabled for the current run, the request is cancelled.  
<li> The NCMPBUF parameter must be set by User 0 before the <var>$Deflate</var> function can be used. If <var>$Deflate</var> is called with NCMPBUF = 0, the request is cancelled.  
<li> The NCMPBUF parameter must be set by User 0 before the <var>$Deflate</var> function can be used. If <var>$Deflate</var> is called with NCMPBUF = 0, the request is cancelled.  
Line 34: Line 40:
</ul>
</ul>


==Example==
In the following example, %LSTRC is set to the compressed version of the given string:
In the following example, %LSTRC is set to the compressed version of the given string:
<p class="code"> %LSTRC = $Deflate('How much wood could a woodchuck chuck', 'FIXED')
<p class="code"> %LSTRC = $Deflate('How much wood could a woodchuck chuck', 'FIXED')
</p>
</p>
<p>'''Note: ''' No other string or longstring functions can be usefully performed on the compressed string until it is decompressed with $Inflate . :enote
<p>'''Note: ''' No other string or longstring functions can be usefully performed on the compressed string until it is decompressed with <var>[[$Inflate]]</var>.  
 
==Products authorizing $Deflate==
==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[Sirius Functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
 
</ul>
</ul>
<p class="caption">Products authorizing $Deflate
</p>


[[Category:$Functions|$Deflate]]
[[Category:$Functions|$Deflate]]

Latest revision as of 22:51, 20 September 2018

Compress a longstring with Deflate

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

This function compresses a longstring using the "deflate" algorithm. The deflate algorithm is described completely in RFC 1951. It is very effective with HTML and XML data.

The $Deflate function accepts two arguments and returns a longstring result.

Syntax

%lstrc = $Deflate(%lstr, option)

Syntax terms

%lstrc The returned longstring.
%lstr The longstring to be compressed; it is required.
option A string that describes the type of compression to perform on the longstring. This argument is optional; if it is not specified, DYNAMIC compression is used. Valid options and their meanings are:
FIXED Indicates that compression is done with fixed codes. The fixed code tables used for compression (defined as part of RFC 1951) are somewhat optimized for ASCII character data, but 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.
DYNAMIC Indicates that 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.

Usage notes

  • If an invalid option is passed, or compression is not enabled for the current run, the request is cancelled.
  • The NCMPBUF parameter must be set by User 0 before the $Deflate function can be used. If $Deflate is called with NCMPBUF = 0, the request is cancelled.
  • As with any compression scheme, it is possible that a particular string will become longer after compression. This would happen, for example, if a deflated string were passed to $Deflate.
  • Short strings (less than 128 bytes) will typically compress better with the FIXED option.

Example

In the following example, %LSTRC is set to the compressed version of the given string:

%LSTRC = $Deflate('How much wood could a woodchuck chuck', 'FIXED')

Note: No other string or longstring functions can be usefully performed on the compressed string until it is decompressed with $Inflate.

Products authorizing $Deflate

Products authorizing $Deflate