File: structmschm__compressor.html

package info (click to toggle)
libmspack 0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 3,916 kB
  • sloc: sh: 11,332; ansic: 7,879; perl: 131; makefile: 97
file content (240 lines) | stat: -rw-r--r-- 22,296 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>libmspack: mschm_compressor Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libmspack
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="classes.html"><span>Data&#160;Structure&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-attribs">Data Fields</a>  </div>
  <div class="headertitle">
<div class="title">mschm_compressor Struct Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A compressor for .CHM (Microsoft HTMLHelp) files.  
 <a href="structmschm__compressor.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="mspack_8h_source.html">mspack.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a1d2f3746c1573c1bc174bf6caca77312"><td class="memItemLeft" align="right" valign="top">int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312">generate</a> )(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self, struct <a class="el" href="structmschmc__file.html">mschmc_file</a> file_list[], const char *output_file)</td></tr>
<tr class="memdesc:a1d2f3746c1573c1bc174bf6caca77312"><td class="mdescLeft">&#160;</td><td class="mdescRight">Generates a CHM help file.  <a href="#a1d2f3746c1573c1bc174bf6caca77312">More...</a><br/></td></tr>
<tr class="separator:a1d2f3746c1573c1bc174bf6caca77312"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ba1f823ef2a1ed388cd9bf34d007141"><td class="memItemLeft" align="right" valign="top">int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmschm__compressor.html#a8ba1f823ef2a1ed388cd9bf34d007141">use_temporary_file</a> )(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self, int use_temp_file, const char *temp_file)</td></tr>
<tr class="memdesc:a8ba1f823ef2a1ed388cd9bf34d007141"><td class="mdescLeft">&#160;</td><td class="mdescRight">Specifies whether a temporary file is used during CHM generation.  <a href="#a8ba1f823ef2a1ed388cd9bf34d007141">More...</a><br/></td></tr>
<tr class="separator:a8ba1f823ef2a1ed388cd9bf34d007141"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb48d706306afc67607493b850838b49"><td class="memItemLeft" align="right" valign="top">int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmschm__compressor.html#abb48d706306afc67607493b850838b49">set_param</a> )(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self, int param, unsigned int value)</td></tr>
<tr class="memdesc:abb48d706306afc67607493b850838b49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a CHM compression engine parameter.  <a href="#abb48d706306afc67607493b850838b49">More...</a><br/></td></tr>
<tr class="separator:abb48d706306afc67607493b850838b49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88c6c1ab6787f04cf70eb53bb8195cfb"><td class="memItemLeft" align="right" valign="top">int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmschm__compressor.html#a88c6c1ab6787f04cf70eb53bb8195cfb">last_error</a> )(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self)</td></tr>
<tr class="memdesc:a88c6c1ab6787f04cf70eb53bb8195cfb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the error code set by the most recently called method.  <a href="#a88c6c1ab6787f04cf70eb53bb8195cfb">More...</a><br/></td></tr>
<tr class="separator:a88c6c1ab6787f04cf70eb53bb8195cfb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A compressor for .CHM (Microsoft HTMLHelp) files. </p>
<p>All fields are READ ONLY.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="mspack_8h.html#a749d6b350987be706728e020e875b13f" title="Creates a new CHM compressor. ">mspack_create_chm_compressor()</a>, <a class="el" href="mspack_8h.html#a05c47f6572f3966d9495810332356b94" title="Destroys an existing CHM compressor. ">mspack_destroy_chm_compressor()</a> </dd></dl>
</div><h2 class="groupheader">Field Documentation</h2>
<a class="anchor" id="a1d2f3746c1573c1bc174bf6caca77312"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int(* mschm_compressor::generate)(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self, struct <a class="el" href="structmschmc__file.html">mschmc_file</a> file_list[], const char *output_file)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Generates a CHM help file. </p>
<p>The help file will contain up to two sections, an Uncompressed section and potentially an MSCompressed (LZX compressed) section.</p>
<p>While the contents listing of a CHM file is always in lexical order, the file list passed in will be taken as the correct order for files within the sections. It is in your interest to place similar files together for better compression.</p>
<p>There are two modes of generation, to use a temporary file or not to use one. See <a class="el" href="structmschm__compressor.html#a8ba1f823ef2a1ed388cd9bf34d007141" title="Specifies whether a temporary file is used during CHM generation. ">use_temporary_file()</a> for the behaviour of <a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a> in these two different modes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a self-referential pointer to the <a class="el" href="structmschm__compressor.html" title="A compressor for .CHM (Microsoft HTMLHelp) files. ">mschm_compressor</a> instance being called </td></tr>
    <tr><td class="paramname">file_list</td><td>an array of <a class="el" href="structmschmc__file.html" title="A structure which represents a file to be placed in a CHM helpfile. ">mschmc_file</a> structures, terminated with an entry whose <a class="el" href="structmschmc__file.html#a11c5bd77b0142d3c3a94c5a24126e030" title="One of MSCHMC_ENDLIST, MSCHMC_UNCOMP or MSCHMC_MSCOMP. ">mschmc_file::section</a> field is <a class="el" href="mspack_8h.html#a80f996d3fbc7800630b9542d5e4620ec" title="mschmc_file::section value: end of CHM file list ">MSCHMC_ENDLIST</a>. The order of the list is preserved within each section. The length of any <a class="el" href="structmschmc__file.html#ab2979483302579db0111fe5cff3d4eb5" title="The full path and filename of the file within the CHM helpfile, a UTF-1 encoded null-terminated strin...">mschmc_file::chm_filename</a> string cannot exceed roughly 4096 bytes. Each source file must be able to supply as many bytes as given in the <a class="el" href="structmschmc__file.html#aee5c029845e1ce6112c8d050d9b23fda" title="The length of the file, in bytes. ">mschmc_file::length</a> field. </td></tr>
    <tr><td class="paramname">output_file</td><td>the file to write the generated CHM helpfile to. This is passed directly to <a class="el" href="structmspack__system.html#a1a85cac5eeb55db6a432fe3824aa04a3" title="Opens a file for reading, writing, appending or updating. ">mspack_system::open()</a> </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>an error code, or MSPACK_ERR_OK if successful </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="structmschm__compressor.html#a8ba1f823ef2a1ed388cd9bf34d007141" title="Specifies whether a temporary file is used during CHM generation. ">use_temporary_file()</a> <a class="el" href="structmschm__compressor.html#abb48d706306afc67607493b850838b49" title="Sets a CHM compression engine parameter. ">set_param()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a88c6c1ab6787f04cf70eb53bb8195cfb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int(* mschm_compressor::last_error)(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the error code set by the most recently called method. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a self-referential pointer to the <a class="el" href="structmschm__compressor.html" title="A compressor for .CHM (Microsoft HTMLHelp) files. ">mschm_compressor</a> instance being called </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the most recent error code </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="structmschm__compressor.html#abb48d706306afc67607493b850838b49" title="Sets a CHM compression engine parameter. ">set_param()</a>, <a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="abb48d706306afc67607493b850838b49"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int(* mschm_compressor::set_param)(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self, int param, unsigned int value)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets a CHM compression engine parameter. </p>
<p>The following parameters are defined:</p>
<ul>
<li><a class="el" href="mspack_8h.html#aa33210e31d2272c1c015849281bc8028" title="mschm_compressor::set_param() parameter: &quot;timestamp&quot; header ">MSCHMC_PARAM_TIMESTAMP</a>: Sets the "timestamp" of the CHM file generated. This is not a timestamp, see <a class="el" href="structmschmd__header.html#ab844b2365051d8c99ce41ae0a0f4c106" title="The &quot;timestamp&quot; of the CHM helpfile. ">mschmd_header::timestamp</a> for a description. If this timestamp is 0, <a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a> will use its own algorithm for making a unique ID, based on the lengths and names of files in the CHM itself. Defaults to 0, any value between 0 and (2^32)-1 is valid.</li>
<li><a class="el" href="mspack_8h.html#a0ad26bd80adf64598352066814153335" title="mschm_compressor::set_param() parameter: &quot;language&quot; header ">MSCHMC_PARAM_LANGUAGE</a>: Sets the "language" of the CHM file generated. This is not the language used in the CHM file, but the language setting of the user who ran the HTMLHelp compiler. It defaults to 0x0409. The valid range is between 0x0000 and 0x7F7F.</li>
<li><a class="el" href="mspack_8h.html#a0ee4a588079a3f6bf65b63ce388c9a45" title="mschm_compressor::set_param() parameter: LZX window size ">MSCHMC_PARAM_LZXWINDOW</a>: Sets the size of the LZX history window, which is also the interval at which the compressed data stream can be randomly accessed. The value is not a size in bytes, but a power of two. The default value is 16 (which makes the window 2^16 bytes, or 64 kilobytes), the valid range is from 15 (32 kilobytes) to 21 (2 megabytes).</li>
<li><a class="el" href="mspack_8h.html#ad17047eb4450c7476d29d47fb5f1ce35" title="mschm_compressor::set_param() parameter: intra-chunk quickref density ">MSCHMC_PARAM_DENSITY</a>: Sets the "density" of quick reference entries stored at the end of directory listing chunk. Each chunk is 4096 bytes in size, and contains as many file entries as there is room for. At the other end of the chunk, a list of "quick reference" pointers is included. The offset of every 'N'th file entry is given a quick reference, where N = (2^density) + 1. The default density is<ol type="1">
<li>The smallest density is 0 (N=2), the maximum is 10 (N=1025). As each file entry requires at least 5 bytes, the maximum number of entries in a single chunk is roughly 800, so the maximum value 10 can be used to indicate there are no quickrefs at all.</li>
</ol>
</li>
<li><a class="el" href="mspack_8h.html#ac6c61f24c4d9ad2a5a9bcdbb8057723a" title="mschm_compressor::set_param() parameter: whether to create indices ">MSCHMC_PARAM_INDEX</a>: Sets whether or not to include quick lookup index chunk(s), in addition to normal directory listing chunks. A value of zero means no index chunks will be created, a non-zero value means index chunks will be created. The default is zero, "don't
  create an index".</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a self-referential pointer to the <a class="el" href="structmschm__compressor.html" title="A compressor for .CHM (Microsoft HTMLHelp) files. ">mschm_compressor</a> instance being called </td></tr>
    <tr><td class="paramname">param</td><td>the parameter to set </td></tr>
    <tr><td class="paramname">value</td><td>the value to set the parameter to </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>MSPACK_ERR_OK if all is OK, or MSPACK_ERR_ARGS if there is a problem with either parameter or value. </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a8ba1f823ef2a1ed388cd9bf34d007141"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int(* mschm_compressor::use_temporary_file)(struct <a class="el" href="structmschm__compressor.html">mschm_compressor</a> *self, int use_temp_file, const char *temp_file)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Specifies whether a temporary file is used during CHM generation. </p>
<p>The CHM file format includes data about the compressed section (such as its overall size) that is stored in the output CHM file prior to the compressed section itself. This unavoidably requires that the compressed section has to be generated, before these details can be set. There are several ways this can be handled. Firstly, the compressed section could be generated entirely in memory before writing any of the output CHM file. This approach is not used in libmspack, as the compressed section can exceed the addressable memory space on most architectures.</p>
<p>libmspack has two options, either to write these unknowable sections with blank data, generate the compressed section, then re-open the output file for update once the compressed section has been completed, or to write the compressed section to a temporary file, then write the entire output file at once, performing a simple file-to-file copy for the compressed section.</p>
<p>The simple solution of buffering the entire compressed section in memory can still be used, if desired. As the temporary file's filename is passed directly to <a class="el" href="structmspack__system.html#a1a85cac5eeb55db6a432fe3824aa04a3" title="Opens a file for reading, writing, appending or updating. ">mspack_system::open()</a>, it is possible for a custom <a class="el" href="structmspack__system.html" title="A structure which abstracts file I/O and memory management. ">mspack_system</a> implementation to hold this file in memory, without writing to a disk.</p>
<p>If a temporary file is set, <a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a> performs the following sequence of events: the temporary file is opened for writing, the compression algorithm writes to the temporary file, the temporary file is closed. Then the output file is opened for writing and the temporary file is re-opened for reading. The output file is written and the temporary file is read from. Both files are then closed. The temporary file itself is not deleted. If that is desired, the temporary file should be deleted after the completion of <a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a>, if it exists.</p>
<p>If a temporary file is set not to be used, <a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a> performs the following sequence of events: the output file is opened for writing, then it is written and closed. The output file is then re-opened for update, the appropriate sections are seek()ed to and re-written, then the output file is closed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>a self-referential pointer to the <a class="el" href="structmschm__compressor.html" title="A compressor for .CHM (Microsoft HTMLHelp) files. ">mschm_compressor</a> instance being called </td></tr>
    <tr><td class="paramname">use_temp_file</td><td>non-zero if the temporary file should be used, zero if the temporary file should not be used. </td></tr>
    <tr><td class="paramname">temp_file</td><td>a file to temporarily write compressed data to, before opening it for reading and copying the contents to the output file. This is passed directly to <a class="el" href="structmspack__system.html#a1a85cac5eeb55db6a432fe3824aa04a3" title="Opens a file for reading, writing, appending or updating. ">mspack_system::open()</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>an error code, or MSPACK_ERR_OK if successful </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="structmschm__compressor.html#a1d2f3746c1573c1bc174bf6caca77312" title="Generates a CHM help file. ">generate()</a> </dd></dl>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="mspack_8h_source.html">mspack.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>