ferror 1.4.1
FERROR is a library to assist with error handling in Fortran projects.
|
#include <stdbool.h>
Go to the source code of this file.
Classes | |
struct | error_handler |
A C compatible type encapsulating an errors object. More... | |
Typedefs | |
typedef void(* | error_callback) (void *args) |
Describes a function to call when an error is encountered. More... | |
Functions | |
void | alloc_error_handler (error_handler *obj) |
Initializes a new error handler object. More... | |
void | free_error_handler (error_handler *obj) |
Frees resources held by the error_handler object. More... | |
void | get_log_filename (const error_handler *err, char *fname, int *nfname) |
Gets the name of the error log file. More... | |
void | set_log_filename (error_handler *err, const char *fname) |
Sets the error log filename. More... | |
void | report_error (error_handler *err, const char *fcn, const char *msg, int flag) |
Reports an error condition to the user. More... | |
void | report_warning (error_handler *err, const char *fcn, const char *msg, int flag) |
Reports a warning condition to the user. More... | |
void | log_error (const error_handler *err, const char *fcn, const char *msg, int flag) |
Writes an error log file. More... | |
bool | has_error_occurred (const error_handler *err) |
Tests to see if an error has been encountered. More... | |
void | reset_error_status (error_handler *err) |
Resets the error status flag to false, and the current error flag to zero. More... | |
bool | has_warning_occurred (const error_handler *err) |
Tests to see if a warning has been encountered. More... | |
void | reset_warning_status (error_handler *err) |
Resets the warning status flag to false, and the current warning flag to zero. More... | |
int | get_error_flag (const error_handler *err) |
Gets the current error flag. More... | |
int | get_warning_flag (const error_handler *err) |
Gets the current warning flag. More... | |
bool | get_exit_on_error (const error_handler *err) |
Gets a logical value determining if the application should be terminated when an error is encountered. More... | |
void | set_exit_on_error (error_handler *err, bool x) |
Sets a logical value determining if the application should be terminated when an error is encountered. More... | |
bool | get_suppress_printing (const error_handler *err) |
Gets a logical value determining if printing of error and warning messages should be suppressed. More... | |
void | set_suppress_printing (error_handler *err, bool x) |
Sets a logical value determining if printing of error and warning messages should be suppressed. More... | |
void | get_error_message (const error_handler *err, char *msg, int *nmsg) |
Gets the current error message. More... | |
void | get_warning_message (const error_handler *err, char *msg, int *nmsg) |
Gets the current warning message. More... | |
void | get_error_fcn_name (const error_handler *err, char *fname, int *nfname) |
Gets the name of the function or subroutine that issued the last error message. More... | |
void | get_warning_fcn_name (const error_handler *err, char *fname, int *nfname) |
Gets the name of the function or subroutine that issued the last warning message. More... | |
void | report_error_with_callback (error_handler *err, const char *fname, const char *msg, int flag, error_callback cback, void *args) |
Reports an error condition to the user, and executes a callback routine. More... | |
typedef void(* error_callback) (void *args) |
void alloc_error_handler | ( | error_handler * | obj | ) |
Initializes a new error handler object.
obj | The error_handler object to allocate. |
void free_error_handler | ( | error_handler * | obj | ) |
Frees resources held by the error_handler object.
obj | The error_handler object. |
void get_error_fcn_name | ( | const error_handler * | err, |
char * | fname, | ||
int * | nfname | ||
) |
Gets the name of the function or subroutine that issued the last error message.
err | The error_handler object. |
fname | A character buffer where the name will be written. |
nfname | On input, the actual size of the buffer. On output, the actual number of characters written to fname (not including the null character). |
int get_error_flag | ( | const error_handler * | err | ) |
void get_error_message | ( | const error_handler * | err, |
char * | msg, | ||
int * | nmsg | ||
) |
Gets the current error message.
err | The error_handler object. |
msg | A character buffer where the message will be written. |
nmsg | On input, the actual size of the buffer. On output, the actual number of characters written to msg (not including the null character). |
bool get_exit_on_error | ( | const error_handler * | err | ) |
Gets a logical value determining if the application should be terminated when an error is encountered.
err | The error_handler object. |
void get_log_filename | ( | const error_handler * | err, |
char * | fname, | ||
int * | nfname | ||
) |
Gets the name of the error log file.
err | The error_handler object. |
fname | A character buffer where the filename will be written. It is recommended that this be in the neighborhood of 256 elements. |
nfname | On input, the actual size of the buffer. Be sure to leave room for the null terminator character. On output, the actual numbers of characters written to fname (not including the null character). |
bool get_suppress_printing | ( | const error_handler * | err | ) |
Gets a logical value determining if printing of error and warning messages should be suppressed.
err | The error_handler object. |
void get_warning_fcn_name | ( | const error_handler * | err, |
char * | fname, | ||
int * | nfname | ||
) |
Gets the name of the function or subroutine that issued the last warning message.
err | The error_handler object. |
fname | A character buffer where the name will be written. |
nfname | On input, the actual size of the buffer. On output, the actual number of characters written to fname (not including the null character). |
int get_warning_flag | ( | const error_handler * | err | ) |
Gets the current warning flag.
err | The error_handler object. |
void get_warning_message | ( | const error_handler * | err, |
char * | msg, | ||
int * | nmsg | ||
) |
Gets the current warning message.
err | The error_handler object. |
msg | A character buffer where the message will be written. |
nmsg | On input, the actual size of the buffer. On output, the actual number of characters written to msg (not including the null character). |
bool has_error_occurred | ( | const error_handler * | err | ) |
Tests to see if an error has been encountered.
err | The error_handler object. |
bool has_warning_occurred | ( | const error_handler * | err | ) |
Tests to see if a warning has been encountered.
err | The error_handler object. |
void log_error | ( | const error_handler * | err, |
const char * | fcn, | ||
const char * | msg, | ||
int | flag | ||
) |
Writes an error log file.
err | The error_handler object. |
fcn | The name of the function or subroutine in which the error was encountered. |
msg | The error message. |
flag | The error flag. |
void report_error | ( | error_handler * | err, |
const char * | fcn, | ||
const char * | msg, | ||
int | flag | ||
) |
Reports an error condition to the user.
err | The error_handler object. |
fcn | The name of the function or subroutine in which the error was encountered. |
msg | The error message. |
flag | The error flag. |
void report_error_with_callback | ( | error_handler * | err, |
const char * | fname, | ||
const char * | msg, | ||
int | flag, | ||
error_callback | cback, | ||
void * | args | ||
) |
Reports an error condition to the user, and executes a callback routine.
err | A pointer to the error handler object. |
fname | The name of the function or subroutine in which the error was encountered. |
msg | The error message. |
flag | The error flag. |
cback | A pointer to the callback function. |
args | A pointer to an object to pass to the callback function. |
void report_warning | ( | error_handler * | err, |
const char * | fcn, | ||
const char * | msg, | ||
int | flag | ||
) |
Reports a warning condition to the user.
err | The error_handler object. |
fcn | The name of the function or subroutine in which the warning was encountered. |
msg | The warning message. |
flag | The warning flag. |
void reset_error_status | ( | error_handler * | err | ) |
Resets the error status flag to false, and the current error flag to zero.
err | The error_handler object. |
void reset_warning_status | ( | error_handler * | err | ) |
Resets the warning status flag to false, and the current warning flag to zero.
err | The error_handler object. |
void set_exit_on_error | ( | error_handler * | err, |
bool | x | ||
) |
Sets a logical value determining if the application should be terminated when an error is encountered.
err | A pointer to the error handler object. |
[x] | in Set to true if the application should be terminated when an error is reported; else, false. |
void set_log_filename | ( | error_handler * | err, |
const char * | fname | ||
) |
Sets the error log filename.
err | The error_handler object. |
fname | A null-terminated string containing the filename. |
void set_suppress_printing | ( | error_handler * | err, |
bool | x | ||
) |
Sets a logical value determining if printing of error and warning messages should be suppressed.
err | The error_handler object. |
x | Set to true if message printing should be suppressed; else, false to allow printing. |