improve printf/warning/error on Mac OSX

This commit is contained in:
Erwin Coumans
2014-01-31 15:05:13 -08:00
parent 0cfd84c920
commit 65cfcdb9ac
2 changed files with 25 additions and 10 deletions

View File

@@ -3,16 +3,32 @@
#include "Bullet3Common/b3Logging.h"
void myerrorwarningprintf(const char* msg)
void myerrorprintf(const char* msg)
{
//OutputDebugStringA(msg);
printf(msg);
}
static bool sVerboseWarning = false;
void mywarningprintf(const char* msg)
{
if (sVerboseWarning)
{
//OutputDebugStringA(msg);
printf(msg);
}
}
static bool sVerbosePrintf=false;
void myprintf(const char* msg)
{
//OutputDebugStringA(msg);
//printf(msg);
if (sVerbosePrintf)
{
//OutputDebugStringA(msg);
printf(msg);
}
}
int gArgc=0;
@@ -30,8 +46,8 @@ int main(int argc, char **argv) {
gArgv = argv;
b3SetCustomPrintfFunc(myprintf);
b3SetCustomWarningMessageFunc(myerrorwarningprintf);
b3SetCustomErrorMessageFunc(myerrorwarningprintf);
b3SetCustomWarningMessageFunc(mywarningprintf);
b3SetCustomErrorMessageFunc(myerrorprintf);
return RUN_ALL_TESTS();
}

View File

@@ -79,21 +79,20 @@ void MyFatalBreakAPPLE( const char * errstr ,
size_t cb ,
void * user_data )
{
b3Error("Error: %s\n", errstr);
const char* patloc = strstr(errstr, "Warning");
//find out if it is a warning or error, exit if error
if (patloc)
{
b3Warning("warning\n");
b3Warning("Warning: %s\n", errstr);
} else
{
b3Error("error\n");
b3Error("Error: %s\n", errstr);
b3Assert(0);
}
}
#ifdef B3_USE_CLEW