#include <julius.h>
#include <stdarg.h>
Include dependency graph for module.c:
Go to the source code of this file.
Defines | |
#define | MAXBUFLEN 4096 |
Maximum line length of a message sent from a client. | |
Enumerations | |
enum | { SM_TERMINATE, SM_PAUSE, SM_WAIT } |
Switch to specify the grammar changing timing policy. | |
Functions | |
void | main_module_loop () |
Application main loop for module mode. | |
boolean | module_disconnect () |
boolean | module_is_connected () |
static boolean | msock_read_grammar (DFA_INFO **ret_dfa, WORD_INFO **ret_winfo) |
Read a recognition grammar from current module client. | |
static void | set_grammar_switch_timing_flag () |
Set flags to update global grammar. | |
void | msock_exec_command (char *command) |
Process a module command. | |
boolean | module_is_active () |
Return the process activity status. | |
boolean | module_wants_terminate () |
Return whether we currently has a request of immediate termination. | |
void | module_reset_reload () |
void | msock_process_command () |
void | msock_check_and_process_command () |
int | msock_check_in_adin () |
callback function to process module command while input detection. | |
Variables | |
static int | listen_sd = -1 |
Socket to listen to a client. | |
static char | mbuf [MAXBUFLEN] |
Work buffer for message output. | |
static boolean | process_active = TRUE |
static boolean | process_want_terminate = FALSE |
static boolean | process_want_reload = FALSE |
static short | gram_switch_input_method = SM_PAUSE |
Specify when to refresh the global lexicon while recognition. |
Definition in file module.c.
void main_module_loop | ( | ) |
Application main loop for module mode.
This function wait for a connection request from a client process, and when connected, it calls the recognition main loop for that. The established socket descriptor will be stored in the global variable "module_sd". In Win32, this process will not fork by the connection acceptance.
Definition at line 89 of file module.c.
Referenced by main().
boolean module_disconnect | ( | ) |
Disconnect the current client.
Definition at line 152 of file module.c.
Referenced by m_errexit(), m_exit(), and msock_exec_command().
boolean module_is_connected | ( | ) |
Return whether a client process has been connected.
Definition at line 172 of file module.c.
Referenced by m_errexit(), m_exit(), and msock_check_in_adin().
Read a recognition grammar from current module client.
The syntax file (.dfa) and vicabulary file (.dict) from the module client will be received in this function. The end markers that specify the end of the files are lines with only "DFAEND" and "DICEND". The received data are stored to the memory area newly allocated within this function.
The received grammar will be incorporated into the global grammar when the next updating chance has come.
ret_dfa | [out] pointer to the newly received DFA data. | |
ret_winfo | [out] pointer to the newly received dict data. |
Definition at line 219 of file module.c.
Referenced by msock_exec_command().
static void set_grammar_switch_timing_flag | ( | ) | [static] |
Set flags to update global grammar.
This function sets flags to make engine update the global grammar at the next updating chance, according to the configuration variable in gram_switch_input_method.
Definition at line 269 of file module.c.
Referenced by msock_exec_command().
void msock_exec_command | ( | char * | command | ) |
Process a module command.
This function processes command string received from module client. This will be called whenever a command arrives from a client, interrupting the main recognition process. The status responses will be performed at this function immediately. On the whole, grammar modification (add/delete/(de)activation) will not be performed here. The received data are just stored in this function, and they will be processed later by calling multigram_exec() between the recognition process.
command | [in] command string |
Definition at line 326 of file module.c.
Referenced by main_recognition_loop(), msock_check_and_process_command(), and msock_process_command().
boolean module_is_active | ( | ) |
Return the process activity status.
If TRUE, the process is currently activated, either monitoring an audio input or recognizing the current input. If FALSE, recognition is currently disabled, ignoring all the speech inputs.
Definition at line 563 of file module.c.
Referenced by adin_cut_callback_store_buffer(), and main_recognition_loop().
boolean module_wants_terminate | ( | ) |
Return whether we currently has a request of immediate termination.
This function returns whether we now has an order for immediate termination. This status will be set by receiving "TERMINATE" command from module client, or when a grammar has been received with immediate update option. This function is typically called from several recognition functions and ad-in processing function to check if we should stop the current recognition process immediately.
Definition at line 592 of file module.c.
Referenced by adin_cut_callback_store_buffer(), get_back_trellis(), main_recognition_loop(), and msock_check_in_adin().
void module_reset_reload | ( | ) |
Clear the process_want_reload flag.
Definition at line 608 of file module.c.
Referenced by main_recognition_loop().
void msock_process_command | ( | ) |
Process one commands from client module. If no command is in the buffer, it will block until next command comes.
Definition at line 626 of file module.c.
Referenced by main_recognition_loop().
void msock_check_and_process_command | ( | ) |
Process one commands from client module. If no command is in the buffer, it will return without blocking.
Definition at line 652 of file module.c.
Referenced by adin_cut_callback_store_buffer(), main_recognition_loop(), and msock_check_in_adin().
int msock_check_in_adin | ( | ) |
callback function to process module command while input detection.
This function will be called periodically from A/D-in function to check and process commands from module client. If some commands are found, it will be processed here. Also, if some termination or stop of recognition process is requested, this function returns to the caller as so.
Definition at line 707 of file module.c.
Referenced by main_recognition_loop().
boolean process_active = TRUE [static] |
Status flag indicating whether the recognition is alive or not. If TRUE, the process is currently activated, either monitoring an audio input or recognizing the current input. If FALSE, the recognition is now disabled until some activation command has been arrived from client. While disabled, all the inputs are ignored.
If set to FALSE in the program, Julius/Julian will stop after the current recognition ends, and enter the disabled status.
Definition at line 43 of file module.c.
Referenced by module_is_active(), msock_exec_command(), and set_grammar_switch_timing_flag().
boolean process_want_terminate = FALSE [static] |
If set to TRUE, Julius/Julian stops recognition immediately, terminating the currenct recognition process, and enter into disabled status.
Definition at line 50 of file module.c.
Referenced by module_wants_terminate(), msock_exec_command(), and set_grammar_switch_timing_flag().
boolean process_want_reload = FALSE [static] |
If set to TRUE, Julius/Julian stops recognition softly. If it is performing recognition of the 1st pass, it immediately segments the current input, process the 2nd pass, and output the result. Then it enters the disabled status.
Definition at line 59 of file module.c.
Referenced by module_reset_reload(), msock_check_in_adin(), msock_exec_command(), and set_grammar_switch_timing_flag().