Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

util.h File Reference

Definitions for common utility functions. More...

#include <stdarg.h>

Include dependency graph for util.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MYBMALLOC_BLOCK_SIZE   10000
 Memory block size in bytes for mybmalloc().

Typedefs

typedef _bmalloc_base BMALLOC_BASE
 Information of allocated memory block for mybmalloc().

Functions

char * getl (char *, int, FILE *)
char * getl_fp (char *, int, FILE *)
char * getl_fd (char *, int, int)
char * getl_sd (char *, int, int)
char * first_token (char *)
char * next_token (void)
char * next_token_if_any (void)
char * rest_token (void)
FILE * fopen_readfile (char *)
int fclose_readfile (FILE *)
FILE * fopen_writefile (char *)
int fclose_writefile (FILE *)
size_t myfread (void *ptr, size_t size, size_t n, FILE *fp)
size_t myfwrite (void *ptr, size_t size, size_t n, FILE *fp)
int myfgetc (FILE *fp)
int myfeof (FILE *fp)
void mybmalloc_set_param ()
void * mybmalloc (int)
void mybmalloc_free (void)
char * mybstrdup (char *)
void * mybmalloc2 (int size, BMALLOC_BASE **list)
void mybfree2 (BMALLOC_BASE **list)
void * mymalloc (int)
void * myrealloc (void *, int)
void * mycalloc (int, int)
void swap_sample_bytes (SP16 *buf, int len)
void swap_bytes (char *buf, size_t unitbyte, int unitnum)
boolean j_printf_set_charconv (char *fromcode, char *tocode)
char * charconv (char *instr, char *outstr, int maxoutlen)
boolean charconv_iconv_setup (char *fromcode, char *tocode, boolean *enabled)
char * charconv_iconv (char *instr, char *outstr, int maxoutlen)
boolean charconv_win32_setup (char *fromcode, char *tocode, boolean *enabled)
char * charconv_win32 (char *instr, char *outstr, int maxoutlen)
boolean charconv_libjcode_setup (char *fromcode, char *tocode, boolean *enabled)
char * charconv_libjcode (char *instr, char *outstr, int maxoutlen)
void set_print_func (void(*print)(char *), void(*printerr)(char *), void(*flush)(void))
int j_printf (char *format,...)
 Output a text message to standard out.
int j_printerr (char *format,...)
 Output a text message to standard error.
int j_flushprint ()
 Flush text message.
int module_send (int sd, char *format,...)
void j_error (char *format,...)
void j_error_register_exitfunc (void(*error_func)())
void j_exit ()
void j_exit_register_exitfunc (void(*exit_func)())
char * mystrtok_quotation (char *str, char *delim, int left_paren, int right_paren, int mode)
char * mystrtok_quote (char *str, char *delim)
char * mystrtok (char *str, char *delim)
char * mystrtok_movetonext (char *str, char *delim)


Detailed Description

Definitions for common utility functions.

Author:
Akinobu LEE
Date:
Sat Feb 12 12:30:40 2005
This file contains definitions for common utility functions: text reading and parsing, compressed file input, memory allocation, byte order changing, common printf function (j_printf etc.) and so on.

Revision
1.1.1.1

Definition in file util.h.


Define Documentation

#define MYBMALLOC_BLOCK_SIZE   10000
 

Memory block size in bytes for mybmalloc().

mybmalloc() allocate memory per big block to reduce memory management overhead. This value sets the block size to be allocated. Smaller value may leads to finer granularity, but overhead may increase. Larger value may result in reduction of overhead, but too much memory can be allocated for a small memory requirement.

Definition at line 49 of file util.h.

Referenced by mybmalloc_set_param().


Function Documentation

char* getl char *  buf,
int  maxlen,
FILE *  fp
 

Read one line from file that has been opened by fopen_readfile(). Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fp [in] file pointer or gzFile pointer
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 52 of file readfile.c.

Referenced by add_bigram_rl(), add_unigram(), ngram_read_arpa(), rddfa(), rdhmmlist(), read_token(), set_and_check_total_info(), set_bigram(), set_total_info(), set_trigram(), set_unigram(), and voca_load_htkdict().

char* getl_fp char *  buf,
int  maxlen,
FILE *  fp
 

Read one line from file pointer. Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fp [in] file pointer
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 86 of file readfile.c.

Referenced by adin_file_begin(), adin_sndfile_begin(), mfcfilelist_nextfile(), and multigram_add_prefix_filelist().

char* getl_fd char *  buf,
int  maxlen,
int  fd
 

Read one line from a file descriptor. Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
fd [in] file descriptor
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 114 of file readfile.c.

Referenced by rddfa_fd(), and voca_load_htkdict_fd().

char* getl_sd char *  buf,
int  maxlen,
int  sd
 

Read one line from a socket descriptor. Blank line will be skipped.

Parameters:
buf [out] data buffer
maxlen [in] maximum length of above
sd [in] socket descpritor
Returns:
the buffer buf, or NULL on EOF or error.

Definition at line 151 of file readfile.c.

Referenced by rddfa_sd(), and voca_load_htkdict_sd().

char* first_token char *  buf  ) 
 

Return first token of a buffer, delimited by DELM. Program will terminate if any token does not found.

Parameters:
buf [i/o] string buffer
Returns:
pointer to the extracted token.

Definition at line 186 of file readfile.c.

Referenced by add_bigram_rl(), add_unigram(), new_str2phseq(), rddfa_line(), rdhmmlist(), set_bigram(), set_trigram(), and set_unigram().

char* next_token void   ) 
 

Return next token of a buffer, delimited by DELM. Should be called after first_token(). Program will terminate if any token does not found.

Returns:
pointer to the extracted token.

Definition at line 202 of file readfile.c.

Referenced by add_bigram_rl(), add_unigram(), rddfa_line(), set_bigram(), set_trigram(), and set_unigram().

char* next_token_if_any void   ) 
 

Return next token of a buffer, delimited by DELM. Should be called after first_token().

Returns:
pointer to the extracted token, or NULL if not found.

Definition at line 216 of file readfile.c.

Referenced by new_str2phseq(), and rdhmmlist().

char* rest_token void   ) 
 

Return the rest tokens till newline. Program will terminate if any token does not found.

Returns:
pointer to the extracted token.

Definition at line 230 of file readfile.c.

FILE* fopen_readfile char *  filename  ) 
 

Open a file with zlib.

Parameters:
filename [in] file name to open
Returns:
gzFile pointer if succeed, NULL on failure.

Definition at line 54 of file gzfile.c.

Referenced by adin_file_open(), CMN_load_from_file(), init_dfa(), init_hmminfo(), init_ngram_arpa(), init_ngram_bin(), init_voca(), new_SS_load_from_file(), and rdparam().

int fclose_readfile FILE *  fp  ) 
 

Close a file previously opened by fopen_readfile().

Parameters:
fp [in] gzFile pointer
Returns:
0 on success, -1 on error.

Definition at line 70 of file gzfile.c.

Referenced by adin_file_close(), adin_file_open(), CMN_load_from_file(), init_dfa(), init_hmminfo(), init_ngram_arpa(), init_ngram_bin(), init_voca(), new_SS_load_from_file(), rdparam(), and setup_wav().

FILE* fopen_writefile char *  filename  ) 
 

Open or create a file for writing (no compression supported),

Parameters:
filename [in] filename
Returns:
the file pointer or NULL on failure.

Definition at line 312 of file gzfile.c.

Referenced by wrwav_open().

int fclose_writefile FILE *  fp  ) 
 

Close file previously opened by open_writefile().

Parameters:
fp [in] file pointer
Returns:
0 on success, -1 on failure.

Definition at line 331 of file gzfile.c.

Referenced by wrwav_close().

size_t myfread void *  ptr,
size_t  size,
size_t  n,
FILE *  fp
 

Read data from input stream opened by fopen_readfile().

Parameters:
ptr [out] data buffer
size [in] size of unit in bytes
n [in] number of unit to be read
fp [in] gzFile pointer
Returns:
number of read units or EOF, -1 on error.

Definition at line 90 of file gzfile.c.

Referenced by adin_file_open(), adin_file_read(), adin_stdin_read(), myread(), and rdn().

size_t myfwrite void *  ptr,
size_t  size,
size_t  n,
FILE *  fp
 

Write data.

Parameters:
ptr [in] data buffer
size [in] size of unit in bytes
n [in] number of unit to write
fp [in] file pointer
Returns:
the number of units successfully written, or 0 if EOF or failed.

Definition at line 350 of file gzfile.c.

Referenced by mywrite(), and wrt().

int myfgetc FILE *  fp  ) 
 

Read one character from input stream opened by fopen_readfile().

Parameters:
fp [in] gzFile pointer
Returns:
the read character, or -1 on EOF or error.

Definition at line 109 of file gzfile.c.

Referenced by rdn_str().

int myfeof FILE *  fp  ) 
 

Test if reached end of file, for files opened by fopen_readfile().

Parameters:
fp [in] gzFile pointer.
Returns:
1 if already on EOF, 0 if otherwise.

Definition at line 124 of file gzfile.c.

Referenced by adin_file_read().

void mybmalloc_set_param  ) 
 

Set block size and memory alignment factor.

Definition at line 70 of file mybmalloc.c.

Referenced by mybmalloc(), mybmalloc2(), and system_bootup().

void* mybmalloc int  size  ) 
 

Malloc specified size and return the pointer.

Parameters:
size [in] required size in bytes
Returns:
pointer to the allocated area.

Definition at line 102 of file mybmalloc.c.

Referenced by add_to_error(), calc_tied_mix_init(), cdset_new(), dens_new(), dens_read(), gms_gprune_init(), hmm_add_physical_to_logical(), hmm_add_pseudo_phones_sub(), htk_hmmdata_new(), htk_hmmdata_read(), make_hmm_basephone_list(), mybstrdup(), rd_data(), rd_dens(), rd_state(), rd_tmix(), rd_trans(), rd_var(), rdhmmlist(), rdn_str(), state_new(), state_read(), tmix_create_codebook_index(), tmix_read(), trans_new(), trans_read(), and var_read().

void mybmalloc_free void   ) 
 

Free all the allocated area.

Definition at line 180 of file mybmalloc.c.

char* mybstrdup char *  s  ) 
 

String duplication using mybmalloc().

Parameters:
s [in] string to be duplicated
Returns:
pointer to the newly allocated string.

Definition at line 210 of file mybmalloc.c.

Referenced by rdhmmdef(), rdhmmlist(), regist_cdset(), and tmix_read().

void* mybmalloc2 int  size,
BMALLOC_BASE **  list
 

Another version of memory block allocation, used for tree lexicon.

Parameters:
size [in] memory size to be allocated
list [i/o] total memory management information (will be updated here)
Returns:
pointer to the newly allocated area.

Definition at line 228 of file mybmalloc.c.

Referenced by add_wacc(), wchmm_add_word(), and wchmm_duplicate_state().

void mybfree2 BMALLOC_BASE **  list  ) 
 

Free all memories allocated by mybmalloc2()

Parameters:
list [i/o] total memory management information (will be cleaned here)

Definition at line 262 of file mybmalloc.c.

Referenced by wchmm_free().

void* mymalloc int  size  ) 
 

Allocate a memory, as the same as malloc.

Parameters:
size [in] required size in bytes.
Returns:
pointer to the the newly allocated area.

Definition at line 40 of file mymalloc.c.

Referenced by add_arc(), add_to_error(), add_unigram(), adin_cut(), adin_cut_callback_store_buffer(), adin_file_begin(), adin_initialize(), adin_mic_standby(), adin_sndfile_begin(), adin_thread_create(), bt_relocate_rw(), build_gsset(), build_state2gs(), build_wchmm2(), calc_tied_mix_prepare(), cm_init(), CMN_realtime_update(), config_file_parse(), Delta(), dfa_append(), dfa_find_pause_word(), dfa_info_new(), dfa_pause_word_append(), dfa_state_init(), do_align(), exec_exclude_vectors(), filepath(), get_back_trellis_end(), get_back_trellis_proceed(), get_line(), gmm_gprune_safe_init(), gmm_init(), gms_init(), gms_prepare(), gprune_beam_init(), gprune_heu_init(), gprune_none_init(), gprune_safe_init(), hmminfo_new(), init_count_zc_e(), init_mark(), init_param(), InitFBank(), make_costbl_hamming(), make_costbl_makemfcc(), make_fft_table(), make_phseq(), make_sintbl_wcep(), make_terminfo(), malloc_dfa_cp(), malloc_nodes(), malloc_wordtrellis(), mfcfilelist_nextfile(), multigram_add(), multigram_add_gramlist(), multigram_add_prefix_filelist(), mybmalloc(), mybmalloc2(), new_make_word_hmm_with_lm(), new_node(), new_param(), new_SS_calculate(), new_SS_load_from_file(), new_str2phseq(), new_str2wordseq(), new_wav2mfcc(), newnode(), ngram_compact_bigram_context(), ngram_info_new(), ngram_make_lookup_tree(), ngram_read_bin(), nw_malloc(), opt_parse(), outprob_cache_extend(), outprob_cd_nbest_init(), param_str2code(), phoneme_rev_align(), rd_dens(), rd_state(), rd_tmix(), rd_trans(), rd_var(), rddfa_line(), rdhmmlist(), read_param(), read_token(), realloc_dfa_cp(), RealTimeInit(), RealTimeParam(), RealTimePipeLine(), regist_cdset(), set_bigram(), set_trigram(), set_unigram(), state_rev_align(), terminfo_append(), test_expand_triphone(), tmix_create_codebook_index(), var_new(), viterbi_segment(), voca_append(), voca_load_htkdict_line(), Wav2MFCC(), wchmm_add_word(), wchmm_duplicate_leafnode(), wchmm_fbs(), wchmm_init(), wchmm_new(), WeightCepstrum(), winfo_init(), WMP_deltabuf_new(), WMP_init(), word_info_new(), word_rev_align(), wt_dens(), wt_state(), wt_tmix(), wt_trans(), and wt_var().

void* myrealloc void *  ptr,
int  size
 

Re-allocate memory area, keeping the existing data, as the same as realloc.

Parameters:
ptr [in] memory pointer to be re-allocated
size [in] required new size in bytes
Returns:
pointer to the the newly allocated area with existing data.

Definition at line 58 of file mymalloc.c.

Referenced by CMN_realtime_update(), config_file_parse(), dfa_pause_word_append(), dfa_state_expand(), expand_tlist(), new_str2phseq(), new_str2wordseq(), ngram_compact_bigram_context(), nw_expand(), outprob_cache_extend(), RealTimePipeLine(), regist_cdset(), terminfo_append(), voca_load_htkdict_line(), wchmm_extend(), and winfo_expand().

void* mycalloc int  nelem,
int  elsize
 

Allocate memory area and set it to zero, as the same as calloc.

Parameters:
nelem [in] size of element in bytes
elsize [in] number of elements to allocate
Returns:
pointer to the newly allocated area.

Definition at line 76 of file mymalloc.c.

Referenced by CMN().

void swap_sample_bytes SP16 buf,
int  len
 

Byte swapping of 16bit audio samples.

Parameters:
buf [i/o] data buffer
len [in] length of above

Definition at line 58 of file endian.c.

Referenced by adin_file_read(), adin_mic_read(), adin_stdin_read(), adin_tcpip_read(), NA_read(), and wrsamp().

void swap_bytes char *  buf,
size_t  unitbyte,
int  unitnum
 

Generic byte-swapping functions for any size of unit.

Parameters:
buf [i/o] data buffer
unitbyte [in] size of unit in bytes
unitnum [in] number of unit in the buffer

Definition at line 34 of file endian.c.

Referenced by myread(), mywrite(), rdn(), read_param(), and wrt().

boolean j_printf_set_charconv char *  fromcode,
char *  tocode
 

Setup charset conversion.

Parameters:
fromcode [in] input charset name (only libjcode accepts NULL)
tocode [in] output charset name, or NULL when disable conversion
Returns:
TRUE on success, FALSE on failure.

Definition at line 46 of file charconv.c.

Referenced by main().

char* charconv char *  instr,
char *  outstr,
int  maxoutlen
 

Apply charset conversion to a string.

Parameters:
instr [in] source string
outstr [in] destination buffer
maxoutlen [in] allocated length of outstr in byte.
Returns:
either of instr or outstr, that holds the result string.

Definition at line 80 of file charconv.c.

Referenced by j_printerr(), j_printf(), and module_send().

boolean charconv_iconv_setup char *  fromcode,
char *  tocode,
boolean enable_conv
 

Setup charset conversion for iconv.

Parameters:
fromcode [in] input charset code name (NULL invalid)
tocode [in] output charset code name, or NULL when disable conversion
enable_conv [out] return whether conversion should be enabled or not
Returns:
TRUE on success, FALSE on failure (unknown code name).

Definition at line 44 of file charconv_iconv.c.

Referenced by j_printf_set_charconv().

char* charconv_iconv char *  instr,
char *  outstr,
int  maxoutlen
 

Apply charset conversion to a string using iconv.

Parameters:
instr [in] source string
outstr [out] destination buffer
maxoutlen [in] allocated length of outstr in byte.
Returns:
either of instr or outstr, that holds the result string.

Definition at line 91 of file charconv_iconv.c.

Referenced by charconv().

boolean charconv_win32_setup char *  fromcode,
char *  tocode,
boolean enable_conv
 

Setup charset conversion for win32.

Parameters:
fromcode [in] input charset code name or codepage number string, NULL invalid
tocode [in] output charset code name or codepage number string, or NULL when disable conversion
enable_conv [out] store whether conversion should be enabled or not
Returns:
TRUE on success, FALSE on failure (unknown codename or unsupported codepage).

Definition at line 67 of file charconv_win32.c.

Referenced by j_printf_set_charconv().

char* charconv_win32 char *  instr,
char *  outstr,
int  maxoutlen
 

Apply charset conversion to a string using win32 functions

Parameters:
instr [in] source string
outstr [in] destination buffer
maxoutlen [in] allocated length of outstr in byte.
Returns:
either of instr or outstr, that holds the result string.

Definition at line 203 of file charconv_win32.c.

Referenced by charconv().

boolean charconv_libjcode_setup char *  fromcode,
char *  tocode,
boolean enable_conv
 

Setup charset conversion for libjcode.

Parameters:
fromcode [in] input charset name (ignored, will be auto-detected)
tocode [in] output charset name, or NULL when disable conversion
enable_conv [out] return whether conversion should be enabled or not
Returns:
TRUE on success, FALSE on failure (unknown name).

Definition at line 49 of file charconv_libjcode.c.

Referenced by j_printf_set_charconv().

char* charconv_libjcode char *  instr,
char *  outstr,
int  maxoutlen
 

Apply charset conversion to a string using libjcode.

Parameters:
instr [in] source string
outstr [out] destination buffer
maxoutlen [in] allocated length of outstr in byte.
Returns:
either of instr or outstr, that holds the result string.

Definition at line 88 of file charconv_libjcode.c.

Referenced by charconv().

void set_print_func void(*)(char *)  print,
void(*)(char *)  printerr,
void(*)(void)  flush
 

Set the alternative output functions instead of normal tty output.

Parameters:
print [in] function to output string in stdout
printerr [in] function to output string in stderr
flush [in] function to flush the stdout

Definition at line 57 of file j_printf.c.

int j_printf char *  fmt,
  ...
 

Output a text message to standard out.

The output device can be changed by set_print_func().

Parameters:
fmt [in] format string, like printf.
... [in] variable length argument like printf.
Returns:
the same as printf, i.e. number of characters printed.

Definition at line 76 of file j_printf.c.

Referenced by accept_from(), adin_file_begin(), adin_mic_standby(), adin_sndfile_begin(), adin_stdin_begin(), bt_current_max_word(), build_wchmm2(), callback_list_error(), check_wchmm(), config_file_parse(), detailed_help(), disp_ptree(), do_align(), exec_exclude_vectors(), hmm_check(), lcdset_register_with_category(), list_error(), main_module_loop(), main_recognition_loop(), make_base_phone(), make_ngram_ref(), make_ptree(), mark_exclude_vector(), multigram_activate(), multigram_add(), multigram_build_append(), multigram_deactivate(), multigram_delete(), multigram_exec(), multigram_exec_activate(), multigram_exec_delete(), multigram_read_file(), multigram_setup(), new_select_param_kind(), new_str2phseq(), ngram_write_bin(), param_strip_zero(), print_1pass_result(), print_all_basephone_name(), print_all_gram(), print_callback_detail(), print_callback_name(), print_dfa_cp(), print_dfa_info(), print_error_callback(), print_format(), print_hmmdef_info(), print_hmminfo(), print_info(), print_ngram_info(), print_phone_info(), print_setting(), print_voca_info(), print_wchmm_info(), print_wchmm_s(), print_wchmm_s_arc(), print_wchmm_w(), print_winfo_w(), put_all_in_stack(), put_atom(), put_hmm_arc(), put_hmm_outprob(), put_htk_dens(), put_htk_hmm(), put_htk_state(), put_htk_trans(), put_htk_var(), put_hypo_cmscore(), put_hypo_phoneme(), put_hypo_wname(), put_hypo_woutput(), put_logical_hmm(), put_param_head(), put_param_info(), put_vec(), put_voca(), rd_data(), rd_dens(), rd_state(), rd_tmix(), rd_trans(), rd_var(), RealTimeCMNUpdate(), RealTimeInit(), RealTimeParam(), scan_word(), select_param_vmark(), test_expand_triphone(), test_interword_triphone(), ttyout_gmm(), ttyout_pass1_current(), ttyout_pass1_end(), ttyout_pass1_final(), ttyout_pass2(), ttyout_pass2_end(), ttyout_pass2_failed(), ttyout_rejected(), wb_ok(), wchmm_check_interactive(), wchmm_fbs(), wt_data(), wt_dens(), wt_state(), wt_tmix(), wt_trans(), and wt_var().

int j_printerr char *  fmt,
  ...
 

Output a text message to standard error.

The output device can be changed by set_print_func().

Parameters:
fmt [in] format string, like printf.
... [in] variable length argument like printf.
Returns:
the same as printf, i.e. number of characters printed.

Definition at line 110 of file j_printf.c.

Referenced by add_bigram_rl(), add_unigram(), adin_cut(), adin_cut_callback_store_buffer(), adin_file_begin(), adin_file_open(), adin_file_standby(), adin_mic_read(), adin_mic_standby(), adin_mic_start(), adin_mic_stop(), adin_netaudio_read(), adin_netaudio_start(), adin_setup_func(), adin_sndfile_begin(), adin_sndfile_end(), adin_sndfile_standby(), adin_stdin_begin(), adin_tcpip_begin(), adin_tcpip_end(), adin_tcpip_read(), adin_tcpip_send_pause(), adin_tcpip_send_resume(), adin_tcpip_send_terminate(), adin_tcpip_standby(), adin_thread_create(), adin_thread_process(), args_needed_exit(), build_state2gs(), build_wchmm(), build_wchmm2(), charconv_iconv_setup(), charconv_libjcode_setup(), charconv_win32(), charconv_win32_setup(), check_format(), check_header(), check_hmm_limit(), check_hmm_options(), check_specs(), CMN_load_from_file(), CMN_save_to_file(), codebook_add(), config_file_parse(), configure_param(), decode_output_selection(), dens_add(), dfa_symbol_lookup(), error_missing_left_triphone(), error_missing_right_triphone(), final_fusion(), finalize_1st_pass(), get_back_trellis_proceed(), get_dens_data(), get_line(), get_state_data(), get_trans_data(), get_var_data(), gms_init(), guess_abs_e_location(), guess_basenum(), guess_if_cd_hmm(), hmm_add_physical_to_logical(), hmm_add_pseudo_phones(), htk_hmm_set_pause_model(), htk_hmmdata_add(), init_dfa(), init_hmminfo(), init_ngram_arpa(), init_ngram_bin(), init_voca(), initialize_dict(), initialize_GMM(), initialize_GSHMM(), initialize_HMM(), m_errexit(), main_recognition_loop(), make_connection(), make_connection_unix(), make_costbl_hamming(), make_costbl_makemfcc(), make_dfa_voca_ref(), make_fft_table(), make_log_tbl(), make_sintbl_wcep(), make_voca_ref(), multigram_add_prefix_filelist(), mybmalloc_set_param(), NA_standby(), new_param_check_and_adjust(), new_SS_load_from_file(), new_str2wordseq(), new_wav2mfcc(), ngram_compact_bigram_context(), ngram_read_arpa(), ngram_read_bin(), opt_parse(), param_qualstr2code(), print_1pass_result(), put_voca_err(), rd(), rdhmmdef(), rdhmmlist(), read_binhmm(), read_global_opt(), read_param(), record_sample_close(), select_param_vmark(), select_result_output(), set_and_check_total_info(), set_bigram(), set_trigram(), set_unigram(), set_unknown_id(), setup_wav(), state_add(), state_read(), tmix_create_codebook_index(), trans_add(), trans_ok_p(), triphone_callback_normal(), triphone_callback_right(), ttyout_pass1_begin(), ttyout_status_recready(), usage(), var_add(), var_read(), viterbi_segment(), voca_load_htkdict_line(), voca_lookup_wid(), voca_mono2tri(), wchmm_add_word(), wchmm_fbs(), wchmm_index_ststart(), write_header(), wrwav_close(), wt(), and xrun_recovery().

int j_flushprint  ) 
 

Flush text message.

The output device can be changed by set_print_func().

Returns:
the same as fflush, i.e. 0 on success, other if failed.

Definition at line 141 of file j_printf.c.

Referenced by main_recognition_loop(), ttyout_pass1_current(), ttyout_pass2(), ttyout_pass2_end(), and wchmm_fbs().

int module_send int  sd,
char *  fmt,
  ...
 

Generic function to send a formatted message to client module.

Parameters:
sd [in] socket descriptor
fmt [in] format string, like printf.
... [in] variable length argument like printf.
Returns:
the same as printf, i.e. number of characters printed.

Definition at line 162 of file j_printf.c.

Referenced by m_errexit(), m_exit(), msock_gmm(), msock_pass1_current(), msock_pass1_final(), msock_pass2(), msock_pass2_begin(), msock_pass2_end(), msock_pass2_failed(), msock_rejected(), msock_status_param(), msock_status_process_offline(), msock_status_process_online(), msock_status_recend(), msock_status_recready(), msock_status_recstart(), msock_word_out1(), msock_word_out2(), multigram_activate(), multigram_deactivate(), multigram_delete(), and send_gram_info().

void j_error char *  fmt,
  ...
 

Output error message and exit the program.

Parameters:
fmt [in] format string, like printf.
... [in] variable length argument like printf.

Definition at line 212 of file j_printf.c.

Referenced by accept_from(), add_unigram(), adin_initialize(), adin_mic_standby(), adin_tcpip_end(), adin_thread_create(), aptree_remove_entry(), aptree_search_data(), build_wchmm(), build_wchmm2(), charconv_iconv(), check_header(), check_specs(), checkdir(), checkpath(), config_file_parse(), cpair_append(), dfa_pause_word_append(), extract_cpair(), final_fusion(), first_token(), get_back_trellis_proceed(), getl_fd(), getl_sd(), hmm_add_pseudo_phones_sub(), init_dfa(), init_hmminfo(), init_ngram_arpa(), init_ngram_bin(), InitFBank(), initialize_dict(), initialize_HMM(), lookup_word(), main(), main_module_loop(), main_recognition_loop(), make_dfa_voca_ref(), make_record_filename(), mark_exclude_vector(), mark_word_edge(), mfcfilelist_nextfile(), multigram_read_file(), mycalloc(), mymalloc(), myrealloc(), new_make_word_hmm_with_lm(), new_wav2mfcc(), newnode(), next_token(), ngram_compact_bigram_context(), ngram_read_arpa(), ngram_read_bin(), opt_parse(), opt_terminate(), outprob_cd(), outprob_style(), print_info(), ptree_search_data(), rderr(), rdhmmdef(), rdhmmlist(), rdn(), rdn_str(), RealTimeInit(), RealTimePipeLinePrepare(), record_sample_close(), record_sample_open(), record_sample_write(), regist_cdset(), rest_token(), scan_word(), set_bigram(), set_trigram(), set_unigram(), setup_result_msock(), totalstatelen(), trace_backptr(), trans_ok_p(), Wav2MFCC(), wchmm_add_word(), wchmm_fbs(), wchmm_link_hmm(), WeightCepstrum(), winfo_expand(), WMP_init(), wrt(), wt_data(), wt_dens(), wt_state(), and wt_tmix().

void j_error_register_exitfunc void(*)()  f  ) 
 

Register a function that should be executed just before application error exit.

Parameters:
f [in] pointer to the function

Definition at line 200 of file j_printf.c.

Referenced by system_bootup().

void j_exit  ) 
 

Exit the program.

Definition at line 245 of file j_printf.c.

Referenced by detailed_help(), gmm_init(), main_recognition_loop(), opt_parse(), and usage().

void j_exit_register_exitfunc void(*)()  f  ) 
 

Register a function that should be executed just before application ends.

Parameters:
f [in] pointer to the function

Definition at line 235 of file j_printf.c.

Referenced by system_bootup().

char* mystrtok_quotation char *  str,
char *  delim,
int  left_paren,
int  right_paren,
int  mode
 

Generic function to extract tokens from strings, with quotation handling. The usage is as the same as strtok.

Parameters:
str [i/o] source string, or NULL when this is a continuous call from previous call. Will be truncated in this function.
delim [in] string to specify the delimiters.
left_paren [in] left brace
right_paren [in] right brace
mode [in] if 1, just move to the beginning of next token
Returns:
pointer to the next extracted token.

Definition at line 50 of file mystrtok.c.

Referenced by mystrtok(), mystrtok_movetonext(), mystrtok_quote(), and voca_load_htkdict_line().

char* mystrtok_quote char *  str,
char *  delim
 

Extract tokens considering quotation by double quotation mark.

Parameters:
str [i/o] source string, will be truncated.
delim [in] string of all token delimiters
Returns:
pointer to the next extracted token, or NULL when no token found.

Definition at line 104 of file mystrtok.c.

Referenced by read_token().

char* mystrtok char *  str,
char *  delim
 

Extract tokens, not considering quotation, just as the same as strtok.

Parameters:
str [i/o] source string, will be truncated.
delim [in] string of all token delimiters
Returns:
pointer to the next extracted token, or NULL when no token found.

Definition at line 118 of file mystrtok.c.

Referenced by voca_load_htkdict_line().

char* mystrtok_movetonext char *  str,
char *  delim
 

Just move to the beginning of the next token, without modifying the str.

Parameters:
str [i/o] source string, will be truncated.
delim [in] string of all token delimiters
Returns:
pointer to the next extracted token, or NULL when no token found.

Definition at line 132 of file mystrtok.c.

Referenced by voca_load_htkdict_line().


Generated on Tue Mar 28 16:18:46 2006 for Julius by  doxygen 1.4.2