?? mf_error.h
字號(hào):
/*============================================================================* * MF_Error.h * * Error handling codes. *============================================================================*/#include "MF.h"#if !defined(MF_ERROR_H)#define MF_ERROR_H/* Defines the directory where the compiled source is located; used in printing error messages. Each makefile has an entry LOCDIR = thedirectory and build/common includes in CCPPFLAGS -D__SDIR__='"${LOCDIR}"' which is a flag passed to the C/C++ compilers.*/#if !defined(__SDIR__)#define __SDIR__ "unknowndirectory/"#endif/* Defines the function where the compiled source is located; used in printing error messages.*/#if !defined(__FUNC__)#define __FUNC__ "unknownfunction"#endiftypedef enum {MF_ERR_RETURN, MF_ERR_EXIT, MF_ERR_USER_DEFINED} MF_ErrHandlerType;struct ErrHandlerClass{ MF_ErrHandlerType type; void (*p)(void *);}; typedef struct ErrHandlerClass *MF_ErrHandler; typedef struct ErrHandlerClass MF_ErrHandlerClass;/*----------------------------------------------------------------------------* * These are the generic error codes. The user is free to add * additional messages within the source code. *----------------------------------------------------------------------------*/#define MF_ERR_MEM 55 /* unable to allocate requested memory */#define MF_ERR_SUP 56 /* no support for requested operation */#define MF_ERR_SIG 59 /* signal received */#define MF_ERR_FP 72 /* floating point exception */#define MF_ERR_COR 74 /* corrupted MF object */#define MF_ERR_LIB 76 /* error in library called by MF */#define MF_ERR_PLIB 77 /* MF library generated inconsistent data */#define MF_ERR_MEMC 78 /* memory corruption */#define MF_ERR_DATE 90 /* invalid date generated */#define MF_ERR_ARG_SIZ 60 /* nonconforming object sizes used in operation */#define MF_ERR_ARG_IDN 61 /* two arguments not allowed to be the same */#define MF_ERR_ARG_WRONG 62 /* wrong argument (but object probably ok) */#define MF_ERR_ARG_CORRUPT 64 /* null or corrupted MF object as argument */#define MF_ERR_ARG_OUTOFRANGE 63 /* input argument, out of range */#define MF_ERR_ARG_BADPTR 68 /* invalid pointer argument */#define MF_ERR_ARG_NOTSAMETYPE 69 /* two args must be same object type */#define MF_ERR_ARG_NOTSAMECOMM 80 /* two args must be same communicators */#define MF_ERR_ARG_WRONGSTATE 73 /* object in argument is in wrong state, e.g. unassembled mat */#define MF_ERR_ARG_INCOMP 75 /* arguments are incompatible */#define MF_ERR_FILE_OPEN 65 /* unable to open file */#define MF_ERR_FILE_READ 66 /* unable to read from file */#define MF_ERR_FILE_WRITE 67 /* unable to write to file */#define MF_ERR_FILE_UNEXPECTED 79 /* unexpected data in file */#define MF_ERR_FILE_CLOSE 81 /* unable to close file */#if defined(MF_DEBUG) #define MF_ERRA(num,dum,str) {return MF_Err(__LINE__, __FUNC__, __FILE__, \ __SDIR__, num, dum, str);}#define MF_ERRA1(num,dum,str,a1) {return MF_Err(__LINE__, __FUNC__, __FILE__, \ __SDIR__, num, dum, str, a1);}#define MF_ERRA2(num,dum,str,a1,a2) {return MF_Err(__LINE__, __FUNC__, __FILE__, \ __SDIR__, num, dum, str, a1, a2);}#else#define MF_ERRA(n,p,s) ;#define MF_ERRA1(n,p,s,a1) ;#define MF_ERRA2(n,p,s,a1,a2) ;#endif#if defined(__cplusplus)#define EXTERN_C_BEGIN extern "C" {#define EXTERN_C_END }#else#define EXTERN_C_BEGIN #define EXTERN_C_END #endif/*----------------------------------------------------------------------* * Test evaluation *----------------------------------------------------------------------*/#define MF_ERROR_TEST(eval,str) {if(eval){printf("PASS test: "); \ printf(str); \ printf("\n");} \ else {printf("FAIL test "); \ printf(str); \ printf("\n\n");}}/*============================================================================* * Function prototypes *============================================================================*/extern void MF_ErrHandlerSetType(MF_ErrHandlerType type); extern void MF_ErrExit(int line, char *func, char *file, char *dir, int rc, int p, char *lbuf);extern void MF_ErrReturn(int line, char *func, char *file, char *dir, int rc, int p, char *lbuf);extern void MF_GetErrString(int rc, char **rs); #endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -