// file: $isip/util/demo/isip_comm_server_dialog_nlp/isip_comm_dialog_nlp.h
// version: $Id: isip_comm_dialog_nlp.h 10100 2005-05-20 18:47:19Z elliott $
//

/*************************************************************************
 *                                                                       * 
 *                Center for Speech and Language Research		 *
 *                   University of Colorado, Boulder                     *
 *                       Copyright (c) 1999,2000                         *
 *                        All Rights Reserved.                           *
 *                                                                       *
 *  The University of Colorado ("CU") hereby grants to you an            *
 *  irrevocable, nonexclusive, nontransferable, perpetual, royalty-free  *
 *  and worldwide license to use this source code solely for educational,*
 *  research, personal use, or evaluation.  Limitations of Use are       *
 *  described below.  A commercial license can be obtained only through  *
 *  expressed written permission of The Center for Speech and Language   *
 *  Research, University of Colorado at Boulder.			 *
 *									 *
 *  	Non-Commercial License Limitations and Use Requirements		 *
 *									 *
 *  Limitations on Use: The License is limited to noncommercial use.     *
 *  Noncommercial use relates only to educational, research, personal    *
 *  use, or evaluation purposes.  Any other use is commercial use.  You  *
 *  may not use the Software in connection with any business activities. *
 *  You may distribute and/or allow others to use a) the Software or b)  *
 *  the applications you create with the Software only if each new user  *
 *  is bound by the provisions of this Agreement.			 *
 *									 *
 *  Conditions of Use: This work is furnished to you under the following *
 *  conditions:								 *
 *									 *
 *   1. The code must retain the above copyright notice, this list of    *
 *      conditions and the following disclaimer.                         *
 *   2. Any modifications must be clearly marked as such.                *
 *   3. Original authors' names are not deleted.                         *
 *   4. The authors' names are not used to endorse or promote products   *
 *      derived from this software without specific prior written        *
 *      permission.                                                      *
 *   5. You agree to acknowledge CU-Boulder's Center for Speech and      *
 *      Language Reseach with appropriate citations in any publication or*
 *      presentation containing research results obtained in whole or in *
 *      part through the use of the Software.				 *
 *									 *
 *  Term of License: The License is effective upon receipt by you of the *
 *  Software and shall continue until terminated.  The License will      *
 *  terminate immediately without notice by CU if you fail to comply     *
 *  with the terms and conditions of this Agreement.  Upon termination   *
 *  of this License, you shall immediately discontinue all use of the    *
 *  Software provided hereunder, and return to CU or destroy the         *
 *  original and all copies of all such Software.  All of your           *
 *  obligations under this Agreement shall survive the termination of    *
 *  the License.							 *
 *									 *
 *  DISCLAIMER:                                                          *
 *                                                                       *
 *  THE UNIVERSITY OF COLORADO AND THE CONTRIBUTORS TO THIS WORK         *
 *  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      *
 *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   *
 *  SHALL THE UNIVERSITY OF COLORADO NOR THE CONTRIBUTORS BE LIABLE      *
 *  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    *
 *  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   *
 *  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          *
 *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       *
 *  THIS SOFTWARE.                                                       *
 *                                                                       *
 *************************************************************************/
/*-----------------------------------------------------------------------*
 *                                                                       *
 *		     CU Communicator Phoenix Server		         * 
 *                                                                       *
 *                                                                       *
 *   Wayne Ward (whw@cslu.colorado.edu)                              	 *
 *   Center for Spoken Language Understanding				 *
 *   University of Colorado at Boulder					 *
 *   (c) 1999 All Rights Reserved					 *
 *                                                                       *
 *-----------------------------------------------------------------------*/


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <malloc.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <strings.h>

#include <parse.h>
#include <pconf.h>
#include <globals_parse.h>

#include "parse_conf.h"

#define GET_PROCESS_ID       0
#define WAIT_FOR_TEXT        5
#define WAIT_FOR_TEXT_ACK    6
#define PROCESSING_TEXT      10

//#define INITIAL_STATE        GET_PROCESS_ID
#define INITIAL_STATE        WAIT_FOR_TEXT

#define SERVER_NAME_STRING "dialog nlp"

extern "C" {
#include <galaxy/galaxy_all.h>
#define SERVER_FUNCTIONS_INCLUDE "isip_comm_dialog_nlp_server.h"
#define USE_SERVER_DATA
#include <galaxy/server_functions.h>
}

void	strip_line(char *line);

extern char *grammar_file;
extern char *dict_file;
extern char *frames_file;
extern char *priority_file;
extern char *grammar_file;

static char	outbuf[10000];

int server_state_d;

/*-----------------------------------------------------------------------*
 * Command-line options							 * 
 *-----------------------------------------------------------------------*/

static char *oas[] = {
  "-config <filename>", "use a configuration file for Phoenix", NULL,
  "-dir <directory/>", "a directory to use for data", NULL,
  NULL
};

