|
X-shooter Pipeline Reference Manual 3.8.15
|
Data Structures | |
| struct | irplib_error |
Macros | |
| #define | MAX_STRING_LENGTH 200 |
| #define | MAX_ERRORS 20 |
| #define | irplib_error_assure(CONDITION, ERROR_CODE, MSG, ACTION) |
| Generic error handling macro. | |
| #define | irplib_error_push(ec, msg) |
| Set or propagate an error. | |
| #define | irplib_error_dump(severity, trace_severity) |
| Print the error queue. | |
Functions | |
| static void | irplib_error_validate_state (const char *func, const char *file, unsigned int line) |
| Synchronize IRPLIB error state with CPL's error state. | |
| cpl_error_code | xsh_irplib_error_push_macro (const char *func, cpl_error_code ec, const char *file, unsigned int line) |
| Set or propagate an error. | |
| void | xsh_irplib_error_set_msg (const char *format,...) |
| Temporarily store an error message. | |
| void | xsh_irplib_error_reset (void) |
| Reset the error state. | |
| void | xsh_irplib_error_dump_macro (const char *func, const char *file, unsigned int line, cpl_msg_severity severity, cpl_msg_severity trace_severity) |
| Print the error queue. | |
Variables | |
| struct { | |
| irplib_error errors [MAX_ERRORS] | |
| cpl_boolean is_empty | |
| unsigned int first | |
| unsigned int last | |
| } | queue |
| static char | error_msg [MAX_STRING_LENGTH] |
| static cpl_boolean | is_initialized = CPL_FALSE |
| #define irplib_error_assure | ( | CONDITION, | |
| ERROR_CODE, | |||
| MSG, | |||
| ACTION | |||
| ) |
Generic error handling macro.
| CONDITION | The condition to check |
| ERROR_CODE | The CPL error code to set if CONDTION evaluates to false |
| MSG | A parentheses-enclosed, printf-style error message. If this is an empty string or a string consisting only of spaces, the default error message associated with the provided error code is used. |
| ACTION | A statement that is executed iff the CONDITION evaluates to false. |
This macro should not be used directly. It is defined only to allow the user to build his/her custom error handling macros.
Useful definitions might include
or (same as above, but including printf-style error messages)
or
The check macros in the examples above can be used to check a command which set the cpl_error_code in case of failure (or, by use of a comma expression, a longer sequence of such commands):
The provided ERROR_CODE, MSG and ACTION are evaluated/executed only if the CONDITION evaluates to false.
Definition at line 155 of file irplib_error.h.
| #define irplib_error_dump | ( | severity, | |
| trace_severity | |||
| ) |
Print the error queue.
| severity | The severity of the error message (usually CPL_MSG_ERROR or CPL_MSG_WARNING) |
| trace_severity | The severity of the error tracing information (e.g. CPL_MSG_ERROR, CPL_MSG_DEBUG or CPL_MSG_OFF) |
This macro prints the error queue in a format best described by example (for severity = CPL_MSG_ERROR and trace_severity = CPL_MSG_DEBUG)
Note that
Definition at line 223 of file irplib_error.h.
| #define irplib_error_push | ( | ec, | |
| msg | |||
| ) |
Set or propagate an error.
| ec | The CPL error code |
| msg | A parentheses-enclosed, printf-style error message. If this is an empty string or a string consisting only of spaces, the default error message associated with the provided error code is used. |
Definition at line 181 of file irplib_error.h.
| #define MAX_ERRORS 20 |
Definition at line 59 of file irplib_error.c.
| #define MAX_STRING_LENGTH 200 |
Definition at line 58 of file irplib_error.c.
|
static |
Synchronize IRPLIB error state with CPL's error state.
| func | Error handler was called from this function |
| file | Error handler was called from this file |
| line | Error handler was called from this linenumber |
This function
Definition at line 139 of file irplib_error.c.
References cplmessage, error_msg, errorcode, filename, function, is_initialized, linenumber, MAX_STRING_LENGTH, queue, xsh_irplib_error_push_macro(), xsh_irplib_error_reset(), and xsh_irplib_error_set_msg().
Referenced by xsh_irplib_error_dump_macro(), and xsh_irplib_error_push_macro().
| void xsh_irplib_error_dump_macro | ( | const char * | func, |
| const char * | file, | ||
| unsigned int | line, | ||
| cpl_msg_severity | severity, | ||
| cpl_msg_severity | trace_severity | ||
| ) |
Print the error queue.
| func | Caller function |
| file | Caller filename |
| line | Caller linenumber |
| severity | The error message is printed using this message level (usually CPL_MSG_ERROR or CPL_MSG_WARNING) |
| trace_severity | The error tracing information is printed using this message level (e.g. CPL_MSG_ERROR, CPL_MSG_DEBUG or CPL_MSG_OFF) |
This function should not be called directly. Use irplib_error_dump()
Definition at line 375 of file irplib_error.c.
References irplib_error_validate_state(), MAX_ERRORS, and queue.
| cpl_error_code xsh_irplib_error_push_macro | ( | const char * | func, |
| cpl_error_code | ec, | ||
| const char * | file, | ||
| unsigned int | line | ||
| ) |
Set or propagate an error.
| ec | The error code |
| file | Filename |
| func | Function name |
| line | Line number |
This function should not be called directly, use irplib_error_push() .
The function inserts an error into the (empty or non-empty) error queue, and sets the CPL error state to ec.
If the error code ec is equal to CPL_ERROR_NONE (which is not considered to be a valid error code), an error message is displayed (because it is considered a bug in the caller), and a CPL_ERROR_UNSPECIFIED is set instead.
It uses the error message previously set by irplib_error_set_msg() .
Definition at line 259 of file irplib_error.c.
References error_msg, irplib_error_validate_state(), MAX_ERRORS, MAX_STRING_LENGTH, and queue.
Referenced by irplib_error_validate_state().
| void xsh_irplib_error_reset | ( | void | ) |
Reset the error state.
This function empties the error queue and resets the current cpl_error_code to CPL_ERROR_NONE.
Definition at line 347 of file irplib_error.c.
References error_msg, is_initialized, and queue.
Referenced by irplib_error_validate_state().
| void xsh_irplib_error_set_msg | ( | const char * | format, |
| ... | |||
| ) |
Temporarily store an error message.
| format | printf-style format string |
This function stores an error message to be used later by irplib_error_push_macro() .
Neither of these functions should be called directly. Use irplib_error_push() .
Definition at line 325 of file irplib_error.c.
References error_msg, and MAX_STRING_LENGTH.
Referenced by irplib_error_validate_state().
|
static |
Definition at line 108 of file irplib_error.c.
Referenced by irplib_error_validate_state(), xsh_irplib_error_push_macro(), xsh_irplib_error_reset(), and xsh_irplib_error_set_msg().
| irplib_error { ... } ::errors[MAX_ERRORS] |
Definition at line 86 of file irplib_error.c.
| unsigned int { ... } ::first |
Definition at line 88 of file irplib_error.c.
| cpl_boolean { ... } ::is_empty |
Definition at line 87 of file irplib_error.c.
|
static |
Definition at line 115 of file irplib_error.c.
Referenced by irplib_error_validate_state(), and xsh_irplib_error_reset().
| unsigned int { ... } ::last |
Definition at line 89 of file irplib_error.c.
| struct { ... } queue |