// file: wrd_cstr_2.cc
//
 
// isip include files
//
#include "word.h"
#include "word_constants.h"
 
// method: constructor
//
// arguments:
//  int_4 index : (input) the word index
//  char_1* name_a : (input) word name
//  int_4** phone_list_a : (input) pointer to the list of pronunciations
//  int_4* num_phones_a : (input) number of phones in each pronunciation
//  int_4 num_prons_a : (input) number of pronunciations of word
//
// return: none
//
// this is an overloaded constructor
//
Word::Word(int_4 index_a, char_1* name_a, int_4** phone_list_a,
	   int_4* num_phones_a, int_4 num_prons_a) {

  // set the word index
  //
  index_d = index_a;

  // set the word name
  //
  name_d = new char_1[strlen((char*)name_a) + (int_4)1];
  strcpy((char*)name_d, (char*)name_a);
  
  // assign the number of pronunciations
  //
  num_prons_d = num_prons_a;
  
  // copy the pronunciations if any
  //
  if (num_prons_d > (int_4)0) {
    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));
    }
  }
  else {
    num_phones_d = (int_4*)NULL;
    phone_list_d = (int_4**)NULL;
  }

  // set the status flag
  //
  active_d = ISIP_FALSE;
  
  // exit gracefully
  //
}
