#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) |
Definition in file util.h.
|
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(). |
|
Read one line from file that has been opened by fopen_readfile(). Blank line will be skipped.
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(). |
|
Read one line from file pointer. Blank line will be skipped.
Definition at line 86 of file readfile.c. Referenced by adin_file_begin(), adin_sndfile_begin(), mfcfilelist_nextfile(), and multigram_add_prefix_filelist(). |
|
Read one line from a file descriptor. Blank line will be skipped.
Definition at line 114 of file readfile.c. Referenced by rddfa_fd(), and voca_load_htkdict_fd(). |
|
Read one line from a socket descriptor. Blank line will be skipped.
Definition at line 151 of file readfile.c. Referenced by rddfa_sd(), and voca_load_htkdict_sd(). |
|
Return first token of a buffer, delimited by DELM. Program will terminate if any token does not found.
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(). |
|
Return next token of a buffer, delimited by DELM. Should be called after first_token(). Program will terminate if any token does not found.
Definition at line 202 of file readfile.c. Referenced by add_bigram_rl(), add_unigram(), rddfa_line(), set_bigram(), set_trigram(), and set_unigram(). |
|
Return next token of a buffer, delimited by DELM. Should be called after first_token().
Definition at line 216 of file readfile.c. Referenced by new_str2phseq(), and rdhmmlist(). |
|
Return the rest tokens till newline. Program will terminate if any token does not found.
Definition at line 230 of file readfile.c. |
|
Open a file with zlib.
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(). |
|
Close a file previously opened by fopen_readfile().
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(). |
|
Open or create a file for writing (no compression supported),
Definition at line 312 of file gzfile.c. Referenced by wrwav_open(). |
|
Close file previously opened by open_writefile().
Definition at line 331 of file gzfile.c. Referenced by wrwav_close(). |
|
Read data from input stream opened by fopen_readfile().
Definition at line 90 of file gzfile.c. Referenced by adin_file_open(), adin_file_read(), adin_stdin_read(), myread(), and rdn(). |
|
Write data.
|
|
Read one character from input stream opened by fopen_readfile().
Definition at line 109 of file gzfile.c. Referenced by rdn_str(). |
|
Test if reached end of file, for files opened by fopen_readfile().
Definition at line 124 of file gzfile.c. Referenced by adin_file_read(). |
|
Set block size and memory alignment factor. Definition at line 70 of file mybmalloc.c. Referenced by mybmalloc(), mybmalloc2(), and system_bootup(). |
|
Malloc specified size and return the pointer.
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(). |
|
Free all the allocated area. Definition at line 180 of file mybmalloc.c. |
|
String duplication using mybmalloc().
Definition at line 210 of file mybmalloc.c. Referenced by rdhmmdef(), rdhmmlist(), regist_cdset(), and tmix_read(). |
|
Another version of memory block allocation, used for tree lexicon.
Definition at line 228 of file mybmalloc.c. Referenced by add_wacc(), wchmm_add_word(), and wchmm_duplicate_state(). |
|
Free all memories allocated by mybmalloc2()
Definition at line 262 of file mybmalloc.c. Referenced by wchmm_free(). |
|
|
Re-allocate memory area, keeping the existing data, as the same as realloc.
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(). |
|
Allocate memory area and set it to zero, as the same as calloc.
Definition at line 76 of file mymalloc.c. Referenced by CMN(). |
|
Byte swapping of 16bit audio samples.
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(). |
|
Generic byte-swapping functions for any size of unit.
Definition at line 34 of file endian.c. Referenced by myread(), mywrite(), rdn(), read_param(), and wrt(). |
|
Setup charset conversion.
Definition at line 46 of file charconv.c. Referenced by main(). |
|
Apply charset conversion to a string.
Definition at line 80 of file charconv.c. Referenced by j_printerr(), j_printf(), and module_send(). |
|
Setup charset conversion for iconv.
Definition at line 44 of file charconv_iconv.c. Referenced by j_printf_set_charconv(). |
|
Apply charset conversion to a string using iconv.
Definition at line 91 of file charconv_iconv.c. Referenced by charconv(). |
|
Setup charset conversion for win32.
Definition at line 67 of file charconv_win32.c. Referenced by j_printf_set_charconv(). |
|
Apply charset conversion to a string using win32 functions
Definition at line 203 of file charconv_win32.c. Referenced by charconv(). |
|
Setup charset conversion for libjcode.
Definition at line 49 of file charconv_libjcode.c. Referenced by j_printf_set_charconv(). |
|
Apply charset conversion to a string using libjcode.
Definition at line 88 of file charconv_libjcode.c. Referenced by charconv(). |
|
Set the alternative output functions instead of normal tty output.
Definition at line 57 of file j_printf.c. |
|
Output a text message to standard out. The output device can be changed by set_print_func().
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(). |
|
Output a text message to standard error. The output device can be changed by set_print_func().
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(). |
|
Flush text message. The output device can be changed by set_print_func().
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(). |
|
Generic function to send a formatted message to client module.
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(). |
|
Output error message and exit the program.
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(). |
|
Register a function that should be executed just before application error exit.
Definition at line 200 of file j_printf.c. Referenced by system_bootup(). |
|
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(). |
|
Register a function that should be executed just before application ends.
Definition at line 235 of file j_printf.c. Referenced by system_bootup(). |
|
Generic function to extract tokens from strings, with quotation handling. The usage is as the same as strtok.
Definition at line 50 of file mystrtok.c. Referenced by mystrtok(), mystrtok_movetonext(), mystrtok_quote(), and voca_load_htkdict_line(). |
|
Extract tokens considering quotation by double quotation mark.
Definition at line 104 of file mystrtok.c. Referenced by read_token(). |
|
Extract tokens, not considering quotation, just as the same as strtok.
Definition at line 118 of file mystrtok.c. Referenced by voca_load_htkdict_line(). |
|
Just move to the beginning of the next token, without modifying the str.
Definition at line 132 of file mystrtok.c. Referenced by voca_load_htkdict_line(). |