\doxysection{pio.\+h}
\label{pio_8h_source}\index{include/sphinxbase/pio.h@{include/sphinxbase/pio.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*\ -\/*-\/\ c-\/basic-\/offset:\ 4;\ indent-\/tabs-\/mode:\ nil\ -\/*-\/\ */}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*\ ====================================================================}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1999-\/2004\ Carnegie\ Mellon\ University.\ \ All\ rights}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ are\ met:}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ 1.\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.\ }}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ 2.\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ \ \ the\ documentation\ and/or\ other\ materials\ provided\ with\ the}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ \ \ distribution.}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ This\ work\ was\ supported\ in\ part\ by\ funding\ from\ the\ Defense\ Advanced\ }}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ Research\ Projects\ Agency\ and\ the\ National\ Science\ Foundation\ of\ the\ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ United\ States\ of\ America,\ and\ the\ CMU\ Sphinx\ Speech\ Consortium.}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ CARNEGIE\ MELLON\ UNIVERSITY\ \`{}\`{}AS\ IS''\ AND\ }}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *\ ANY\ EXPRESSED\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ }}
\DoxyCodeLine{00024\ \textcolor{comment}{\ *\ THE\ IMPLIED\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ A\ PARTICULAR}}
\DoxyCodeLine{00025\ \textcolor{comment}{\ *\ PURPOSE\ ARE\ DISCLAIMED.\ \ IN\ NO\ EVENT\ SHALL\ CARNEGIE\ MELLON\ UNIVERSITY}}
\DoxyCodeLine{00026\ \textcolor{comment}{\ *\ NOR\ ITS\ EMPLOYEES\ BE\ LIABLE\ FOR\ ANY\ DIRECT,\ INDIRECT,\ INCIDENTAL,}}
\DoxyCodeLine{00027\ \textcolor{comment}{\ *\ SPECIAL,\ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES\ (INCLUDING,\ BUT\ NOT\ }}
\DoxyCodeLine{00028\ \textcolor{comment}{\ *\ LIMITED\ TO,\ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;\ LOSS\ OF\ USE,\ }}
\DoxyCodeLine{00029\ \textcolor{comment}{\ *\ DATA,\ OR\ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND\ ON\ ANY\ }}
\DoxyCodeLine{00030\ \textcolor{comment}{\ *\ THEORY\ OF\ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT\ }}
\DoxyCodeLine{00031\ \textcolor{comment}{\ *\ (INCLUDING\ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ }}
\DoxyCodeLine{00032\ \textcolor{comment}{\ *\ OF\ THIS\ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00033\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00034\ \textcolor{comment}{\ *\ ====================================================================}}
\DoxyCodeLine{00035\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00036\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00037\ \textcolor{comment}{/*}}
\DoxyCodeLine{00038\ \textcolor{comment}{\ *\ pio.h\ -\/-\/\ Packaged\ I/O\ routines.}}
\DoxyCodeLine{00039\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00040\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00041\ \textcolor{comment}{\ *\ CMU\ ARPA\ Speech\ Project}}
\DoxyCodeLine{00042\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00043\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1999\ Carnegie\ Mellon\ University.}}
\DoxyCodeLine{00044\ \textcolor{comment}{\ *\ ALL\ RIGHTS\ RESERVED.}}
\DoxyCodeLine{00045\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00046\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00047\ \textcolor{comment}{\ *\ HISTORY}}
\DoxyCodeLine{00048\ \textcolor{comment}{\ *\ \$Log:\ pio.h,v\ \$}}
\DoxyCodeLine{00049\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2005/06/22\ 08:00:09\ \ arthchan2003}}
\DoxyCodeLine{00050\ \textcolor{comment}{\ *\ Completed\ all\ doxygen\ documentation\ on\ file\ description\ for\ libs3decoder/libutil/libs3audio\ and\ programs.}}
\DoxyCodeLine{00051\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00052\ \textcolor{comment}{\ *\ Revision\ 1.2\ \ 2005/06/22\ 03:09:52\ \ arthchan2003}}
\DoxyCodeLine{00053\ \textcolor{comment}{\ *\ 1,\ Fixed\ doxygen\ documentation,\ 2,\ Added\ \ keyword.}}
\DoxyCodeLine{00054\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00055\ \textcolor{comment}{\ *\ Revision\ 1.2\ \ 2005/06/16\ 00:14:08\ \ archan}}
\DoxyCodeLine{00056\ \textcolor{comment}{\ *\ Added\ const\ keyword\ to\ file\ argument\ for\ file\_open}}
\DoxyCodeLine{00057\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00058\ \textcolor{comment}{\ *\ Revision\ 1.1\ \ 2005/06/15\ 06:11:03\ \ archan}}
\DoxyCodeLine{00059\ \textcolor{comment}{\ *\ sphinx3\ to\ s3.generic:\ change\ io.[ch]\ to\ pio.[ch]}}
\DoxyCodeLine{00060\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00061\ \textcolor{comment}{\ *\ Revision\ 1.5\ \ 2005/06/15\ 04:21:46\ \ archan}}
\DoxyCodeLine{00062\ \textcolor{comment}{\ *\ 1,\ Fixed\ doxygen-\/documentation,\ 2,\ Add\ \ keyword\ such\ that\ changes\ will\ be\ logged\ into\ a\ file.}}
\DoxyCodeLine{00063\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00064\ \textcolor{comment}{\ *\ Revision\ 1.4\ \ 2005/04/20\ 03:49:32\ \ archan}}
\DoxyCodeLine{00065\ \textcolor{comment}{\ *\ Add\ const\ to\ string\ argument\ of\ myfopen.}}
\DoxyCodeLine{00066\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00067\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2005/03/30\ 01:22:48\ \ archan}}
\DoxyCodeLine{00068\ \textcolor{comment}{\ *\ Fixed\ mistakes\ in\ last\ updates.\ Add}}
\DoxyCodeLine{00069\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00070\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00071\ \textcolor{comment}{\ *\ 08-\/Dec-\/1999\ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00072\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ stat\_mtime().}}
\DoxyCodeLine{00073\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00074\ \textcolor{comment}{\ *\ 11-\/Mar-\/1999\ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00075\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Added\ \_myfopen()\ and\ myfopen\ macro.}}
\DoxyCodeLine{00076\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00077\ \textcolor{comment}{\ *\ 05-\/Sep-\/97\ \ \ \ M\ K\ Ravishankar\ (rkm@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00078\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Started.}}
\DoxyCodeLine{00079\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \textcolor{preprocessor}{\#ifndef\ \_LIBUTIL\_IO\_H\_}}
\DoxyCodeLine{00083\ \textcolor{preprocessor}{\#define\ \_LIBUTIL\_IO\_H\_}}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{00086\ \textcolor{preprocessor}{\#if\ !defined(\_WIN32\_WCE)\ \&\&\ !(defined(\_\_ADSPBLACKFIN\_\_)\ \&\&\ !defined(\_\_linux\_\_))}}
\DoxyCodeLine{00087\ \textcolor{preprocessor}{\#include\ <sys/stat.h>}}
\DoxyCodeLine{00088\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00090\ \textcolor{comment}{/*\ Win32/WinCE\ DLL\ gunk\ */}}
\DoxyCodeLine{00091\ \textcolor{preprocessor}{\#include\ <sphinxbase/sphinxbase\_export.h>}}
\DoxyCodeLine{00092\ \textcolor{preprocessor}{\#include\ <sphinxbase/prim\_type.h>}}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00104\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00105\ \textcolor{keyword}{extern}\ \textcolor{stringliteral}{"{}C"{}}\ \{}
\DoxyCodeLine{00106\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00107\ \textcolor{preprocessor}{\#if\ 0}}
\DoxyCodeLine{00108\ \textcolor{comment}{/*\ Fool\ Emacs.\ */}}
\DoxyCodeLine{00109\ \}}
\DoxyCodeLine{00110\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00116\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00117\ FILE\ *fopen\_comp\ (\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file,\ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *mode,\ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ *ispipe\ }
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00122\ }
\DoxyCodeLine{00126\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00127\ \textcolor{keywordtype}{void}\ fclose\_comp\ (FILE\ *fp,\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ ispipe\ \ }
\DoxyCodeLine{00130\ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00136\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00137\ FILE\ *fopen\_compchk\ (\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file,\ \ \ \ \ }
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ int32\ *ispipe\ \ \ \ \ \ }
\DoxyCodeLine{00140\ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00141\ }
\DoxyCodeLine{00145\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00146\ FILE\ *\_myfopen(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *mode,}
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *pgm,\ int32\ line);\ \ \ \ \textcolor{comment}{/*\ In:\ \_\_FILE\_\_,\ \_\_LINE\_\_\ from\ where\ called\ */}}
\DoxyCodeLine{00148\ \textcolor{preprocessor}{\#define\ myfopen(file,mode)\ \ \ \ \ \ \_myfopen((file),(mode),\_\_FILE\_\_,\_\_LINE\_\_)}}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00158\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00159\ int32\ fread\_retry(\textcolor{keywordtype}{void}\ *pointer,\ int32\ size,\ int32\ num\_items,\ FILE\ *stream);}
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00171\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00172\ \textcolor{keywordtype}{char}\ *fread\_line(FILE\ *stream,\ \textcolor{keywordtype}{size\_t}\ *out\_len);}
\DoxyCodeLine{00173\ }
\DoxyCodeLine{00177\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }lineiter\_t\ \{}
\DoxyCodeLine{00178\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}\ *buf;}
\DoxyCodeLine{00179\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{size\_t}\ bsiz;}
\DoxyCodeLine{00180\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{size\_t}\ len;}
\DoxyCodeLine{00181\ \ \ \ \ \ \ \ \ FILE\ *fh;}
\DoxyCodeLine{00182\ \ \ \ \ \ \ \ \ int32\ clean;}
\DoxyCodeLine{00183\ \ \ \ \ \ \ \ \ int32\ lineno;}
\DoxyCodeLine{00184\ \}\ lineiter\_t;}
\DoxyCodeLine{00185\ }
\DoxyCodeLine{00189\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00190\ lineiter\_t\ *lineiter\_start(FILE\ *fh);}
\DoxyCodeLine{00191\ }
\DoxyCodeLine{00195\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00196\ lineiter\_t\ *lineiter\_start\_clean(FILE\ *fh);}
\DoxyCodeLine{00197\ }
\DoxyCodeLine{00201\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00202\ lineiter\_t\ *lineiter\_next(lineiter\_t\ *li);}
\DoxyCodeLine{00203\ }
\DoxyCodeLine{00207\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00208\ \textcolor{keywordtype}{void}\ lineiter\_free(lineiter\_t\ *li);}
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00213\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00214\ \textcolor{keywordtype}{int}\ lineiter\_lineno(lineiter\_t\ *li);}
\DoxyCodeLine{00215\ }
\DoxyCodeLine{00216\ }
\DoxyCodeLine{00217\ \textcolor{preprocessor}{\#ifdef\ \_WIN32\_WCE}}
\DoxyCodeLine{00218\ \textcolor{comment}{/*\ Fake\ this\ for\ WinCE\ which\ has\ no\ stat()\ */}}
\DoxyCodeLine{00219\ \textcolor{preprocessor}{\#include\ <windows.h>}}
\DoxyCodeLine{00220\ \textcolor{keyword}{struct\ }stat\ \{}
\DoxyCodeLine{00221\ \ \ \ \ DWORD\ st\_mtime;}
\DoxyCodeLine{00222\ \ \ \ \ DWORD\ st\_size;}
\DoxyCodeLine{00223\ \};}
\DoxyCodeLine{00224\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{/*\ \_WIN32\_WCE\ */}\textcolor{preprocessor}{}}
\DoxyCodeLine{00225\ }
\DoxyCodeLine{00226\ \textcolor{preprocessor}{\#if\ defined(\_\_ADSPBLACKFIN\_\_)\ \&\&\ !defined(\_\_linux\_\_)}}
\DoxyCodeLine{00227\ \textcolor{keyword}{struct\ }stat\ \{}
\DoxyCodeLine{00228\ \ \ \ \ int32\ st\_mtime;}
\DoxyCodeLine{00229\ \ \ \ \ int32\ st\_size;}
\DoxyCodeLine{00230\ \};}
\DoxyCodeLine{00231\ }
\DoxyCodeLine{00232\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00233\ }
\DoxyCodeLine{00237\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }bit\_encode\_s\ bit\_encode\_t;}
\DoxyCodeLine{00238\ }
\DoxyCodeLine{00242\ bit\_encode\_t\ *bit\_encode\_attach(FILE\ *outfh);}
\DoxyCodeLine{00243\ }
\DoxyCodeLine{00247\ bit\_encode\_t\ *bit\_encode\_retain(bit\_encode\_t\ *be);}
\DoxyCodeLine{00248\ }
\DoxyCodeLine{00254\ \textcolor{keywordtype}{int}\ bit\_encode\_free(bit\_encode\_t\ *be);}
\DoxyCodeLine{00255\ }
\DoxyCodeLine{00259\ \textcolor{keywordtype}{int}\ bit\_encode\_write(bit\_encode\_t\ *be,\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *bits,\ \textcolor{keywordtype}{int}\ nbits);}
\DoxyCodeLine{00260\ }
\DoxyCodeLine{00264\ \textcolor{keywordtype}{int}\ bit\_encode\_write\_cw(bit\_encode\_t\ *be,\ uint32\ codeword,\ \textcolor{keywordtype}{int}\ nbits);}
\DoxyCodeLine{00265\ }
\DoxyCodeLine{00269\ \textcolor{keywordtype}{int}\ bit\_encode\_flush(bit\_encode\_t\ *be);}
\DoxyCodeLine{00270\ }
\DoxyCodeLine{00280\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00281\ int32\ stat\_retry\ (\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file,\ \textcolor{keyword}{struct}\ stat\ *statbuf);}
\DoxyCodeLine{00282\ }
\DoxyCodeLine{00287\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00288\ int32\ stat\_mtime\ (\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *file);}
\DoxyCodeLine{00289\ }
\DoxyCodeLine{00295\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00296\ \textcolor{keywordtype}{int}\ build\_directory(\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *path);}
\DoxyCodeLine{00297\ }
\DoxyCodeLine{00298\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00299\ \}}
\DoxyCodeLine{00300\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00301\ }
\DoxyCodeLine{00302\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
