// file: pfil_cnvd_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: convert_string_cc
//
// arguments:
//  int_4& value: (output) value of the string
//  char_1* string: (input) string of value
//
// return: a logical_1 indicating status
//
// this method converts a string into an integer
//
logical_1 Param_file::convert_string_cc(int_4& value_a, char_1* string_a) {
  
  // check arguments
  //
  if (string_a == (char_1*)NULL) {
    error_handler_cc((char_1*)"convert_string_cc",
		     (char_1*)"input string is null");
  }
  
  char_1 *tmp = (char_1*)NULL;

  static char_1 whitespace_set[] = PFIL_WHITESPACE_SET;

  value_a = strtol((char*)string_a, (char**) &tmp, 10);

  // make sure that the entire string is a long
  //
  if ((tmp != (char_1*)NULL) &&
	  (((strlen((char*)tmp) == 1) &&
	    (strchr((char*)whitespace_set, (char)*tmp) != NULL)) ||
	   ((strlen((char*)tmp) == 0)))) {
    return ISIP_TRUE;
  }

  // exit ungracefully
  //
  return ISIP_FALSE;  
}
