Julius 4.2
libsent/src/util/jlog.c
説明を見る。
00001 
00028 /*
00029  * Copyright (c) 1991-2011 Kawahara Lab., Kyoto University
00030  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00031  * Copyright (c) 2005-2011 Julius project team, Nagoya Institute of Technology
00032  * All rights reserved
00033  */
00034 
00035 #include <sent/stddefs.h>
00036 #include <sent/tcpip.h>
00037 #include <stdarg.h>
00038 
00039 static FILE *outdev;
00040 static boolean initialized = FALSE;
00041 
00042 #define MAX_PRINTF_LEN 4096     ///< Maximum string length at one printf call
00043 
00051 void
00052 jlog_set_output(FILE *fp)
00053 {
00054   outdev = fp;
00055   initialized = TRUE;
00056 }
00057 
00064 FILE *
00065 jlog_get_fp()
00066 {
00067   if (initialized == FALSE) return stdout;
00068   return outdev;
00069 }
00070 
00079 void
00080 jlog(char *fmt, ...)
00081 {
00082   va_list ap;
00083 
00084   if (initialized == FALSE) {
00085     outdev = stdout;
00086   } else if (outdev == NULL) return;
00087   
00088   va_start(ap,fmt);
00089   vfprintf(outdev, fmt, ap);
00090   va_end(ap);
00091 
00092   return;
00093 }
00094 
00102 int
00103 jlog_flush()
00104 {
00105   if (initialized == FALSE) {
00106     outdev = stdout;
00107   } else if (outdev == NULL) return 0;
00108   return(fflush(outdev));
00109 }
00110