Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 0b420d0fce195cf4115dc6a3be5c2da2 > files > 309

sphinxbase-devel-0.7-1.fc14.i686.rpm

<!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"/>
<title>SphinxBase: include/sphinxbase/pio.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">SphinxBase&#160;<span id="projectnumber">0.6</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('pio_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<h1>include/sphinxbase/pio.h File Reference</h1>  </div>
</div>
<div class="contents">

<p>file IO related operations.  
<a href="#_details">More...</a></p>
<div class="textblock"><code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;sys/stat.h&gt;</code><br/>
<code>#include &lt;sphinxbase/sphinxbase_export.h&gt;</code><br/>
<code>#include &lt;sphinxbase/prim_type.h&gt;</code><br/>
</div>
<p><a href="pio_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlineiter__t.html">lineiter_t</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Line iterator for files.  <a href="structlineiter__t.html#_details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a96b37e449c7f8698fcfafac1c46cebb2"></a><!-- doxytag: member="pio.h::myfopen" ref="a96b37e449c7f8698fcfafac1c46cebb2" args="(file, mode)" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>myfopen</b>(file, mode)&#160;&#160;&#160;_myfopen((file),(mode),__FILE__,__LINE__)</td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3437935bf372acd79fa68b8f9754fa69"></a><!-- doxytag: member="pio.h::lineiter_t" ref="a3437935bf372acd79fa68b8f9754fa69" args="" -->
typedef struct <a class="el" href="structlineiter__t.html">lineiter_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a3437935bf372acd79fa68b8f9754fa69">lineiter_t</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Line iterator for files. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae72c3bec19638da72dad3849f75c0cd9"></a><!-- doxytag: member="pio.h::bit_encode_t" ref="ae72c3bec19638da72dad3849f75c0cd9" args="" -->
typedef struct <a class="el" href="structbit__encode__s.html">bit_encode_s</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#ae72c3bec19638da72dad3849f75c0cd9">bit_encode_t</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Bitstream encoder - for writing compressed files. <br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT FILE *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#aa3d71506049eb49cf03eff1b89ef281f">fopen_comp</a> (const char *file, const char *mode, int32 *ispipe)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Like fopen, but use popen and zcat if it is determined that "file" is compressed (i.e., has a .z, .Z, .gz, or .GZ extension).  <a href="#aa3d71506049eb49cf03eff1b89ef281f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a87592c3a2d0a00eed9eda014950beb65">fclose_comp</a> (FILE *fp, int32 ispipe)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Close a file opened using fopen_comp.  <a href="#a87592c3a2d0a00eed9eda014950beb65"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT FILE *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#addfd26392f118f811584721b8d4854ce">fopen_compchk</a> (const char *file, int32 *ispipe)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a file for reading, but if file not present try to open compressed version (if file is uncompressed, and vice versa).  <a href="#addfd26392f118f811584721b8d4854ce"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa22301f25d56be607c9ff45f2c935b14"></a><!-- doxytag: member="pio.h::_myfopen" ref="aa22301f25d56be607c9ff45f2c935b14" args="(const char *file, const char *mode, const char *pgm, int32 line)" -->
SPHINXBASE_EXPORT FILE *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#aa22301f25d56be607c9ff45f2c935b14">_myfopen</a> (const char *file, const char *mode, const char *pgm, int32 line)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Wrapper around fopen to check for failure and E_FATAL if failed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a601277430d3221bf1906bb879ae26d3e">fread_retry</a> (void *pointer, int32 size, int32 num_items, FILE *stream)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">NFS file reads seem to fail now and then.  <a href="#a601277430d3221bf1906bb879ae26d3e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a11e0daa4f315d01c2e030d3a0abe702c">fread_line</a> (FILE *stream, size_t *out_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a line of arbitrary length from a file and return it as a newly allocated string.  <a href="#a11e0daa4f315d01c2e030d3a0abe702c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a22d0125ab198f02f8bbe543417d99566"></a><!-- doxytag: member="pio.h::lineiter_start" ref="a22d0125ab198f02f8bbe543417d99566" args="(FILE *fh)" -->
SPHINXBASE_EXPORT <a class="el" href="structlineiter__t.html">lineiter_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a22d0125ab198f02f8bbe543417d99566">lineiter_start</a> (FILE *fh)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Start reading lines from a file. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aff8df0b6928746d61b3520555263f71e"></a><!-- doxytag: member="pio.h::lineiter_next" ref="aff8df0b6928746d61b3520555263f71e" args="(lineiter_t *li)" -->
SPHINXBASE_EXPORT <a class="el" href="structlineiter__t.html">lineiter_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#aff8df0b6928746d61b3520555263f71e">lineiter_next</a> (<a class="el" href="structlineiter__t.html">lineiter_t</a> *li)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Move to the next line in the file. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3f80e5d4d666426cef229dd41237d9cf"></a><!-- doxytag: member="pio.h::lineiter_free" ref="a3f80e5d4d666426cef229dd41237d9cf" args="(lineiter_t *li)" -->
SPHINXBASE_EXPORT void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a3f80e5d4d666426cef229dd41237d9cf">lineiter_free</a> (<a class="el" href="structlineiter__t.html">lineiter_t</a> *li)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop reading lines from a file. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a82e4694a4c13c96550f2410f8c63b1f5"></a><!-- doxytag: member="pio.h::bit_encode_attach" ref="a82e4694a4c13c96550f2410f8c63b1f5" args="(FILE *outfh)" -->
<a class="el" href="structbit__encode__s.html">bit_encode_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a82e4694a4c13c96550f2410f8c63b1f5">bit_encode_attach</a> (FILE *outfh)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Attach bitstream encoder to a file. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ada6d9bb75e08493cde00d396dae088f1"></a><!-- doxytag: member="pio.h::bit_encode_retain" ref="ada6d9bb75e08493cde00d396dae088f1" args="(bit_encode_t *be)" -->
<a class="el" href="structbit__encode__s.html">bit_encode_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#ada6d9bb75e08493cde00d396dae088f1">bit_encode_retain</a> (<a class="el" href="structbit__encode__s.html">bit_encode_t</a> *be)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Retain pointer to a bit encoder. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a8330637520174419771670ed740c9049">bit_encode_free</a> (<a class="el" href="structbit__encode__s.html">bit_encode_t</a> *be)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Release pointer to a bit encoder.  <a href="#a8330637520174419771670ed740c9049"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a59d83bd5850d9ec58175c566d6d48f71"></a><!-- doxytag: member="pio.h::bit_encode_write" ref="a59d83bd5850d9ec58175c566d6d48f71" args="(bit_encode_t *be, unsigned char const *bits, int nbits)" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a59d83bd5850d9ec58175c566d6d48f71">bit_encode_write</a> (<a class="el" href="structbit__encode__s.html">bit_encode_t</a> *be, unsigned char const *bits, int nbits)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write bits to encoder. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae71dedb663c8e3ae8b91dbfbc95ac420"></a><!-- doxytag: member="pio.h::bit_encode_write_cw" ref="ae71dedb663c8e3ae8b91dbfbc95ac420" args="(bit_encode_t *be, uint32 codeword, int nbits)" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#ae71dedb663c8e3ae8b91dbfbc95ac420">bit_encode_write_cw</a> (<a class="el" href="structbit__encode__s.html">bit_encode_t</a> *be, uint32 codeword, int nbits)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write lowest-order bits of codeword to encoder. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3e818645e567961225977a1923debc3d"></a><!-- doxytag: member="pio.h::bit_encode_flush" ref="a3e818645e567961225977a1923debc3d" args="(bit_encode_t *be)" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a3e818645e567961225977a1923debc3d">bit_encode_flush</a> (<a class="el" href="structbit__encode__s.html">bit_encode_t</a> *be)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Flush any unwritten bits, zero-padding if necessary. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a0ba35509687e80ee65ba731c7cfcad9b">stat_retry</a> (const char *file, struct stat *statbuf)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">There is no bitstream decoder, because a stream abstraction is too slow.  <a href="#a0ba35509687e80ee65ba731c7cfcad9b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a289e3a1582ab60563ae0689979992669"></a><!-- doxytag: member="pio.h::stat_mtime" ref="a289e3a1582ab60563ae0689979992669" args="(const char *file)" -->
SPHINXBASE_EXPORT int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a289e3a1582ab60563ae0689979992669">stat_mtime</a> (const char *file)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return time of last modification for the given file, or -1 if stat fails. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pio_8h.html#a6df697b8a08cd4d11fe7b864dcb99012">build_directory</a> (const char *path)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a directory and all of its parent directories, as needed.  <a href="#a6df697b8a08cd4d11fe7b864dcb99012"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>file IO related operations. </p>
<p>Custom fopen with error checking is implemented. fopen_comp can open a file with .z, .Z, .gz or .GZ extension</p>
<p>WARNING: Usage of stat_retry will results in 100s of waiting time if the file doesn't exist. </p>

<p>Definition in file <a class="el" href="pio_8h_source.html">pio.h</a>.</p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a8330637520174419771670ed740c9049"></a><!-- doxytag: member="pio.h::bit_encode_free" ref="a8330637520174419771670ed740c9049" args="(bit_encode_t *be)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int bit_encode_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structbit__encode__s.html">bit_encode_t</a> *&#160;</td>
          <td class="paramname"><em>be</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Release pointer to a bit encoder. </p>
<p>Note that this does NOT flush any leftover bits. </p>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00502">502</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="pio_8c_source.html#l00502">bit_encode_free()</a>, and <a class="el" href="ckd__alloc_8c_source.html#l00241">ckd_free()</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00502">bit_encode_free()</a>, and <a class="el" href="huff__code_8c_source.html#l00486">huff_code_detach()</a>.</p>

</div>
</div>
<a class="anchor" id="a6df697b8a08cd4d11fe7b864dcb99012"></a><!-- doxytag: member="pio.h::build_directory" ref="a6df697b8a08cd4d11fe7b864dcb99012" args="(const char *path)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int build_directory </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>path</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create a directory and all of its parent directories, as needed. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, &lt;0 on failure. </dd></dl>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00599">599</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="pio_8c_source.html#l00599">build_directory()</a>, and <a class="el" href="err_8h_source.html#l00169">E_ERROR</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00599">build_directory()</a>.</p>

</div>
</div>
<a class="anchor" id="a87592c3a2d0a00eed9eda014950beb65"></a><!-- doxytag: member="pio.h::fclose_comp" ref="a87592c3a2d0a00eed9eda014950beb65" args="(FILE *fp, int32 ispipe)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT void fclose_comp </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>fp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>ispipe</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Close a file opened using fopen_comp. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">fp</td><td>In: File pointer to be closed </td></tr>
    <tr><td class="paramname">ispipe</td><td>In: ispipe argument that was returned by the corresponding <a class="el" href="pio_8h.html#aa3d71506049eb49cf03eff1b89ef281f" title="Like fopen, but use popen and zcat if it is determined that &quot;file&quot; is compressed (i...">fopen_comp()</a> call </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00175">175</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="pio_8c_source.html#l00175">fclose_comp()</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00175">fclose_comp()</a>.</p>

</div>
</div>
<a class="anchor" id="aa3d71506049eb49cf03eff1b89ef281f"></a><!-- doxytag: member="pio.h::fopen_comp" ref="aa3d71506049eb49cf03eff1b89ef281f" args="(const char *file, const char *mode, int32 *ispipe)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT FILE* fopen_comp </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32 *&#160;</td>
          <td class="paramname"><em>ispipe</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Like fopen, but use popen and zcat if it is determined that "file" is compressed (i.e., has a .z, .Z, .gz, or .GZ extension). </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">file</td><td>In: File to be opened </td></tr>
    <tr><td class="paramname">mode</td><td>In: "r" or "w", as with normal fopen </td></tr>
    <tr><td class="paramname">ispipe</td><td>Out: On return *ispipe is TRUE iff file was opened via a pipe </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00098">98</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8c_source.html#l00241">ckd_free()</a>, <a class="el" href="err_8h_source.html#l00169">E_ERROR</a>, <a class="el" href="err_8h_source.html#l00142">E_ERROR_SYSTEM</a>, <a class="el" href="err_8h_source.html#l00127">E_FATAL</a>, <a class="el" href="pio_8c_source.html#l00098">fopen_comp()</a>, and <a class="el" href="strfuncs_8c_source.html#l00062">string_join()</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00098">fopen_comp()</a>, and <a class="el" href="pio_8c_source.html#l00192">fopen_compchk()</a>.</p>

</div>
</div>
<a class="anchor" id="addfd26392f118f811584721b8d4854ce"></a><!-- doxytag: member="pio.h::fopen_compchk" ref="addfd26392f118f811584721b8d4854ce" args="(const char *file, int32 *ispipe)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT FILE* fopen_compchk </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32 *&#160;</td>
          <td class="paramname"><em>ispipe</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Open a file for reading, but if file not present try to open compressed version (if file is uncompressed, and vice versa). </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">file</td><td>In: File to be opened </td></tr>
    <tr><td class="paramname">ispipe</td><td>Out: On return *ispipe is TRUE iff file was opened via a pipe </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00192">192</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8h_source.html#l00248">ckd_calloc</a>, <a class="el" href="ckd__alloc_8c_source.html#l00241">ckd_free()</a>, <a class="el" href="err_8h_source.html#l00164">E_WARN</a>, <a class="el" href="pio_8c_source.html#l00098">fopen_comp()</a>, and <a class="el" href="pio_8c_source.html#l00192">fopen_compchk()</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00192">fopen_compchk()</a>.</p>

</div>
</div>
<a class="anchor" id="a11e0daa4f315d01c2e030d3a0abe702c"></a><!-- doxytag: member="pio.h::fread_line" ref="a11e0daa4f315d01c2e030d3a0abe702c" args="(FILE *stream, size_t *out_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT char* fread_line </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>out_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Read a line of arbitrary length from a file and return it as a newly allocated string. </p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000029">Deprecated:</a></b></dt><dd>Use line iterators instead.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">stream</td><td>The file handle to read from. </td></tr>
    <tr><td class="paramname">out_len</td><td>Output: if not NULL, length of the string read. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>allocated string containing the line, or NULL on error or EOF. </dd></dl>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00312">312</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="ckd__alloc_8h_source.html#l00253">ckd_malloc</a>, <a class="el" href="ckd__alloc_8h_source.html#l00258">ckd_realloc</a>, and <a class="el" href="pio_8c_source.html#l00312">fread_line()</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00312">fread_line()</a>, and <a class="el" href="huff__code_8c_source.html#l00309">huff_code_read()</a>.</p>

</div>
</div>
<a class="anchor" id="a601277430d3221bf1906bb879ae26d3e"></a><!-- doxytag: member="pio.h::fread_retry" ref="a601277430d3221bf1906bb879ae26d3e" args="(void *pointer, int32 size, int32 num_items, FILE *stream)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int32 fread_retry </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>pointer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>num_items</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>stream</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>NFS file reads seem to fail now and then. </p>
<p>Use the following functions in place of the regular fread. It retries failed freads several times and quits only if all of them fail. Be aware, however, that even normal failures such as attempting to read beyond EOF will trigger such retries, wasting about a minute in retries. Arguments identical to regular fread. </p>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00344">344</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="err_8h_source.html#l00142">E_ERROR_SYSTEM</a>, and <a class="el" href="pio_8c_source.html#l00344">fread_retry()</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00344">fread_retry()</a>.</p>

</div>
</div>
<a class="anchor" id="a0ba35509687e80ee65ba731c7cfcad9b"></a><!-- doxytag: member="pio.h::stat_retry" ref="a0ba35509687e80ee65ba731c7cfcad9b" args="(const char *file, struct stat *statbuf)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int32 stat_retry </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct stat *&#160;</td>
          <td class="paramname"><em>statbuf</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>There is no bitstream decoder, because a stream abstraction is too slow. </p>
<p>Instead we read blocks of bits and treat them as bitvectors. Like fread_retry, but for stat. Arguments identical to regular stat. Return value: 0 if successful, -1 if stat failed several attempts. </p>

<p>Definition at line <a class="el" href="pio_8c_source.html#l00426">426</a> of file <a class="el" href="pio_8c_source.html">pio.c</a>.</p>

<p>References <a class="el" href="err_8h_source.html#l00142">E_ERROR_SYSTEM</a>, and <a class="el" href="pio_8c_source.html#l00426">stat_retry()</a>.</p>

<p>Referenced by <a class="el" href="pio_8c_source.html#l00461">stat_mtime()</a>, and <a class="el" href="pio_8c_source.html#l00426">stat_retry()</a>.</p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="pio_8h.html">pio.h</a>      </li>
      <li class="footer">Generated on Tue Apr 19 2011 for SphinxBase by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>