Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/wcserr_8h.html
Дата изменения: Unknown Дата индексирования: Sun Apr 10 21:16:04 2016 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п п п п п п п п п |
WCSLIB
5.15
|
Go to the source code of this file.
Data Structures | |
struct | wcserr |
Error message handling. More... | |
Macros | |
#define | WCSERR_MSG_LENGTH 160 |
#define | ERRLEN (sizeof(struct wcserr)/sizeof(int)) |
#define | WCSERR_SET(status) err, status, function, __FILE__, __LINE__ |
Fill in the contents of an error object. More... | |
Functions | |
int | wcserr_enable (int enable) |
Enable/disable error messaging. More... | |
int | wcserr_prt (const struct wcserr *err, const char *prefix) |
Print a wcserr struct. More... | |
int | wcserr_clear (struct wcserr **err) |
Clear a wcserr struct. More... | |
int | wcserr_set (struct wcserr **err, int status, const char *function, const char *file, int line_no, const char *format,...) |
Fill in the contents of an error object. More... | |
int | wcserr_copy (const struct wcserr *src, struct wcserr *dst) |
Copy an error object. More... | |
Most of the structs in WCSLIB contain a pointer to a wcserr struct as a member. Functions in WCSLIB that return an error status code can also allocate and set a detailed error message in this struct which also identifies the function, source file, and line number where the error occurred.
For example:
A number of utility functions used in managing the wcserr struct are for internal use only. They are documented here solely as an aid to understanding the code. They are not intended for external use - the API may change without notice!
#define WCSERR_MSG_LENGTH 160 |
#define ERRLEN (sizeof(struct wcserr)/sizeof(int)) |
#define WCSERR_SET | ( | status | ) | err, status, function, __FILE__, __LINE__ |
INTERNAL USE ONLY.
WCSERR_SET() is a preprocessor macro that helps to fill in the argument list of wcserr_set(). It takes status as an argument of its own and provides the name of the source file and the line number at the point where invoked. It assumes that the err and function arguments of wcserr_set() will be provided by variables of the same names.
int wcserr_enable | ( | int | enable | ) |
wcserr_enable() enables or disables wcserr error messaging. By default it is disabled.
PLEASE NOTE: This function is not thread-safe.
[in] | enable | If true (non-zero), enable error messaging, else disable it. |
int wcserr_prt | ( | const struct wcserr * | err, |
const char * | prefix | ||
) |
wcserr_prt() prints the error message (if any) contained in a wcserr struct. It uses the wcsprintf() functions.
[in] | err | The error object. If NULL, nothing is printed. |
[in] | prefix | If non-NULL, each output line will be prefixed with this string. |
int wcserr_clear | ( | struct wcserr ** | err | ) |
wcserr_clear() clears the error (if any) contained in a wcserr struct.
[in,out] | err | The error object. If NULL, nothing is done. Set to NULL on return. |
int wcserr_set | ( | struct wcserr ** | err, |
int | status, | ||
const char * | function, | ||
const char * | file, | ||
int | line_no, | ||
const char * | format, | ||
... | |||
) |
INTERNAL USE ONLY.
wcserr_set() fills a wcserr struct with information about an error.
A convenience macro, WCSERR_SET, provides the source file and line number information automatically.
[in,out] | err | Error object. If err is NULL, returns the status code given without setting an error message. If *err is NULL, allocates memory for a wcserr struct (provided that status is non-zero). |
[in] | status | Numeric status code to set. If 0, then *err will be deleted and *err will be returned as NULL. |
[in] | function | Name of the function generating the error. This must point to a constant string, i.e. in the initialized read-only data section ("data") of the executable. |
[in] | file | Name of the source file generating the error. This must point to a constant string, i.e. in the initialized read-only data section ("data") of the executable such as given by the __FILE__ preprocessor macro. |
[in] | line_no | Line number in the source file generating the error such as given by the __LINE__ preprocessor macro. |
[in] | format | Format string of the error message. May contain printf-style %-formatting codes. |
[in] | ... | The remaining variable arguments are applied (like printf) to the format string to generate the error message. |
INTERNAL USE ONLY.
wcserr_copy() copies one error object to another. Use of this function should be avoided in general since the function, source file, and line number information copied to the destination may lose its context.
[in] | src | Source error object. If src is NULL, dst is cleared. |
[out] | dst | Destination error object. If NULL, no copy is made. |