libsent/src/util/j_printf.c File Reference

Message text output and error exit functions. More...

#include <sent/stddefs.h>
#include <sent/tcpip.h>
#include <stdarg.h>

Include dependency graph for j_printf.c:

Go to the source code of this file.

Defines

#define MAX_PRINTF_LEN   4096
 Maximum string length at one printf call.

Functions

void set_print_func (void(*print)(char *), void(*printerr)(char *), void(*flush)(void))
int j_printf (char *fmt,...)
 Output a text message to standard out.
int j_printerr (char *fmt,...)
 Output a text message to standard error.
int j_flushprint ()
 Flush text message.
int module_send (int sd, char *fmt,...)
void j_error_register_exitfunc (void(*f)())
void j_error (char *fmt,...)
void j_exit_register_exitfunc (void(*f)())
void j_exit ()

Variables

static void(*) j_print_func (char *) = NULL
 Alternative output function replacing standard output.
static void(*) j_printerr_func (char *) = NULL
 Alternative output function replacing stndard error.
static void(*) j_flush_func (void) = NULL
 Alternative function to flush the output.
static char inbuf [MAX_PRINTF_LEN]
 Local work area for text output.
static char outbuf [MAX_PRINTF_LEN]
 Local work area for charset conversion.
static void(*) error_func () = NULL
 Alternative function to be executed for application error exit.
static void(*) exit_func () = NULL
 Alternative function to be executed at application normal exit.


Detailed Description

Message text output and error exit functions.

Author:
Akinobu LEE
Date:
Thu Feb 17 16:02:41 2005
These are generic functions for text message output. Most of text messages such as recognition results, status, informations in Julius/Julian will be output to TTY or via network using these functions. The character set conversion will also be performed here.

Revision
1.3

Definition in file j_printf.c.


Function Documentation

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_read(), adin_mic_standby(), adin_sndfile_begin(), adin_stdin_begin(), allocateAudioBufferList(), bt_current_max_word(), callback_list_error(), check_wchmm(), config_file_parse(), ConvInputProc(), detailed_help(), disp_ptree(), do_align(), exec_exclude_vectors(), hmm_check(), list_error(), main_module_loop(), main_recognition_loop(), make_base_phone(), make_ngram_ref(), make_ptree(), mark_exclude_vector(), max_successor_prob_iw(), msock_exec_command(), new_select_param_kind(), new_str2phseq(), ngram_nextwords(), param_strip_zero(), print_all_basephone_name(), 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_ngraminfo(), print_phone_info(), print_setting(), print_voca_info(), print_wchmm_info(), print_wchmm_s(), print_wchmm_s_arc(), print_wchmm_s_successor(), print_wchmm_w(), print_winfo_w(), printAudioBuffer(), printStreamInfo(), 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_para(), put_param_head(), put_param_info(), put_vec(), put_voca(), 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_dens(), 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(), allocateAudioBufferList(), args_needed_exit(), build_state2gs(), 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(), ConvInputProc(), 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_basenum(), guess_if_cd_hmm(), hmm_add_physical_to_logical(), hmm_add_pseudo_phones(), htk_config_file_parse(), 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(), msock_exec_command(), mybmalloc_set_param(), NA_standby(), new_param_check_and_adjust(), new_SS_load_from_file(), new_str2wordseq(), new_wav2mfcc(), ngram_read_arpa(), ngram_read_bin(), opt_parse(), param_qualstr2code(), put_voca_err(), rd(), rd_header(), 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_unigram(), set_unknown_id(), setup_wav(), state_add(), state_read(), tmix_create_codebook_index(), trans_add(), 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_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(), and ttyout_pass2_end().

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_exec_command(), 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(), and msock_word_out2().

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_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_successor(), add_unigram(), adin_initialize(), adin_mic_standby(), adin_tcpip_end(), adin_thread_create(), aptree_remove_entry(), aptree_search_data(), build_wchmm2(), calc_all_unigram_factoring_values(), charconv_iconv(), check_header(), check_specs(), checkdir(), checkpath(), config_file_parse(), cpair_append(), dfa_pause_word_append(), extract_cpair(), final_fusion(), first_token(), getl_fd(), getl_sd(), hmm_add_pseudo_phones_sub(), htk_config_file_parse(), 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_record_filename(), mark_exclude_vector(), mark_word_edge(), match_successor(), max_successor_prob_iw(), mfcfilelist_nextfile(), msock_exec_command(), mycalloc(), mymalloc(), myrealloc(), new_wav2mfcc(), newnode(), next_token(), ngram_compact_bigram_context(), ngram_nextwords(), ngram_read_arpa(), ngram_read_bin(), opt_parse(), opt_terminate(), outprob_cd(), outprob_style(), print_info(), ptree_search_data(), rd_para(), 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_unigram(), setup_result_msock(), totalstatelen(), trace_backptr(), wchmm_add_word(), wchmm_link_hmm(), WeightCepstrum(), winfo_expand(), WMP_calc_init(), WMP_init(), wrt(), wt_data(), wt_dens(), wt_state(), and wt_tmix().

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().

void j_exit (  ) 

Exit the program.

Definition at line 245 of file j_printf.c.

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


Generated on Tue Dec 26 16:18:20 2006 for Julius by  doxygen 1.5.0