Example description
/* nag_error_name_to_code (x04ncc) Example Program.
 *
 * Copyright 2017 Numerical Algorithms Group.
 *
 * Mark 26.2, 2017.
 */

#include <stdio.h>
#include <nag.h>
#include <nag_stdlib.h>
#include <nag_string.h>
#include <nagx04.h>

int main(void)
{
  /* Scalars */
  Integer exit_status = 0;
  int ierror;
  /* Pointers */
  const char *str_error;

  printf("nag_error_name_to_code (x04ncc) Example Program Results\n\n");

  /* Print header. */
  printf("   Error name     Value Returned Value\n");
  printf("----------------- ----- --------------\n");

  /* Convert the error strings to values and print. */

  str_error = "NE_BAD_PARAM";
  /* nag_error_name_to_code (x04ncc).
   * Converts NAG error name to its code value
   */
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_BAD_PARAM, ierror);

  str_error = "NE_INCOMPAT_PARAM";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_INCOMPAT_PARAM, ierror);

  str_error = "NE_COMPLEX_ZERO";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_COMPLEX_ZERO, ierror);

  str_error = "NE_NOT_MONOTONIC";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_NOT_MONOTONIC, ierror);

  str_error = "NE_TOO_MANY_ITER";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_TOO_MANY_ITER, ierror);

  str_error = "NE_SINGULAR";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_SINGULAR, ierror);

  str_error = "NE_INITIALIZATION";
  ierror = nag_error_name_to_code(str_error);
  printf("%-17s %5d %12d\n", str_error, NE_INITIALIZATION, ierror);

  return exit_status;
}