// file: $isip/util/speech/isip_model_converter/imc_check_phone.cc
// version: $Id: imc_check_phone.cc 8977 2003-01-12 06:37:52Z jelinek $
//

// isip include files
//
#include "isip_model_converter.h"

// method: check_phone_cc
//
// arguments:
//  char_1* phone : (input) the current monophone
//  char_1** monophones : (input) list of monophones
//  int_4 num_mono : (input) the number of monophones
//
// return: a logical flag to indicate success
//
// this method checks whether the monophone is a valid monophone
//
logical_1 check_phone_cc(char_1* phone_a, char_1** monophones_a,
			 int_4 num_mono_a) {

  // local variables
  //
  // set a flag to check whether a phone exists
  //
  logical_1 phone_exists_flag = false;

  // check whether the current phone exists in the list of monophones
  //
  for(int_4 i = 0; i < num_mono_a; i++) {
    if (strcmp((char*)phone_a, (char*)monophones_a[i]) == 0) {
      phone_exists_flag = true;
      break;
    }
  }

  // check if monophone exists
  // if not exit ungracefully
  //
  if(phone_exists_flag == false) {
    fprintf(stdout, "monophone '%s' not found\n",phone_a);
    return Integral::exit();
  }

  else {
     return(true);
  }
}
