\doxysection{include/sphinxbase/pio.h File Reference}
\label{pio_8h}\index{include/sphinxbase/pio.h@{include/sphinxbase/pio.h}}


file IO related operations.  


{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$sys/stat.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/prim\+\_\+type.\+h$>$}\newline
\doxysubsubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ lineiter\+\_\+t}
\begin{DoxyCompactList}\small\item\em Line iterator for files. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ myfopen}(file,  mode)~\textbf{ \+\_\+myfopen}((file),(mode),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)
\end{DoxyCompactItemize}
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\label{pio_8h_a6d2f813f464a5cdcb8d96f80336d7d0d} 
typedef struct \textbf{ lineiter\+\_\+t} {\bfseries lineiter\+\_\+t}
\begin{DoxyCompactList}\small\item\em Line iterator for files. \end{DoxyCompactList}\item 
typedef struct \textbf{ bit\+\_\+encode\+\_\+s} \textbf{ bit\+\_\+encode\+\_\+t}
\begin{DoxyCompactList}\small\item\em Bitstream encoder -\/ for writing compressed files. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
SPHINXBASE\+\_\+\+EXPORT FILE $\ast$ \textbf{ fopen\+\_\+comp} (const char $\ast$file, const char $\ast$mode, int32 $\ast$ispipe)
\begin{DoxyCompactList}\small\item\em 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). \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ fclose\+\_\+comp} (FILE $\ast$fp, int32 ispipe)
\begin{DoxyCompactList}\small\item\em Close a file opened using fopen\+\_\+comp. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT FILE $\ast$ \textbf{ fopen\+\_\+compchk} (const char $\ast$file, int32 $\ast$ispipe)
\begin{DoxyCompactList}\small\item\em Open a file for reading, but if file not present try to open compressed version (if file is uncompressed, and vice versa). \end{DoxyCompactList}\item 
\label{pio_8h_a8e2f6460bf5e901ea905ccc75f509598} 
SPHINXBASE\+\_\+\+EXPORT FILE $\ast$ {\bfseries \+\_\+myfopen} (const char $\ast$file, const char $\ast$mode, const char $\ast$pgm, int32 line)
\begin{DoxyCompactList}\small\item\em Wrapper around fopen to check for failure and E\+\_\+\+FATAL if failed. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ fread\+\_\+retry} (void $\ast$pointer, int32 size, int32 num\+\_\+items, FILE $\ast$stream)
\begin{DoxyCompactList}\small\item\em NFS file reads seem to fail now and then. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT char $\ast$ \textbf{ fread\+\_\+line} (FILE $\ast$stream, size\+\_\+t $\ast$out\+\_\+len)
\begin{DoxyCompactList}\small\item\em Read a line of arbitrary length from a file and return it as a newly allocated string. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ lineiter\+\_\+t} $\ast$ \textbf{ lineiter\+\_\+start} (FILE $\ast$fh)
\begin{DoxyCompactList}\small\item\em Start reading lines from a file. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ lineiter\+\_\+t} $\ast$ \textbf{ lineiter\+\_\+start\+\_\+clean} (FILE $\ast$fh)
\begin{DoxyCompactList}\small\item\em Start reading lines from a file, skip comments and trim lines. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ lineiter\+\_\+t} $\ast$ \textbf{ lineiter\+\_\+next} (\textbf{ lineiter\+\_\+t} $\ast$li)
\begin{DoxyCompactList}\small\item\em Move to the next line in the file. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ lineiter\+\_\+free} (\textbf{ lineiter\+\_\+t} $\ast$li)
\begin{DoxyCompactList}\small\item\em Stop reading lines from a file. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ lineiter\+\_\+lineno} (\textbf{ lineiter\+\_\+t} $\ast$li)
\begin{DoxyCompactList}\small\item\em Returns current line number. \end{DoxyCompactList}\item 
\textbf{ bit\+\_\+encode\+\_\+t} $\ast$ \textbf{ bit\+\_\+encode\+\_\+attach} (FILE $\ast$outfh)
\begin{DoxyCompactList}\small\item\em Attach bitstream encoder to a file. \end{DoxyCompactList}\item 
\textbf{ bit\+\_\+encode\+\_\+t} $\ast$ \textbf{ bit\+\_\+encode\+\_\+retain} (\textbf{ bit\+\_\+encode\+\_\+t} $\ast$be)
\begin{DoxyCompactList}\small\item\em Retain pointer to a bit encoder. \end{DoxyCompactList}\item 
int \textbf{ bit\+\_\+encode\+\_\+free} (\textbf{ bit\+\_\+encode\+\_\+t} $\ast$be)
\begin{DoxyCompactList}\small\item\em Release pointer to a bit encoder. \end{DoxyCompactList}\item 
int \textbf{ bit\+\_\+encode\+\_\+write} (\textbf{ bit\+\_\+encode\+\_\+t} $\ast$be, unsigned char const $\ast$bits, int nbits)
\begin{DoxyCompactList}\small\item\em Write bits to encoder. \end{DoxyCompactList}\item 
int \textbf{ bit\+\_\+encode\+\_\+write\+\_\+cw} (\textbf{ bit\+\_\+encode\+\_\+t} $\ast$be, uint32 codeword, int nbits)
\begin{DoxyCompactList}\small\item\em Write lowest-\/order bits of codeword to encoder. \end{DoxyCompactList}\item 
int \textbf{ bit\+\_\+encode\+\_\+flush} (\textbf{ bit\+\_\+encode\+\_\+t} $\ast$be)
\begin{DoxyCompactList}\small\item\em Flush any unwritten bits, zero-\/padding if necessary. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ stat\+\_\+retry} (const char $\ast$file, struct stat $\ast$statbuf)
\begin{DoxyCompactList}\small\item\em There is no bitstream decoder, because a stream abstraction is too slow. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int32 \textbf{ stat\+\_\+mtime} (const char $\ast$file)
\begin{DoxyCompactList}\small\item\em Return time of last modification for the given file, or -\/1 if stat fails. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ build\+\_\+directory} (const char $\ast$path)
\begin{DoxyCompactList}\small\item\em Create a directory and all of its parent directories, as needed. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
file IO related operations. 

~\newline


Custom fopen with error checking is implemented. fopen\+\_\+comp can open a file with .z, .Z, .gz or .GZ extension

WARNING\+: Usage of stat\+\_\+retry will results in 100s of waiting time if the file doesn\textquotesingle{}t exist. ~\newline
 

Definition in file \textbf{ pio.\+h}.



\doxysubsection{Macro Definition Documentation}
\label{pio_8h_a96b37e449c7f8698fcfafac1c46cebb2} 
\index{pio.h@{pio.h}!myfopen@{myfopen}}
\index{myfopen@{myfopen}!pio.h@{pio.h}}
\doxysubsubsection{myfopen}
{\footnotesize\ttfamily \#define myfopen(\begin{DoxyParamCaption}\item[{}]{file,  }\item[{}]{mode }\end{DoxyParamCaption})~\textbf{ \+\_\+myfopen}((file),(mode),\+\_\+\+\_\+\+FILE\+\_\+\+\_\+,\+\_\+\+\_\+\+LINE\+\_\+\+\_\+)}



Definition at line \textbf{ 148} of file \textbf{ pio.\+h}.



\doxysubsection{Typedef Documentation}
\label{pio_8h_ae72c3bec19638da72dad3849f75c0cd9} 
\index{pio.h@{pio.h}!bit\_encode\_t@{bit\_encode\_t}}
\index{bit\_encode\_t@{bit\_encode\_t}!pio.h@{pio.h}}
\doxysubsubsection{bit\_encode\_t}
{\footnotesize\ttfamily typedef struct \textbf{ bit\+\_\+encode\+\_\+s} \textbf{ bit\+\_\+encode\+\_\+t}}



Bitstream encoder -\/ for writing compressed files. 



Definition at line \textbf{ 237} of file \textbf{ pio.\+h}.



\doxysubsection{Function Documentation}
\label{pio_8h_abeb3a47b2da25cfa845468dc92d28571} 
\index{pio.h@{pio.h}!bit\_encode\_attach@{bit\_encode\_attach}}
\index{bit\_encode\_attach@{bit\_encode\_attach}!pio.h@{pio.h}}
\doxysubsubsection{bit\_encode\_attach()}
{\footnotesize\ttfamily \textbf{ bit\+\_\+encode\+\_\+t} $\ast$ bit\+\_\+encode\+\_\+attach (\begin{DoxyParamCaption}\item[{FILE $\ast$}]{outfh }\end{DoxyParamCaption})}



Attach bitstream encoder to a file. 



Definition at line \textbf{ 538} of file \textbf{ pio.\+c}.



References \textbf{ bit\+\_\+encode\+\_\+attach()}, and \textbf{ ckd\+\_\+calloc}.



Referenced by \textbf{ bit\+\_\+encode\+\_\+attach()}, and \textbf{ huff\+\_\+code\+\_\+attach()}.

\label{pio_8h_a3e818645e567961225977a1923debc3d} 
\index{pio.h@{pio.h}!bit\_encode\_flush@{bit\_encode\_flush}}
\index{bit\_encode\_flush@{bit\_encode\_flush}!pio.h@{pio.h}}
\doxysubsubsection{bit\_encode\_flush()}
{\footnotesize\ttfamily int bit\+\_\+encode\+\_\+flush (\begin{DoxyParamCaption}\item[{\textbf{ bit\+\_\+encode\+\_\+t} $\ast$}]{be }\end{DoxyParamCaption})}



Flush any unwritten bits, zero-\/padding if necessary. 



Definition at line \textbf{ 607} of file \textbf{ pio.\+c}.



References \textbf{ bit\+\_\+encode\+\_\+flush()}.



Referenced by \textbf{ bit\+\_\+encode\+\_\+flush()}, and \textbf{ huff\+\_\+code\+\_\+detach()}.

\label{pio_8h_a8330637520174419771670ed740c9049} 
\index{pio.h@{pio.h}!bit\_encode\_free@{bit\_encode\_free}}
\index{bit\_encode\_free@{bit\_encode\_free}!pio.h@{pio.h}}
\doxysubsubsection{bit\_encode\_free()}
{\footnotesize\ttfamily int bit\+\_\+encode\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ bit\+\_\+encode\+\_\+t} $\ast$}]{be }\end{DoxyParamCaption})}



Release pointer to a bit encoder. 

Note that this does NOT flush any leftover bits. 

Definition at line \textbf{ 556} of file \textbf{ pio.\+c}.



References \textbf{ bit\+\_\+encode\+\_\+free()}, and \textbf{ ckd\+\_\+free()}.



Referenced by \textbf{ bit\+\_\+encode\+\_\+free()}, and \textbf{ huff\+\_\+code\+\_\+detach()}.

\label{pio_8h_aac6c16eac67d17b59f73a81a95fa5fd9} 
\index{pio.h@{pio.h}!bit\_encode\_retain@{bit\_encode\_retain}}
\index{bit\_encode\_retain@{bit\_encode\_retain}!pio.h@{pio.h}}
\doxysubsubsection{bit\_encode\_retain()}
{\footnotesize\ttfamily \textbf{ bit\+\_\+encode\+\_\+t} $\ast$ bit\+\_\+encode\+\_\+retain (\begin{DoxyParamCaption}\item[{\textbf{ bit\+\_\+encode\+\_\+t} $\ast$}]{be }\end{DoxyParamCaption})}



Retain pointer to a bit encoder. 



Definition at line \textbf{ 549} of file \textbf{ pio.\+c}.



References \textbf{ bit\+\_\+encode\+\_\+retain()}.



Referenced by \textbf{ bit\+\_\+encode\+\_\+retain()}.

\label{pio_8h_a59d83bd5850d9ec58175c566d6d48f71} 
\index{pio.h@{pio.h}!bit\_encode\_write@{bit\_encode\_write}}
\index{bit\_encode\_write@{bit\_encode\_write}!pio.h@{pio.h}}
\doxysubsubsection{bit\_encode\_write()}
{\footnotesize\ttfamily int bit\+\_\+encode\+\_\+write (\begin{DoxyParamCaption}\item[{\textbf{ bit\+\_\+encode\+\_\+t} $\ast$}]{be,  }\item[{unsigned char const $\ast$}]{bits,  }\item[{int}]{nbits }\end{DoxyParamCaption})}



Write bits to encoder. 



Definition at line \textbf{ 568} of file \textbf{ pio.\+c}.



References \textbf{ bit\+\_\+encode\+\_\+write()}.



Referenced by \textbf{ bit\+\_\+encode\+\_\+write()}, and \textbf{ bit\+\_\+encode\+\_\+write\+\_\+cw()}.

\label{pio_8h_ae71dedb663c8e3ae8b91dbfbc95ac420} 
\index{pio.h@{pio.h}!bit\_encode\_write\_cw@{bit\_encode\_write\_cw}}
\index{bit\_encode\_write\_cw@{bit\_encode\_write\_cw}!pio.h@{pio.h}}
\doxysubsubsection{bit\_encode\_write\_cw()}
{\footnotesize\ttfamily int bit\+\_\+encode\+\_\+write\+\_\+cw (\begin{DoxyParamCaption}\item[{\textbf{ bit\+\_\+encode\+\_\+t} $\ast$}]{be,  }\item[{uint32}]{codeword,  }\item[{int}]{nbits }\end{DoxyParamCaption})}



Write lowest-\/order bits of codeword to encoder. 



Definition at line \textbf{ 595} of file \textbf{ pio.\+c}.



References \textbf{ bit\+\_\+encode\+\_\+write()}, and \textbf{ bit\+\_\+encode\+\_\+write\+\_\+cw()}.



Referenced by \textbf{ bit\+\_\+encode\+\_\+write\+\_\+cw()}, \textbf{ huff\+\_\+code\+\_\+encode\+\_\+int()}, and \textbf{ huff\+\_\+code\+\_\+encode\+\_\+str()}.

\label{pio_8h_a6df697b8a08cd4d11fe7b864dcb99012} 
\index{pio.h@{pio.h}!build\_directory@{build\_directory}}
\index{build\_directory@{build\_directory}!pio.h@{pio.h}}
\doxysubsubsection{build\_directory()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int build\+\_\+directory (\begin{DoxyParamCaption}\item[{const char $\ast$}]{path }\end{DoxyParamCaption})}



Create a directory and all of its parent directories, as needed. 

\begin{DoxyReturn}{Returns}
0 on success, $<$0 on failure. 
\end{DoxyReturn}


Definition at line \textbf{ 653} of file \textbf{ pio.\+c}.



References \textbf{ build\+\_\+directory()}, and \textbf{ E\+\_\+\+ERROR}.



Referenced by \textbf{ build\+\_\+directory()}.

\label{pio_8h_a87592c3a2d0a00eed9eda014950beb65} 
\index{pio.h@{pio.h}!fclose\_comp@{fclose\_comp}}
\index{fclose\_comp@{fclose\_comp}!pio.h@{pio.h}}
\doxysubsubsection{fclose\_comp()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void fclose\+\_\+comp (\begin{DoxyParamCaption}\item[{FILE $\ast$}]{fp,  }\item[{int32}]{ispipe }\end{DoxyParamCaption})}



Close a file opened using fopen\+\_\+comp. 


\begin{DoxyParams}{Parameters}
{\em fp} & In\+: File pointer to be closed  \\
\hline
{\em ispipe} & In\+: ispipe argument that was returned by the corresponding \doxyref{fopen\+\_\+comp()}{p.}{pio_8h_ad25ae7bb924058c2304f90cb405df0e7} call \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 175} of file \textbf{ pio.\+c}.



References \textbf{ fclose\+\_\+comp()}.



Referenced by \textbf{ fclose\+\_\+comp()}.

\label{pio_8h_ad25ae7bb924058c2304f90cb405df0e7} 
\index{pio.h@{pio.h}!fopen\_comp@{fopen\_comp}}
\index{fopen\_comp@{fopen\_comp}!pio.h@{pio.h}}
\doxysubsubsection{fopen\_comp()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT FILE $\ast$ fopen\+\_\+comp (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file,  }\item[{const char $\ast$}]{mode,  }\item[{int32 $\ast$}]{ispipe }\end{DoxyParamCaption})}



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). 


\begin{DoxyParams}{Parameters}
{\em file} & In\+: File to be opened  \\
\hline
{\em mode} & In\+: "{}r"{} or "{}w"{}, as with normal fopen  \\
\hline
{\em ispipe} & Out\+: On return $\ast$ispipe is TRUE iff file was opened via a pipe \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 98} of file \textbf{ pio.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ E\+\_\+\+ERROR}, \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}, \textbf{ E\+\_\+\+FATAL}, \textbf{ fopen\+\_\+comp()}, and \textbf{ string\+\_\+join()}.



Referenced by \textbf{ fopen\+\_\+comp()}, and \textbf{ fopen\+\_\+compchk()}.

\label{pio_8h_a9166e6b4fa8d0f782ef116612afc4eee} 
\index{pio.h@{pio.h}!fopen\_compchk@{fopen\_compchk}}
\index{fopen\_compchk@{fopen\_compchk}!pio.h@{pio.h}}
\doxysubsubsection{fopen\_compchk()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT FILE $\ast$ fopen\+\_\+compchk (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file,  }\item[{int32 $\ast$}]{ispipe }\end{DoxyParamCaption})}



Open a file for reading, but if file not present try to open compressed version (if file is uncompressed, and vice versa). 


\begin{DoxyParams}{Parameters}
{\em file} & In\+: File to be opened  \\
\hline
{\em ispipe} & Out\+: On return $\ast$ispipe is TRUE iff file was opened via a pipe \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 192} of file \textbf{ pio.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+free()}, \textbf{ E\+\_\+\+WARN}, \textbf{ fopen\+\_\+comp()}, and \textbf{ fopen\+\_\+compchk()}.



Referenced by \textbf{ fopen\+\_\+compchk()}.

\label{pio_8h_ae7bb1c63d00d5e19fd0f6af917e17cca} 
\index{pio.h@{pio.h}!fread\_line@{fread\_line}}
\index{fread\_line@{fread\_line}!pio.h@{pio.h}}
\doxysubsubsection{fread\_line()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT char $\ast$ fread\+\_\+line (\begin{DoxyParamCaption}\item[{FILE $\ast$}]{stream,  }\item[{size\+\_\+t $\ast$}]{out\+\_\+len }\end{DoxyParamCaption})}



Read a line of arbitrary length from a file and return it as a newly allocated string. 

\begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]Use line iterators instead.\end{DoxyRefDesc}



\begin{DoxyParams}{Parameters}
{\em stream} & The file handle to read from. \\
\hline
{\em out\+\_\+len} & Output\+: if not NULL, length of the string read. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
allocated string containing the line, or NULL on error or EOF. 
\end{DoxyReturn}


Definition at line \textbf{ 367} of file \textbf{ pio.\+c}.



References \textbf{ ckd\+\_\+malloc}, \textbf{ ckd\+\_\+realloc}, and \textbf{ fread\+\_\+line()}.



Referenced by \textbf{ fread\+\_\+line()}, and \textbf{ huff\+\_\+code\+\_\+read()}.

\label{pio_8h_a601277430d3221bf1906bb879ae26d3e} 
\index{pio.h@{pio.h}!fread\_retry@{fread\_retry}}
\index{fread\_retry@{fread\_retry}!pio.h@{pio.h}}
\doxysubsubsection{fread\_retry()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 fread\+\_\+retry (\begin{DoxyParamCaption}\item[{void $\ast$}]{pointer,  }\item[{int32}]{size,  }\item[{int32}]{num\+\_\+items,  }\item[{FILE $\ast$}]{stream }\end{DoxyParamCaption})}



NFS file reads seem to fail now and then. 

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. 

Definition at line \textbf{ 398} of file \textbf{ pio.\+c}.



References \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}, and \textbf{ fread\+\_\+retry()}.



Referenced by \textbf{ fread\+\_\+retry()}.

\label{pio_8h_a3f80e5d4d666426cef229dd41237d9cf} 
\index{pio.h@{pio.h}!lineiter\_free@{lineiter\_free}}
\index{lineiter\_free@{lineiter\_free}!pio.h@{pio.h}}
\doxysubsubsection{lineiter\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void lineiter\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ lineiter\+\_\+t} $\ast$}]{li }\end{DoxyParamCaption})}



Stop reading lines from a file. 



Definition at line \textbf{ 358} of file \textbf{ pio.\+c}.



References \textbf{ ckd\+\_\+free()}, and \textbf{ lineiter\+\_\+free()}.



Referenced by \textbf{ lineiter\+\_\+free()}.

\label{pio_8h_a7d612f02b2077ffb11cc37c3522b10d7} 
\index{pio.h@{pio.h}!lineiter\_lineno@{lineiter\_lineno}}
\index{lineiter\_lineno@{lineiter\_lineno}!pio.h@{pio.h}}
\doxysubsubsection{lineiter\_lineno()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int lineiter\+\_\+lineno (\begin{DoxyParamCaption}\item[{\textbf{ lineiter\+\_\+t} $\ast$}]{li }\end{DoxyParamCaption})}



Returns current line number. 



Definition at line \textbf{ 352} of file \textbf{ pio.\+c}.



References \textbf{ lineiter\+\_\+lineno()}.



Referenced by \textbf{ lineiter\+\_\+lineno()}.

\label{pio_8h_af7f21ab720cfe0cf51b31701f70adf1f} 
\index{pio.h@{pio.h}!lineiter\_next@{lineiter\_next}}
\index{lineiter\_next@{lineiter\_next}!pio.h@{pio.h}}
\doxysubsubsection{lineiter\_next()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ lineiter\+\_\+t} $\ast$ lineiter\+\_\+next (\begin{DoxyParamCaption}\item[{\textbf{ lineiter\+\_\+t} $\ast$}]{li }\end{DoxyParamCaption})}



Move to the next line in the file. 



Definition at line \textbf{ 338} of file \textbf{ pio.\+c}.



References \textbf{ lineiter\+\_\+next()}, \textbf{ STRING\+\_\+\+BOTH}, and \textbf{ string\+\_\+trim()}.



Referenced by \textbf{ lineiter\+\_\+next()}, \textbf{ lineiter\+\_\+start()}, and \textbf{ lineiter\+\_\+start\+\_\+clean()}.

\label{pio_8h_ad9e6b6dfd54616ce62ca2060a1453854} 
\index{pio.h@{pio.h}!lineiter\_start@{lineiter\_start}}
\index{lineiter\_start@{lineiter\_start}!pio.h@{pio.h}}
\doxysubsubsection{lineiter\_start()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ lineiter\+\_\+t} $\ast$ lineiter\+\_\+start (\begin{DoxyParamCaption}\item[{FILE $\ast$}]{fh }\end{DoxyParamCaption})}



Start reading lines from a file. 



Definition at line \textbf{ 255} of file \textbf{ pio.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+malloc}, \textbf{ lineiter\+\_\+next()}, and \textbf{ lineiter\+\_\+start()}.



Referenced by \textbf{ lineiter\+\_\+start()}, and \textbf{ lineiter\+\_\+start\+\_\+clean()}.

\label{pio_8h_a9728ad1d5cdd7b0bb1806f7ebf78ea1e} 
\index{pio.h@{pio.h}!lineiter\_start\_clean@{lineiter\_start\_clean}}
\index{lineiter\_start\_clean@{lineiter\_start\_clean}!pio.h@{pio.h}}
\doxysubsubsection{lineiter\_start\_clean()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ lineiter\+\_\+t} $\ast$ lineiter\+\_\+start\+\_\+clean (\begin{DoxyParamCaption}\item[{FILE $\ast$}]{fh }\end{DoxyParamCaption})}



Start reading lines from a file, skip comments and trim lines. 



Definition at line \textbf{ 279} of file \textbf{ pio.\+c}.



References \textbf{ lineiter\+\_\+next()}, \textbf{ lineiter\+\_\+start()}, \textbf{ lineiter\+\_\+start\+\_\+clean()}, \textbf{ STRING\+\_\+\+BOTH}, and \textbf{ string\+\_\+trim()}.



Referenced by \textbf{ lineiter\+\_\+start\+\_\+clean()}.

\label{pio_8h_a289e3a1582ab60563ae0689979992669} 
\index{pio.h@{pio.h}!stat\_mtime@{stat\_mtime}}
\index{stat\_mtime@{stat\_mtime}!pio.h@{pio.h}}
\doxysubsubsection{stat\_mtime()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 stat\+\_\+mtime (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file }\end{DoxyParamCaption})}



Return time of last modification for the given file, or -\/1 if stat fails. 



Definition at line \textbf{ 515} of file \textbf{ pio.\+c}.



References \textbf{ stat\+\_\+retry()}.

\label{pio_8h_a0ba35509687e80ee65ba731c7cfcad9b} 
\index{pio.h@{pio.h}!stat\_retry@{stat\_retry}}
\index{stat\_retry@{stat\_retry}!pio.h@{pio.h}}
\doxysubsubsection{stat\_retry()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int32 stat\+\_\+retry (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file,  }\item[{struct stat $\ast$}]{statbuf }\end{DoxyParamCaption})}



There is no bitstream decoder, because a stream abstraction is too slow. 

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. 

Definition at line \textbf{ 480} of file \textbf{ pio.\+c}.



References \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}.



Referenced by \textbf{ stat\+\_\+mtime()}.

