speech-dispatcher: Functions for use when talking to synthesizer

 
 5.2.7.5 Functions for use when talking to synthesizer
 .....................................................
 
  -- Module Utils function: static int module_get_message_part ( const
           char* message, char* part, unsigned int *pos, size_t maxlen,
           const char* dividers)
 
      Gets a part of the 'message' according to the specified 'dividers'.
 
      It scans the text in 'message' from the byte specified by '*pos'
      and looks for one of the characters specified in 'dividers'
      followed by a whitespace character or the terminating NULL byte.
      If one of them is encountered, the read text is stored in 'part'
      and the number of bytes read is returned.  If end of 'message' is
      reached, the return value is -1.
 
      'message' is the text to process.  It must be a NULL-terminated
      uni-byte string.
 
      'part' is a pointer to the place where the output text should be
      stored.  It must contain at least 'maxlen' bytes of space.
 
      'maxlen' is the maximum number of bytes that should be written to
      'part'.
 
      'dividers' is a NULL-terminated uni-byte string containing the
      punctuation characters where the message should be divided into
      smaller parts (if they are followed by whitespace).
 
      After returning, 'pos' is the position where the function
      terminated in processing 'message'.
 
  -- Output module function: void module_report_index_mark(char *mark)
  -- Output module function: void module_report_event_*()
 
      The 'module_report_' functions serve for reporting event
      notifications and index marking events.  You should use them
      whenever you get an event from the synthesizer which is defined in
      the output module communication protocol.
 
      Note that you cannot call these functions from within a call to
      module_speak(), module_stop(), or module_pause().  The best way to
      do this is to emit the events from another thread.
 
  -- Output module function: int module_close(void)
 
      This function is called when Speech Dispatcher terminates.  The
      output module should terminate all threads and processes, free all
      resources, close all sockets etc.  Never assume this function is
      called only when Speech Dispatcher terminates and exit(0) will do
      the work for you.  It's perfectly ok for Speech Dispatcher to load,
      unload or reload output modules in the middle of its run.