15 Star 25 Fork 3

eclipser / thread

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Assertx.cpp 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
Administrator 提交于 2014-01-17 16:44 . 导入断言,日志等
#include "Assertx.h"
#include <time.h>
#include <execinfo.h>
int g_Command_Assert = 0;
// 控制参数,0:会通过弹出对话框让用户选择(缺省值)
// 1:忽略
// 2:继续抛出异常用于获取运行堆栈
int g_Command_IgnoreMessageBox = false; //控制参数,跳过MyMessageBox的中断
void __show__(const char* szTemp) {
printf("Assert:%s", szTemp);
throw (1);
}
void __messagebox__(const char*msg) {
if (g_Command_IgnoreMessageBox)
return;
}
void __assert__(const char * file, uint line, const char * func, const char * expr) {
char szTemp[1024] = {0};
sprintf(szTemp, "[%s][%d][%s][%s]\n", file, line, func, expr);
__show__(szTemp);
}
void __assertex__(const char * file, uint line, const char * func, const char * expr, const char* msg) {
char szTemp[1024] = {0};
sprintf(szTemp, "[%s][%d][%s][%s]\n[%s]\n", file, line, func, expr, msg);
__show__(szTemp);
}
void __assertspecial__(const char * file, uint line, const char * func, const char * expr, const char* msg) {
char szTemp[1024] = {0};
sprintf(szTemp, "S[%s][%d][%s][%s]\n[%s]\n", file, line, func, expr, msg);
__show__(szTemp);
}
void __protocol_assert__(const char * file, uint line, const char * func, const char * expr) {
printf("[%s][%d][%s][%s]", file, line, func, expr);
}
C++
1
https://gitee.com/eclipser/thread.git
git@gitee.com:eclipser/thread.git
eclipser
thread
thread
master

搜索帮助