// file: pfil_set_0.cc
//

// system include files
//
#include <stdlib.h>
#include <string.h>

// isip include files
//
#include "param_file.h"
#include "param_file_constants.h"
#include <integral_constants.h>

// method: set_cc
//
// arguments:
//  char_1* param: (input) parameter string
//  char_1* value: (input) value string
//
// return: a logical_1 indicating status
//
// this method sets a given parameter (param) to the value in a string
//
logical_1 Param_file::set_cc(char_1* param_a, char_1* value_a) {
  
  if (num_params_d >= PFIL_MAX_NUM_PARAMS) {
    error_handler_cc((char_1*)"set_cc",
		     (char_1*)"too many paramaters");
    return ISIP_FALSE;
  }

  if (num_params_d == 0) {
    if (params_d == (char_1**)NULL) {
      params_d = new char_1*[PFIL_MAX_NUM_PARAMS];
    }
    if (values_d == (char_1**)NULL) {
      values_d = new char_1*[PFIL_MAX_NUM_PARAMS];
    }
  } else {
    if ((params_d == (char_1**)NULL) || (values_d == (char_1**)NULL)) {
      error_handler_cc((char_1*)"set_cc",
		       (char_1*)"arrays not declared, but they should be");
      return ISIP_FALSE;
    }
  }
  
  params_d[num_params_d] = new char_1[strlen((char*)param_a) + 1];
  strcpy((char*)params_d[num_params_d], (char*)param_a);
	 
  values_d[num_params_d] = new char_1[strlen((char*)value_a) + 1];
  strcpy((char*)values_d[num_params_d], (char*)value_a) ;
  
  num_params_d++;
  
  // exit gracefully
  //
  return ISIP_TRUE;  
}
