/* nag_error_name_to_code (x04ncc) Example Program. * * Copyright 2005 Numerical Algorithms Group. * * Mark 8, 2005. */ #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fpout; /* Scalars */ Integer exit_status = 0; int ierror; /* Pointers */ const char *str_error; /* Check for command-line IO options */ fpout = nag_example_file_io(argc, argv, "-results", NULL); fprintf(fpout, "nag_error_name_to_code (x04ncc) Example Program Results\n\n"); /* Print header. */ fprintf(fpout, " Error name Value Returned Value\n"); fprintf(fpout, "----------------- ----- --------------\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); fprintf(fpout, "%-17s %5d %12d\n", str_error, NE_BAD_PARAM, ierror); str_error = "NE_INCOMPAT_PARAM"; ierror = nag_error_name_to_code(str_error); fprintf(fpout, "%-17s %5d %12d\n", str_error, NE_INCOMPAT_PARAM, ierror); str_error = "NE_COMPLEX_ZERO"; ierror = nag_error_name_to_code(str_error); fprintf(fpout, "%-17s %5d %12d\n", str_error, NE_COMPLEX_ZERO, ierror); str_error = "NE_NOT_MONOTONIC"; ierror = nag_error_name_to_code(str_error); fprintf(fpout, "%-17s %5d %12d\n", str_error, NE_NOT_MONOTONIC, ierror); str_error = "NE_TOO_MANY_ITER"; ierror = nag_error_name_to_code(str_error); fprintf(fpout, "%-17s %5d %12d\n", str_error, NE_TOO_MANY_ITER, ierror); str_error = "NE_SINGULAR"; ierror = nag_error_name_to_code(str_error); fprintf(fpout, "%-17s %5d %12d\n", str_error, NE_SINGULAR, ierror); str_error = "NE_INITIALIZATION"; ierror = nag_error_name_to_code(str_error); fprintf(fpout, "%-17s %5d %12d\n", str_error, NE_INITIALIZATION, ierror); if (fpout != stdout) fclose(fpout); return exit_status; }