7 #if defined(__GNUC__) && (__GNUC__ >= 6)
9 #elif defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__==0x0530)
14 #elif defined(GLib_GLIBC) || defined(GLib_BSD)
19 #elif defined(GLib_SOLARIS)
20 int _matherr(
struct __math_exception* e){
24 #elif defined(GLib_CYGWIN)
25 int matherr(
struct __exception *e){
29 #elif defined(GLib_MACOSX)
43 void WrNotify(
const char* CaptionCStr,
const char* NotifyCStr){
44 #if defined(__CONSOLE__) || defined(_CONSOLE)
45 printf(
"*** %s: %s\n", CaptionCStr, NotifyCStr);
47 MessageBox(NULL, NotifyCStr, CaptionCStr, MB_OK);
53 char* FNm=
new char[MxFNmLen];
if (FNm==NULL){
return;}
54 int FNmLen=GetModuleFileName(NULL, FNm, MxFNmLen);
if (FNmLen==0){
return;}
55 FNm[FNmLen++]=
'.'; FNm[FNmLen++]=
'E'; FNm[FNmLen++]=
'r'; FNm[FNmLen++]=
'r';
56 FNm[FNmLen++]=char(0);
57 time_t Time=time(NULL);
58 FILE* fOut=fopen(FNm,
"a+b");
if (fOut==NULL){
return;}
59 fprintf(fOut,
"--------\r\n%s\r\n%s%s\r\n--------\r\n",
60 FNm, ctime(&Time), MsgCStr);
66 void PrintBacktrace() {
75 size = backtrace(array, 20);
76 backtrace_symbols_fd(array, size, 1);
91 const char* MsgCStr,
const char* ReasonCStr,
92 const char* CondCStr,
const char* FNm,
const int& LnN){
93 char ReasonMsgCStr[1000];
101 if (ReasonCStr==NULL){ReasonMsgCStr[0]=0;}
102 else {sprintf(ReasonMsgCStr,
" [Reason:'%s']", ReasonCStr);}
104 char FullMsgCStr[1000];
107 sprintf(FullMsgCStr,
"Execution stopped%s!", ReasonMsgCStr);
109 sprintf(FullMsgCStr,
"Execution stopped: %s%s, file %s, line %d",
110 CondCStr, ReasonMsgCStr, FNm, LnN);
114 sprintf(FullMsgCStr,
"%s\nExecution stopped!", MsgCStr);
116 sprintf(FullMsgCStr,
"Message: %s%s\nExecution stopped: %s, file %s, line %d",
117 MsgCStr, ReasonMsgCStr, CondCStr, FNm, LnN);
123 #if defined(SW_NOABORT)
bool(* TOnExeStopF)(char *MsgCStr)
void ExeStop(const char *MsgCStr, const char *ReasonCStr, const char *CondCStr, const char *FNm, const int &LnN)
void ErrNotify(const char *NotifyCStr)
int _matherr(struct _exception *e)
static void Throw(const TStr &MsgStr)
void SaveToErrLog(const char *MsgCStr)
static TOnExeStopF OnExeStopF
static bool IsOnExeStopF()
void WrNotify(const char *CaptionCStr, const char *NotifyCStr)
static TOnExeStopF GetOnExeStopF()