// file: tr_wrd_phone_0.cc
//
 
// isip include files
//
#include "train_word.h"
#include "train_word_constants.h"
 
// method: set_phone_list_cc
//
// arguments: none
//  int_4** phone_list_a : (input) pointer to the list of pronunciations
//  int_4* num_phones_a : (input) number of phones in the pronunciations
//  int_4 num_prons_a : (input) number of pronunciations of word
//
// return: a logical_1 indicating status
//
// this method sets the pronunciation parameters
//
logical_1 Train_Word::set_phone_list_cc(int_4** phone_list_a, int_4* num_phones_a,
				  int_4 num_prons_a) {

  // free existing memory
  //
  if (phone_list_d != (int_4**)NULL) {
    for (int_4 i = 0; i < num_prons_d; i++) {
      delete [] phone_list_d[i]       ;
    }
    delete [] phone_list_d;
  }
  if (num_phones_d != (int_4*)NULL) {
    delete [] num_phones_d;
  }
  
  // assign the number of pronunciations
  //
  num_prons_d = num_prons_a;
  
  // copy the pronunciations
  //
  phone_list_d = new int_4*[num_prons_d];
  num_phones_d = new int_4[num_prons_d];
  for (int_4 i = 0; i < num_prons_d; i++) {
    num_phones_d[i] = num_phones_a[i];
    phone_list_d[i] = new int_4[num_phones_d[i]];
    memcpy(phone_list_d[i], phone_list_a[i], num_phones_d[i] * sizeof(int_4));
  }

  // exit gracefully
  //
  return ISIP_TRUE;
}
