summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-04-27 16:54:04 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-04-27 16:54:04 +0900
commit5151555c0ecf9acbc04f8384588e7f80a174f725 (patch)
treefc87d9270eeb5c26e7b44ffb228027fadc6b2721 /src/tools
parentd17480bf1d20c0a1429bf124c159a4f70716513e (diff)
downloadqt3-5151555c0ecf9acbc04f8384588e7f80a174f725.tar.gz
qt3-5151555c0ecf9acbc04f8384588e7f80a174f725.zip
Reintroduced debug, warning and fatal functions since this are part of
R14.0.x API. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qglobal.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/tools/qglobal.cpp b/src/tools/qglobal.cpp
index 5eeb854..3f644e2 100644
--- a/src/tools/qglobal.cpp
+++ b/src/tools/qglobal.cpp
@@ -492,6 +492,33 @@ void qDebug( const char *msg, ... )
}
}
+void debug( const char *msg, ... )
+{
+ char buf[QT_BUFFER_LENGTH];
+ strcpy( buf, QDateTime::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)( QtDebugMsg, buf );
+ } else {
+#if defined(Q_CC_MWERKS)
+ mac_default_handler(buf);
+#elif defined(Q_OS_TEMP)
+ QString fstr( buf );
+ OutputDebugString( (fstr + "\n").ucs2() );
+#else
+ fprintf( stderr, "%s\n", buf ); // add newline
+#endif
+ }
+}
+
void qWarning( const char *msg, ... )
{
char buf[QT_BUFFER_LENGTH];
@@ -519,6 +546,33 @@ void qWarning( const char *msg, ... )
}
}
+void warning( const char *msg, ... )
+{
+ char buf[QT_BUFFER_LENGTH];
+ strcpy( buf, QDateTime::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)( QtWarningMsg, buf );
+ } else {
+#if defined(Q_CC_MWERKS)
+ mac_default_handler(buf);
+#elif defined(Q_OS_TEMP)
+ QString fstr( buf );
+ OutputDebugString( (fstr + "\n").ucs2() );
+#else
+ fprintf( stderr, "%s\n", buf ); // add newline
+#endif
+ }
+}
+
void qFatal( const char *msg, ... )
{
char buf[QT_BUFFER_LENGTH];
@@ -554,6 +608,41 @@ void qFatal( const char *msg, ... )
}
}
+void fatal( const char *msg, ... )
+{
+ char buf[QT_BUFFER_LENGTH];
+ strcpy( buf, QDateTime::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)( QtFatalMsg, 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)
+ QString fstr;
+ fstr.sprintf( "%s:%s %s %s\n", __FILE__, __LINE__, QT_VERSION_STR, buf );
+ OutputDebugString( fstr.ucs2() );
+#elif defined(_CRT_ERROR) && defined(_DEBUG)
+ _CrtDbgReport( _CRT_ERROR, __FILE__, __LINE__, QT_VERSION_STR, buf );
+#else
+ exit( 1 ); // goodbye cruel world
+#endif
+ }
+}
+
/*!
\relates QApplication