// file: tr_mm_grow_2.cc
//
 
// isip include files
//
#include "train_memory_manager.h"
#include "train_memory_manager_constants.h"

#include <train_lex_node.h>

// method: grow_lex_cc
//
// arguments: none
//
// return: a logical_1 indicating success
//
// this method grows the number of empty lex nodes by the lex node
// grow size
//
logical_1 Train_Memory_manager::grow_lex_cc() {

  // create new empty lex nodes
  //
  Train_Link_node* lnd = (Train_Link_node*)NULL;
  
  // insert the lex nodes in a list
  //
  for (int_4 i = 0; i < lex_grow_size_d; i++) {
    Train_Lex_node* lex = new Train_Lex_node;
    lnd = new_node_cc();
    lnd->set_item_cc((void_p)lex);
    if ((i == (int_4)0) && (lex_count_d == (int_4)0)) {
      lex_list_d = lnd;
    }
    else {
      lex_list_d->insert_cc(lnd);
    }
    lex++;
  }
  
  // update the count of free lexs
  //
  lex_count_d += lex_grow_size_d;

  // exit gracefully
  //
  return ISIP_TRUE;
}
