diff options
author | Michele Calgaro <[email protected]> | 2019-04-27 16:47:53 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2019-04-27 16:47:53 +0900 |
commit | 9bd822ca69b9b7e72ae32c9ba37d0179f7620db8 (patch) | |
tree | 98b890ffbe26e1ec55c4e714e93952213544a978 | |
parent | dc3e250c1b3ea1d26bc525c36f40082db4f36fa7 (diff) | |
download | tqt3-9bd822ca69b9b7e72ae32c9ba37d0179f7620db8.tar.gz tqt3-9bd822ca69b9b7e72ae32c9ba37d0179f7620db8.zip |
Reintroduced debug, warning and fatal functions since this are part of
R14.0.x API.
Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r-- | src/tools/qglobal.cpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/tools/qglobal.cpp b/src/tools/qglobal.cpp index ea09c3d5a..a541e7aad 100644 --- a/src/tools/qglobal.cpp +++ b/src/tools/qglobal.cpp @@ -492,6 +492,33 @@ void tqDebug( const char *msg, ... ) } } +void debug( const char *msg, ... ) +{ + char buf[QT_BUFFER_LENGTH]; + strcpy( buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii() ); + int len = strlen(buf); + va_list ap; + va_start( ap, msg ); // use variable arg list +#if defined(QT_VSNPRINTF) + QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap ); +#else + vsprintf( &buf[len], msg, ap ); +#endif + va_end( ap ); + if ( handler ) { + (*handler)( TQtDebugMsg, buf ); + } else { +#if defined(Q_CC_MWERKS) + mac_default_handler(buf); +#elif defined(Q_OS_TEMP) + TQString fstr( buf ); + OutputDebugString( (fstr + "\n").ucs2() ); +#else + fprintf( stderr, "%s\n", buf ); // add newline +#endif + } +} + void tqWarning( const char *msg, ... ) { char buf[QT_BUFFER_LENGTH]; @@ -519,6 +546,33 @@ void tqWarning( const char *msg, ... ) } } +void warning( const char *msg, ... ) +{ + char buf[QT_BUFFER_LENGTH]; + strcpy( buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii() ); + int len = strlen(buf); + va_list ap; + va_start( ap, msg ); // use variable arg list +#if defined(QT_VSNPRINTF) + QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap ); +#else + vsprintf( &buf[len], msg, ap ); +#endif + va_end( ap ); + if ( handler ) { + (*handler)( TQtWarningMsg, buf ); + } else { +#if defined(Q_CC_MWERKS) + mac_default_handler(buf); +#elif defined(Q_OS_TEMP) + TQString fstr( buf ); + OutputDebugString( (fstr + "\n").ucs2() ); +#else + fprintf( stderr, "%s\n", buf ); // add newline +#endif + } +} + void tqFatal( const char *msg, ... ) { char buf[QT_BUFFER_LENGTH]; @@ -554,6 +608,41 @@ void tqFatal( const char *msg, ... ) } } +void fatal( const char *msg, ... ) +{ + char buf[QT_BUFFER_LENGTH]; + strcpy( buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii() ); + int len = strlen(buf); + va_list ap; + va_start( ap, msg ); // use variable arg list +#if defined(QT_VSNPRINTF) + QT_VSNPRINTF( &buf[len], QT_BUFFER_LENGTH, msg, ap ); +#else + vsprintf( &buf[len], msg, ap ); +#endif + va_end( ap ); + if ( handler ) { + (*handler)( TQtFatalMsg, buf ); + } else { +#if defined(Q_CC_MWERKS) + mac_default_handler(buf); +#else + fprintf( stderr, "%s\n", buf ); // add newline +#endif +#if defined(Q_OS_UNIX) && defined(QT_DEBUG) + abort(); // trap; generates core dump +#elif defined(Q_OS_TEMP) && defined(QT_DEBUG) + TQString fstr; + fstr.sprintf( "%s:%s %s %s\n", __FILE__, __LINE__, TQT_VERSION_STR, buf ); + OutputDebugString( fstr.ucs2() ); +#elif defined(_CRT_ERROR) && defined(_DEBUG) + _CrtDbgReport( _CRT_ERROR, __FILE__, __LINE__, TQT_VERSION_STR, buf ); +#else + exit( 1 ); // goodbye cruel world +#endif + } +} + /*! \relates TQApplication |