\doxysection{err.\+c}
\label{err_8c_source}\index{src/libsphinxbase/util/err.c@{src/libsphinxbase/util/err.c}}
\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{00042\ \textcolor{preprocessor}{\#include\ "{}config.h"{}}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{00045\ \textcolor{preprocessor}{\#include\ <stdlib.h>}}
\DoxyCodeLine{00046\ \textcolor{preprocessor}{\#include\ <stdarg.h>}}
\DoxyCodeLine{00047\ \textcolor{preprocessor}{\#include\ <string.h>}}
\DoxyCodeLine{00048\ \textcolor{preprocessor}{\#include\ <errno.h>}}
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00050\ \textcolor{preprocessor}{\#include\ "{}sphinxbase/err.h"{}}}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00052\ \textcolor{preprocessor}{\#ifdef\ SPHINX\_DEBUG}}
\DoxyCodeLine{00053\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{int}\ sphinx\_debug\_level;}
\DoxyCodeLine{00054\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{00055\ err\_set\_debug\_level(\textcolor{keywordtype}{int}\ level)}
\DoxyCodeLine{00056\ \{}
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keywordtype}{int}\ prev\ =\ sphinx\_debug\_level;}
\DoxyCodeLine{00058\ \ \ \ \ sphinx\_debug\_level\ =\ level;}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordflow}{return}\ prev;}
\DoxyCodeLine{00060\ \}}
\DoxyCodeLine{00061\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{00062\ err\_get\_debug\_level(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00063\ \{}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordflow}{return}\ sphinx\_debug\_level;}
\DoxyCodeLine{00065\ \}}
\DoxyCodeLine{00066\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00067\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{00068\ err\_set\_debug\_level(\textcolor{keywordtype}{int}\ level)}
\DoxyCodeLine{00069\ \{}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00071\ \}}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{00074\ err\_get\_debug\_level(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00075\ \{}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00077\ \}}
\DoxyCodeLine{00078\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \textcolor{preprocessor}{\#if\ defined(HAVE\_PTHREAD\_H)}}
\DoxyCodeLine{00081\ \textcolor{preprocessor}{\#include\ <pthread.h>}}
\DoxyCodeLine{00082\ \textcolor{keyword}{static}\ pthread\_key\_t\ logfp\_index;}
\DoxyCodeLine{00083\ \textcolor{keyword}{static}\ pthread\_once\_t\ logfp\_index\_once\ =\ PTHREAD\_ONCE\_INIT;}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00086\ logfp\_index\_alloc(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00087\ \{}
\DoxyCodeLine{00088\ \ \ \ \ pthread\_key\_create(\&logfp\_index,\ NULL);}
\DoxyCodeLine{00089\ \}}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ FILE\ *}
\DoxyCodeLine{00092\ err\_get\_logfp(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00093\ \{}
\DoxyCodeLine{00094\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00096\ \ \ \ \ pthread\_once(\&logfp\_index\_once,\ logfp\_index\_alloc);}
\DoxyCodeLine{00097\ \ \ \ \ logfp\ =\ (FILE\ *)pthread\_getspecific(logfp\_index);}
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00099\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ stderr;}
\DoxyCodeLine{00101\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (logfp\ ==\ (FILE*)\ -\/1)}
\DoxyCodeLine{00102\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ logfp;}
\DoxyCodeLine{00105\ \}}
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00107\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00108\ internal\_set\_logfp(FILE\ *fh)}
\DoxyCodeLine{00109\ \{}
\DoxyCodeLine{00110\ \ \ \ \ \textcolor{keywordflow}{if}\ (fh\ ==\ NULL)}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ fh\ =\ (FILE*)\ -\/1;}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00113\ \ \ \ \ pthread\_setspecific(logfp\_index,\ (\textcolor{keywordtype}{void}\ *)fh);}
\DoxyCodeLine{00114\ \}}
\DoxyCodeLine{00115\ }
\DoxyCodeLine{00116\ \textcolor{preprocessor}{\#elif\ defined(\_WIN32)\ ||\ defined(\_\_CYGWIN\_\_)\ }\textcolor{comment}{/*\ Use\ Windows\ TLS\ on\ Cygwin\ */}\textcolor{preprocessor}{}}
\DoxyCodeLine{00117\ \textcolor{preprocessor}{\#include\ <windows.h>}}
\DoxyCodeLine{00118\ \textcolor{keyword}{static}\ DWORD\ logfp\_index;\ }
\DoxyCodeLine{00119\ \textcolor{keyword}{static}\ LONG\ logfp\_index\_once\ =\ 0;\ }
\DoxyCodeLine{00121\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00122\ logfp\_index\_alloc(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00123\ \{}
\DoxyCodeLine{00124\ \ \ \ \ logfp\_index\ =\ TlsAlloc();}
\DoxyCodeLine{00125\ \}}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00127\ FILE\ *}
\DoxyCodeLine{00128\ err\_get\_logfp(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00129\ \{}
\DoxyCodeLine{00130\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keywordflow}{if}\ (InterlockedExchange(\&logfp\_index\_once,\ 1)\ ==\ 0)}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ logfp\_index\_alloc();}
\DoxyCodeLine{00134\ \ \ \ \ logfp\ =\ (FILE\ *)TlsGetValue(logfp\_index);}
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ stderr;}
\DoxyCodeLine{00138\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (logfp\ ==\ (FILE*)\ -\/1)}
\DoxyCodeLine{00139\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00140\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00141\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ logfp;}
\DoxyCodeLine{00142\ \}}
\DoxyCodeLine{00143\ }
\DoxyCodeLine{00144\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00145\ internal\_set\_logfp(FILE\ *fh)}
\DoxyCodeLine{00146\ \{}
\DoxyCodeLine{00147\ \ \ \ \ \textcolor{keywordflow}{if}\ (fh\ ==\ NULL)}
\DoxyCodeLine{00148\ \ \ \ \ \ \ \ \ fh\ =\ (FILE*)\ -\/1;}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ \ \ \ \ TlsSetValue(logfp\_index,\ (\textcolor{keywordtype}{void}\ *)fh);}
\DoxyCodeLine{00151\ \}}
\DoxyCodeLine{00152\ }
\DoxyCodeLine{00153\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00154\ FILE\ *logfp\ =\ NULL;}
\DoxyCodeLine{00155\ }
\DoxyCodeLine{00156\ FILE\ *}
\DoxyCodeLine{00157\ err\_get\_logfp(\textcolor{keywordtype}{void})}
\DoxyCodeLine{00158\ \{}
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00160\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ stderr;}
\DoxyCodeLine{00161\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (logfp\ ==\ (FILE*)\ -\/1)}
\DoxyCodeLine{00162\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00163\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ logfp;}
\DoxyCodeLine{00165\ \}}
\DoxyCodeLine{00166\ }
\DoxyCodeLine{00167\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00168\ internal\_set\_logfp(FILE\ *fh)}
\DoxyCodeLine{00169\ \{}
\DoxyCodeLine{00170\ \ \ \ \ \textcolor{keywordflow}{if}\ (fh\ ==\ NULL)}
\DoxyCodeLine{00171\ \ \ \ \ \ \ \ \ fh\ =\ (FILE*)\ -\/1;}
\DoxyCodeLine{00172\ }
\DoxyCodeLine{00173\ \ \ \ \ logfp\ =\ fh;}
\DoxyCodeLine{00174\ \}}
\DoxyCodeLine{00175\ }
\DoxyCodeLine{00176\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00177\ \ }
\DoxyCodeLine{00178\ FILE\ *}
\DoxyCodeLine{00179\ err\_set\_logfp(FILE\ *newfp)}
\DoxyCodeLine{00180\ \{}
\DoxyCodeLine{00181\ \ \ \ \ FILE\ *oldfp;}
\DoxyCodeLine{00182\ }
\DoxyCodeLine{00183\ \ \ \ \ oldfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00184\ \ \ \ \ internal\_set\_logfp(newfp);}
\DoxyCodeLine{00185\ }
\DoxyCodeLine{00186\ \ \ \ \ \textcolor{keywordflow}{return}\ oldfp;}
\DoxyCodeLine{00187\ \}}
\DoxyCodeLine{00188\ }
\DoxyCodeLine{00189\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{00190\ err\_set\_logfile(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *file)}
\DoxyCodeLine{00191\ \{}
\DoxyCodeLine{00192\ \ \ \ \ FILE\ *newfp,\ *oldfp;}
\DoxyCodeLine{00193\ }
\DoxyCodeLine{00194\ \ \ \ \ \textcolor{keywordflow}{if}\ ((newfp\ =\ fopen(file,\ \textcolor{stringliteral}{"{}a"{}}))\ ==\ NULL)}
\DoxyCodeLine{00195\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{00196\ \ \ \ \ oldfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00197\ \ \ \ \ internal\_set\_logfp(newfp);}
\DoxyCodeLine{00198\ \ \ \ \ \textcolor{keywordflow}{if}\ (oldfp\ !=\ NULL\ \&\&\ oldfp\ !=\ stdout\ \&\&\ oldfp\ !=\ stderr)}
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ fclose(oldfp);}
\DoxyCodeLine{00200\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00201\ \}}
\DoxyCodeLine{00202\ }
\DoxyCodeLine{00203\ }
\DoxyCodeLine{00204\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00205\ \_E\_\_pr\_info\_header\_wofn(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *msg)}
\DoxyCodeLine{00206\ \{}
\DoxyCodeLine{00207\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00208\ }
\DoxyCodeLine{00209\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00210\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00211\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00212\ \ \ \ \ \textcolor{comment}{/*\ make\ different\ format\ so\ as\ not\ to\ be\ parsed\ by\ emacs\ compile\ */}}
\DoxyCodeLine{00213\ \ \ \ \ fprintf(logfp,\ \textcolor{stringliteral}{"{}\%s:\(\backslash\)t"{}},\ msg);}
\DoxyCodeLine{00214\ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00215\ \}}
\DoxyCodeLine{00216\ }
\DoxyCodeLine{00217\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00218\ \_E\_\_pr\_header(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *f,\ \textcolor{keywordtype}{long}\ ln,\ \textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *msg)}
\DoxyCodeLine{00219\ \{}
\DoxyCodeLine{00220\ \ \ \ \ \textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fname;}
\DoxyCodeLine{00221\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00222\ }
\DoxyCodeLine{00223\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00224\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00225\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00226\ \ \ \ \ fname\ =\ strrchr(f,\textcolor{charliteral}{'\(\backslash\)\(\backslash\)'});}
\DoxyCodeLine{00227\ \ \ \ \ \textcolor{keywordflow}{if}\ (fname\ ==\ NULL)}
\DoxyCodeLine{00228\ \ \ \ \ \ \ \ \ fname\ =\ strrchr(f,\textcolor{charliteral}{'/'});}
\DoxyCodeLine{00229\ \ \ \ \ fprintf(logfp,\ \textcolor{stringliteral}{"{}\%s:\ \(\backslash\)"{}\%s\(\backslash\)"{},\ line\ \%ld:\ "{}},\ msg,\ fname\ ==\ NULL\ ?\ f\ :\ fname\ +\ 1,\ ln);}
\DoxyCodeLine{00230\ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00231\ \}}
\DoxyCodeLine{00232\ }
\DoxyCodeLine{00233\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00234\ \_E\_\_pr\_info\_header(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *f,\ \textcolor{keywordtype}{long}\ ln,\ \textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *msg)}
\DoxyCodeLine{00235\ \{}
\DoxyCodeLine{00236\ \ \ \ \ \textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fname;}
\DoxyCodeLine{00237\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00238\ }
\DoxyCodeLine{00239\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00240\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00241\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00242\ \ \ \ \ fname\ =\ strrchr(f,\textcolor{charliteral}{'\(\backslash\)\(\backslash\)'});}
\DoxyCodeLine{00243\ \ \ \ \ \textcolor{keywordflow}{if}\ (fname\ ==\ NULL)}
\DoxyCodeLine{00244\ \ \ \ \ \ \ \ \ fname\ =\ strrchr(f,\textcolor{charliteral}{'/'});}
\DoxyCodeLine{00245\ \ \ \ \ \textcolor{comment}{/*\ make\ different\ format\ so\ as\ not\ to\ be\ parsed\ by\ emacs\ compile\ */}}
\DoxyCodeLine{00246\ \ \ \ \ fprintf(logfp,\ \textcolor{stringliteral}{"{}\%s:\ \%s(\%ld):\ "{}},\ msg,\ fname\ ==\ NULL\ ?\ f\ :\ fname\ +\ 1,\ ln);}
\DoxyCodeLine{00247\ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00248\ \}}
\DoxyCodeLine{00249\ }
\DoxyCodeLine{00250\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00251\ \_E\_\_pr\_warn(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fmt,\ ...)}
\DoxyCodeLine{00252\ \{}
\DoxyCodeLine{00253\ \ \ \ \ va\_list\ pvar;}
\DoxyCodeLine{00254\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00255\ }
\DoxyCodeLine{00256\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00257\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00258\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00259\ \ \ \ \ va\_start(pvar,\ fmt);}
\DoxyCodeLine{00260\ \ \ \ \ vfprintf(logfp,\ fmt,\ pvar);}
\DoxyCodeLine{00261\ \ \ \ \ va\_end(pvar);}
\DoxyCodeLine{00262\ }
\DoxyCodeLine{00263\ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00264\ \}}
\DoxyCodeLine{00265\ }
\DoxyCodeLine{00266\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00267\ \_E\_\_pr\_info(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fmt,\ ...)}
\DoxyCodeLine{00268\ \{}
\DoxyCodeLine{00269\ \ \ \ \ va\_list\ pvar;}
\DoxyCodeLine{00270\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00271\ }
\DoxyCodeLine{00272\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00273\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00274\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00275\ \ \ \ \ va\_start(pvar,\ fmt);}
\DoxyCodeLine{00276\ \ \ \ \ vfprintf(logfp,\ fmt,\ pvar);}
\DoxyCodeLine{00277\ \ \ \ \ va\_end(pvar);}
\DoxyCodeLine{00278\ }
\DoxyCodeLine{00279\ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00280\ \}}
\DoxyCodeLine{00281\ }
\DoxyCodeLine{00282\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00283\ \_E\_\_die\_error(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fmt,\ ...)}
\DoxyCodeLine{00284\ \{}
\DoxyCodeLine{00285\ \ \ \ \ va\_list\ pvar;}
\DoxyCodeLine{00286\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00287\ }
\DoxyCodeLine{00288\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00289\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp)\ \{}
\DoxyCodeLine{00290\ \ \ \ \ \ \ \ \ va\_start(pvar,\ fmt);}
\DoxyCodeLine{00291\ \ \ \ \ \ \ \ \ vfprintf(logfp,\ fmt,\ pvar);}
\DoxyCodeLine{00292\ \ \ \ \ \ \ \ \ va\_end(pvar);}
\DoxyCodeLine{00293\ \ \ \ \ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00294\ \ \ \ \ \}}
\DoxyCodeLine{00295\ }
\DoxyCodeLine{00296\ \textcolor{preprocessor}{\#if\ defined(\_\_ADSPBLACKFIN\_\_)\ \&\&\ !defined(\_\_linux\_\_)}}
\DoxyCodeLine{00297\ \ \ \ \ \textcolor{keywordflow}{while}(1);}
\DoxyCodeLine{00298\ \textcolor{preprocessor}{\#else\ }}
\DoxyCodeLine{00299\ \ \ \ \ \ \ \ \ exit(-\/1);}
\DoxyCodeLine{00300\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00301\ \}}
\DoxyCodeLine{00302\ }
\DoxyCodeLine{00303\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00304\ \_E\_\_fatal\_sys\_error(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fmt,\ ...)}
\DoxyCodeLine{00305\ \{}
\DoxyCodeLine{00306\ \ \ \ \ va\_list\ pvar;}
\DoxyCodeLine{00307\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00308\ \ \ \ \ \textcolor{keywordtype}{int}\ local\_errno\ =\ errno;}
\DoxyCodeLine{00309\ }
\DoxyCodeLine{00310\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00311\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp)\ \{}
\DoxyCodeLine{00312\ \ \ \ \ \ \ \ \ va\_start(pvar,\ fmt);}
\DoxyCodeLine{00313\ \ \ \ \ \ \ \ \ vfprintf(logfp,\ fmt,\ pvar);}
\DoxyCodeLine{00314\ \ \ \ \ \ \ \ \ va\_end(pvar);}
\DoxyCodeLine{00315\ }
\DoxyCodeLine{00316\ \ \ \ \ \ \ \ \ fprintf(logfp,\ \textcolor{stringliteral}{"{}:\ \%s\(\backslash\)n"{}},\ strerror(local\_errno));}
\DoxyCodeLine{00317\ \ \ \ \ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00318\ \ \ \ \ \}}
\DoxyCodeLine{00319\ }
\DoxyCodeLine{00320\ }
\DoxyCodeLine{00321\ \textcolor{preprocessor}{\#if\ defined(\_\_ADSPBLACKFIN\_\_)\ \&\&\ !defined(\_\_linux\_\_)}}
\DoxyCodeLine{00322\ \ \ \ \ \textcolor{keywordflow}{while}(1);}
\DoxyCodeLine{00323\ \textcolor{preprocessor}{\#else\ }}
\DoxyCodeLine{00324\ \ \ \ \ \ \ \ \ exit(-\/1);}
\DoxyCodeLine{00325\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00326\ }
\DoxyCodeLine{00327\ \}}
\DoxyCodeLine{00328\ }
\DoxyCodeLine{00329\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00330\ \_E\_\_sys\_error(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fmt,\ ...)}
\DoxyCodeLine{00331\ \{}
\DoxyCodeLine{00332\ \ \ \ \ va\_list\ pvar;}
\DoxyCodeLine{00333\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00334\ \ \ \ \ \textcolor{keywordtype}{int}\ local\_errno\ =\ errno;}
\DoxyCodeLine{00335\ }
\DoxyCodeLine{00336\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00337\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp\ ==\ NULL)}
\DoxyCodeLine{00338\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00339\ }
\DoxyCodeLine{00340\ \ \ \ \ va\_start(pvar,\ fmt);}
\DoxyCodeLine{00341\ \ \ \ \ vfprintf(logfp,\ fmt,\ pvar);}
\DoxyCodeLine{00342\ \ \ \ \ va\_end(pvar);}
\DoxyCodeLine{00343\ }
\DoxyCodeLine{00344\ \ \ \ \ fprintf(logfp,\ \textcolor{stringliteral}{"{}:\ \%s\(\backslash\)n"{}},\ strerror(local\_errno));}
\DoxyCodeLine{00345\ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00346\ \}}
\DoxyCodeLine{00347\ }
\DoxyCodeLine{00348\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00349\ \_E\_\_abort\_error(\textcolor{keywordtype}{char}\ \textcolor{keyword}{const}\ *fmt,\ ...)}
\DoxyCodeLine{00350\ \{}
\DoxyCodeLine{00351\ \ \ \ \ va\_list\ pvar;}
\DoxyCodeLine{00352\ \ \ \ \ FILE\ *logfp;}
\DoxyCodeLine{00353\ }
\DoxyCodeLine{00354\ \ \ \ \ logfp\ =\ err\_get\_logfp();}
\DoxyCodeLine{00355\ \ \ \ \ \textcolor{keywordflow}{if}\ (logfp)\ \{}
\DoxyCodeLine{00356\ \ \ \ \ \ \ \ \ va\_start(pvar,\ fmt);}
\DoxyCodeLine{00357\ \ \ \ \ \ \ \ \ vfprintf(logfp,\ fmt,\ pvar);}
\DoxyCodeLine{00358\ \ \ \ \ \ \ \ \ va\_end(pvar);}
\DoxyCodeLine{00359\ \ \ \ \ \ \ \ \ fflush(logfp);}
\DoxyCodeLine{00360\ \ \ \ \ \}}
\DoxyCodeLine{00361\ }
\DoxyCodeLine{00362\ \textcolor{preprocessor}{\#if\ defined(\_\_ADSPBLACKFIN\_\_)\ \&\&\ !defined(\_\_linux\_\_)}}
\DoxyCodeLine{00363\ \textcolor{keywordflow}{while}(1);}
\DoxyCodeLine{00364\ \textcolor{preprocessor}{\#elif\ defined(\_WIN32\_WCE)}}
\DoxyCodeLine{00365\ exit(-\/1);}
\DoxyCodeLine{00366\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00367\ abort();}
\DoxyCodeLine{00368\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00369\ }
\DoxyCodeLine{00370\ \}}

\end{DoxyCode}
