#include <errno.h>
Go to the source code of this file.
Defines | |
#define | CCP4_ERRSYSTEM(x) (((x)&0xfff)<<24) |
#define | CCP4_ERRLEVEL(x) (((x)&0xf)<<16) |
#define | CCP4_ERRSETLEVEL(y, x) ((y) & (~CCP4_ERRLEVEL(0xf)) | CCP4_ERRLEVEL(x))) |
#define | CCP4_ERRGETSYS(x) (((x)>>24)&0xfff) |
#define | CCP4_ERRGETLEVEL(x) (((x)>>16)&0xf) |
#define | CCP4_ERRGETCODE(x) ((x)&0xffff) |
#define | CCP4_ERR_SYS CCP4_ERRSYSTEM(0x0) |
#define | CCP4_ERR_FILE CCP4_ERRSYSTEM(0x1) |
#define | CCP4_ERR_COORD CCP4_ERRSYSTEM(0x2) |
#define | CCP4_ERR_MTZ CCP4_ERRSYSTEM(0x3) |
#define | CCP4_ERR_MAP CCP4_ERRSYSTEM(0x4) |
#define | CCP4_ERR_UTILS CCP4_ERRSYSTEM(0x5) |
#define | CCP4_ERR_PARS CCP4_ERRSYSTEM(0x6) |
#define | CCP4_ERR_SYM CCP4_ERRSYSTEM(0x7) |
#define | CCP4_ERR_GEN CCP4_ERRSYSTEM(0x8) |
#define | CCP4_COUNT(x) sizeof(x)/sizeof(x[0]) |
Functions | |
void | ccp4_error (const char *) |
const char * | ccp4_strerror (int) |
void | ccp4_fatal (const char *) |
int | ccp4_liberr_verbosity (int iverb) |
void | ccp4_signal (const int, const char *const, void(*)()) |
int | cfile_perror (const char *) |
Variables | |
int | ccp4_errno |
void ccp4_error | ( | const char * | msg | ) |
Print out passed message and internal message based upon ccp4_errno "message : error message "
message | (const char *) |
msg | (const char *) |
References ccp4_errno, and ccp4_strerror().
Referenced by ccp4_fatal().
void ccp4_fatal | ( | const char * | message | ) |
Wrapper for ccp4_error which also calls exit(1)
message | (const char *) |
message |
References ccp4_error().
Referenced by ccp4_file_fatal(), and ccp4_utils_isnan().
int ccp4_liberr_verbosity | ( | int | iverb | ) |
Function to set verbosity level for messages from ccp4_signal. Currently just off (0) and on (1). It should be generalised to be able to switch individual components on and off, i.e. replace 1 by a mask. cf. ccp4VerbosityLevel which sets the verbosity level for ccp4printf These are separate as they may be used differently.
iverb | If >= 0 then set the verbosity level to the value of iverb. If < 0 (by convention -1) then report current level. |
[in] | iverb | Error level |
Referenced by ccp4_signal(), ccp4uc_cells_differ(), MtzGet(), and sort_batches().
void ccp4_signal | ( | const int | code, | |
const char *const | msg, | |||
void(*)() | callback | |||
) |
Routine to set ccp4_errno and print out message for error tracing. This should be the only way in which ccp4_errno is set. See error codes above for levels and systems. A callback with prototype void function(void) may also be passed to the routine. Note: FATAL calls exit(1). If ccp4_liberr_verbosity returns 0, then ccp4_signal sets ccp4_errno and returns without doing anything else.
error | code (int) | |
message | (const char * const) | |
callback | (point to routine void (*)(void) ) |
[in] | code | error code (int) |
[in] | msg | error message |
[in] | callback | point to callback routine |
References ccp4_errno, and ccp4_liberr_verbosity().
Referenced by ccp4_cmap_get_label(), ccp4_cmap_get_mask(), ccp4_cmap_get_symop(), ccp4_cmap_open(), ccp4_cmap_read_data(), ccp4_cmap_read_row(), ccp4_cmap_read_section(), ccp4_cmap_read_section_header(), ccp4_cmap_seek_data(), ccp4_cmap_seek_row(), ccp4_cmap_seek_section(), ccp4_cmap_seek_symop(), ccp4_cmap_set_label(), ccp4_cmap_set_mask(), ccp4_cmap_set_symop(), ccp4_cmap_write_data(), ccp4_cmap_write_row(), ccp4_cmap_write_section(), ccp4_cmap_write_section_header(), ccp4_file_close(), ccp4_file_fatal(), ccp4_file_feof(), ccp4_file_itemsize(), ccp4_file_length(), ccp4_file_mode(), ccp4_file_open(), ccp4_file_open_fd(), ccp4_file_open_file(), ccp4_file_rarch(), ccp4_file_raw_read(), ccp4_file_raw_seek(), ccp4_file_raw_write(), ccp4_file_read(), ccp4_file_readchar(), ccp4_file_readcomp(), ccp4_file_readfloat(), ccp4_file_readint(), ccp4_file_readshort(), ccp4_file_readshortcomp(), ccp4_file_rewind(), ccp4_file_seek(), ccp4_file_setbyte(), ccp4_file_setmode(), ccp4_file_setstamp(), ccp4_file_tell(), ccp4_file_warch(), ccp4_file_write(), ccp4_file_writechar(), ccp4_file_writecomp(), ccp4_file_writefloat(), ccp4_file_writeint(), ccp4_file_writeshort(), ccp4_file_writeshortcomp(), ccp4_parse(), ccp4_parser(), ccp4fyp(), ccp4setenv(), ccp4spg_centric_phase(), ccp4spg_generate_indices(), ccp4spg_get_multiplicity(), ccp4spg_is_centric(), ccp4spg_is_in_asu(), ccp4spg_is_sysabs(), ccp4spg_load_spacegroup(), ccp4spg_print_centric_zones(), ccp4spg_print_epsilon_zones(), ccp4spg_print_recip_ops(), ccp4spg_put_in_asu(), ccp4spg_set_centric_zones(), ccp4spg_set_epsilon_zones(), ccp4spg_symbol_Hall(), doublefromstr(), mat4_to_symop(), MtzAddColumn(), MtzAddDataset(), MtzAddXtal(), MtzAssignColumn(), MtzGet(), MtzHklcoeffs(), MtzMalloc(), MtzMallocBatch(), MtzMallocCol(), MtzOpenForWrite(), MtzParseLabin(), MtzWrefl(), parse_mapheader(), set_fft_grid(), symop_to_mat4(), and write_mapheader().
const char* ccp4_strerror | ( | int | error | ) |
Obtain character string based upon error code. Typical use ccp4_strerror(ccp4_errno) The returned string is statically allocated in the library_err.c file and should not be freed.
error | code (int) |
error | error code (int) |
Referenced by ccp4_error(), and ccp4_file_error().
int ccp4_errno |
ccp4_errno: global variable that stores the error last error code from the ccp4 libraries | 12 bits - library | 4 bits - level | 16 bits - code |
associated macros CCP4_ERR_SYS 0 OS error CCP4_ERR_FILE 1 io library CCP4_ERR_COORD 2 mmdb CCP4_ERR_MTZ 3 cmtz CCP4_ERR_MAP 4 map io CCP4_ERR_UTILS 5 utility routines CCP4_ERR_PARS 6 parser routines CCP4_ERR_SYM 7 csymlib
and bit manipulation CCP4_ERRSYSTEM system mask for setting CCP4_ERRLEVEL error level mask CCP4_ERRSETLEVEL error level mask for setting error level CCP4_ERRGETSYS mask for returning system CCP4_ERRGETLEVEL mask for returning level CCP4_ERRGETCODE mask for returning the code
error levels 0 Success 1 Informational 2 Warning 3 Error 4 Fatal
ccp4_errno: global to store data
Referenced by ccp4_cmap_read_section_header(), ccp4_cmap_seek_data(), ccp4_cmap_write_section_header(), ccp4_error(), ccp4_signal(), ccp4_utils_setenv(), and CFile_Perror().