[rkward-cvs] SF.net SVN: rkward:[4473] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Nov 30 09:46:38 UTC 2012


Revision: 4473
          http://rkward.svn.sourceforge.net/rkward/?rev=4473&view=rev
Author:   tfry
Date:     2012-11-30 09:46:37 +0000 (Fri, 30 Nov 2012)
Log Message:
-----------
Replace RK_DO (qDebug (...)) with a dedicated macro.
The idea is that this will allow to separate RKWard specific debug messages from Qt / kdelibs noise.
This info could then be made available in a special tool window (esp. for use while debugging plugins).

Most of this commit is automatic replacements using:
  sed -i 's/RK_DO\s*(qDebug\s*(\(.*\)),\s*\([^,]*\),\([^,]*\));/RK_DEBUG \(\2,\3, \1\);/g' *.cpp

Modified Paths:
--------------
    trunk/rkward/rkward/agents/rkprintagent.cpp
    trunk/rkward/rkward/core/rcontainerobject.cpp
    trunk/rkward/rkward/core/robject.cpp
    trunk/rkward/rkward/core/robjectlist.cpp
    trunk/rkward/rkward/dataeditor/rktextmatrix.cpp
    trunk/rkward/rkward/debug.h
    trunk/rkward/rkward/dialogs/startupdialog.cpp
    trunk/rkward/rkward/main.cpp
    trunk/rkward/rkward/misc/rkxmlguisyncer.cpp
    trunk/rkward/rkward/misc/xmlhelper.cpp
    trunk/rkward/rkward/plugin/rkabstractoptionselector.cpp
    trunk/rkward/rkward/plugin/rkcomponent.cpp
    trunk/rkward/rkward/plugin/rkcomponentcontext.cpp
    trunk/rkward/rkward/plugin/rkcomponentmap.cpp
    trunk/rkward/rkward/plugin/rkcomponentproperties.cpp
    trunk/rkward/rkward/plugin/rkformula.cpp
    trunk/rkward/rkward/plugin/rkoptionset.cpp
    trunk/rkward/rkward/plugin/rkpluginframe.cpp
    trunk/rkward/rkward/plugin/rkpreviewbox.cpp
    trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
    trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
    trunk/rkward/rkward/plugin/rkvarselector.cpp
    trunk/rkward/rkward/plugin/rkvarslot.cpp
    trunk/rkward/rkward/rbackend/rcommand.cpp
    trunk/rkward/rkward/rbackend/rdata.cpp
    trunk/rkward/rkward/rbackend/rinterface.cpp
    trunk/rkward/rkward/rbackend/rkbackendtransmitter.cpp
    trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp
    trunk/rkward/rkward/rbackend/rkrbackend.cpp
    trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp
    trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp
    trunk/rkward/rkward/rbackend/rkstructuregetter.cpp
    trunk/rkward/rkward/rbackend/rktransmitter.cpp
    trunk/rkward/rkward/rkconsole.cpp
    trunk/rkward/rkward/scriptbackends/qtscriptbackend.cpp
    trunk/rkward/rkward/scriptbackends/scriptbackend.cpp
    trunk/rkward/rkward/windows/rkcallstackviewer.cpp
    trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
    trunk/rkward/rkward/windows/rkfilebrowser.cpp
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp
    trunk/rkward/rkward/windows/rkwindowcatcher.cpp
    trunk/rkward/rkward/windows/rkworkplace.cpp
    trunk/rkward/rkward/windows/rkworkplaceview.cpp
    trunk/rkward/rkward/windows/robjectbrowser.cpp

Modified: trunk/rkward/rkward/agents/rkprintagent.cpp
===================================================================
--- trunk/rkward/rkward/agents/rkprintagent.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/agents/rkprintagent.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -46,7 +46,7 @@
 
 	KService::Ptr service = KService::serviceByDesktopPath ("okular_part.desktop");
 	if (!service) service = KService::serviceByDesktopPath ("kpdf_part.desktop");
-	if (!service) RK_DO (qDebug ("No KDE service found for postscript printing"), APP, DL_WARNING);
+	if (!service) RK_DEBUG (APP, DL_WARNING, "No KDE service found for postscript printing");
 
 	KParts::ReadOnlyPart *provider = service->createInstance<KParts::ReadOnlyPart> (0);
 	QAction *printaction = 0;
@@ -59,14 +59,14 @@
 			if (ok) printaction = a;
 		}
 		if (!(printaction && provider->openUrl (KUrl::fromLocalFile (file)))) {
-			RK_DO (qDebug ("No print action in postscript provider"), APP, DL_WARNING);
+			RK_DEBUG (APP, DL_WARNING, "No print action in postscript provider");
 			delete provider;
 			provider = 0;
 		}
 	}
 
 	if (!provider) {
-		RK_DO (qDebug ("No valid postscript postscript provider was found"), APP, DL_WARNING);
+		RK_DEBUG (APP, DL_WARNING, "No valid postscript postscript provider was found");
 		KMessageBox::sorry (RKWardMainWindow::getMain (), i18n ("No service was found to provide a KDE print dialog for postscript files. We will try to open a generic postscript viewer (if any), instead.<br><br>Consider installing 'okular', or configure RKWard not to attempt to print using a KDE print dialog."), i18n ("Unable to open KDE print dialog"));
 		// fallback: If we can't find a proper part, try to invoke a standalone PS reader, instead
 		KRun::runUrl (KUrl::fromLocalFile (file), "appication/postscript", RKWardMainWindow::getMain ());

Modified: trunk/rkward/rkward/core/rcontainerobject.cpp
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/core/rcontainerobject.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -57,7 +57,7 @@
 	} else {
 		if (just_created) {
 			RK_ASSERT (false);
-			RK_DO (qDebug ("%s cannot be represented", child->getFullName ().toLatin1 ().data ()), OBJECTS, DL_ERROR);
+			RK_DEBUG (OBJECTS, DL_ERROR, "%s cannot be represented", child->getFullName ().toLatin1 ().data ());
 			delete child;
 			return 0;
 		} else {
@@ -120,7 +120,7 @@
 	} else if (child_type & RObject::Variable) {
 		child_object = new RKVariable (this, child_name);
 	} else {
-		RK_DO (qDebug ("Can't represent object '%s', type %d", child_name.toLatin1 ().data (), child_type), OBJECTS, DL_WARNING);
+		RK_DEBUG (OBJECTS, DL_WARNING, "Can't represent object '%s', type %d", child_name.toLatin1 ().data (), child_type);
 		return 0;
 	}
 	RK_ASSERT (child_object);
@@ -183,7 +183,7 @@
 			if (old_child->isPending ()) {
 				new_childmap.insert (i, old_child);
 			} else {
-				RK_DO (qDebug ("child no longer present: %s.", old_child->getFullName ().toLatin1 ().data ()), OBJECTS, DL_DEBUG);
+				RK_DEBUG (OBJECTS, DL_DEBUG, "child no longer present: %s.", old_child->getFullName ().toLatin1 ().data ());
 				if (RKGlobals::tracker ()->removeObject (old_child, 0, true)) --i;
 				else (new_childmap.insert (i, old_child));
 			}
@@ -203,7 +203,7 @@
 
 	RK_ASSERT (from_index != to_index);
 
-	RK_DO (qDebug ("Child position changed from %d to %d, %s", from_index, to_index, child->getFullName ().toLatin1 ().data ()), OBJECTS, DL_DEBUG);
+	RK_DEBUG (OBJECTS, DL_DEBUG, "Child position changed from %d to %d, %s", from_index, to_index, child->getFullName ().toLatin1 ().data ());
 
 	RK_ASSERT (childmap[from_index] == child);
 	RK_ASSERT (from_index < childmap.size ());

Modified: trunk/rkward/rkward/core/robject.cpp
===================================================================
--- trunk/rkward/rkward/core/robject.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/core/robject.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -255,7 +255,7 @@
 
 	if (command->getFlags () == ROBJECT_UDPATE_STRUCTURE_COMMAND) {
 		if (command->failed ()) {
-			RK_DO (qDebug ("command failed while trying to update object '%s'. No longer present?", getShortName ().toLatin1 ().data ()), OBJECTS, DL_INFO);
+			RK_DEBUG (OBJECTS, DL_INFO, "command failed while trying to update object '%s'. No longer present?", getShortName ().toLatin1 ().data ());
 			// this may happen, if the object has been removed in the workspace in between
 			RKGlobals::tracker ()->removeObject (this, 0, true);
 			return;
@@ -678,7 +678,7 @@
 		}
 	}
 	if (!fragment.isEmpty ()) ret.append (fragment);
-	RK_DO (qDebug ("parsed object path %s into %s", qPrintable (path), qPrintable (ret.join ("-"))), OBJECTS, DL_DEBUG);
+	RK_DEBUG (OBJECTS, DL_DEBUG, "parsed object path %s into %s", qPrintable (path), qPrintable (ret.join ("-")));
 	return ret;
 }
 

Modified: trunk/rkward/rkward/core/robjectlist.cpp
===================================================================
--- trunk/rkward/rkward/core/robjectlist.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/core/robjectlist.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -96,7 +96,7 @@
 	if (update_chain) {
 		// gee, looks like another update is still on the way. lets schedule one for later:
 		update_timer->start (UPDATE_DELAY_INTERVAL);
-		RK_DO (qDebug ("another object-list update is already running. Rescheduling a further update for later"), OBJECTS, DL_DEBUG);
+		RK_DEBUG (OBJECTS, DL_DEBUG, "another object-list update is already running. Rescheduling a further update for later");
 		return;
 	}
 
@@ -114,7 +114,7 @@
 	if (update_chain) {
 		// gee, looks like another update is still on the way. lets schedule one for later:
 		update_timer->start (UPDATE_DELAY_INTERVAL);
-		RK_DO (qDebug ("another object-list update is already running. Rescheduling a further update for later"), OBJECTS, DL_DEBUG);
+		RK_DEBUG (OBJECTS, DL_DEBUG, "another object-list update is already running. Rescheduling a further update for later");
 		return;
 	}
 
@@ -142,7 +142,7 @@
 		RKGlobals::rInterface ()->closeChain (update_chain);
 		update_chain = 0;
 	
-		RK_DO (qDebug ("object list update complete"), OBJECTS, DL_DEBUG);
+		RK_DEBUG (OBJECTS, DL_DEBUG, "object list update complete");
 		emit (updateComplete ());
 	} else {
 		RK_ASSERT (false);
@@ -182,7 +182,7 @@
 		int new_pos = newchildmap.indexOf (obj);
 		
 		if (new_pos < 0) {	// environment is gone
-			RK_DO (qDebug ("removing toplevel environment %s from list", obj->getShortName ().toLatin1 ().data ()), OBJECTS, DL_INFO);
+			RK_DEBUG (OBJECTS, DL_INFO, "removing toplevel environment %s from list", obj->getShortName ().toLatin1 ().data ());
 			if (RKGlobals::tracker ()->removeObject (obj, 0, true)) --i;
 			else (newchildmap.insert (i, obj));
 		} else if (new_pos != i) {

Modified: trunk/rkward/rkward/dataeditor/rktextmatrix.cpp
===================================================================
--- trunk/rkward/rkward/dataeditor/rktextmatrix.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/dataeditor/rktextmatrix.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -49,10 +49,10 @@
 	// treated the same. We should however encourage external senders to
 	// provided the two in order.
 	if (data->hasFormat ("text/tab-separated-values")) {
-		RK_DO (qDebug ("paste tsv"), EDITOR, DL_DEBUG);
+		RK_DEBUG (EDITOR, DL_DEBUG, "paste tsv");
 		return (matrixFromSeparatedValues (QString::fromLocal8Bit (data->data ("text/tab-separated-values"))));
 	} else if (data->hasText ()) {
-		RK_DO (qDebug ("paste plain text"), EDITOR, DL_DEBUG);
+		RK_DEBUG (EDITOR, DL_DEBUG, "paste plain text");
 		return (matrixFromSeparatedValues (data->text ()));
 	}
 

Modified: trunk/rkward/rkward/debug.h
===================================================================
--- trunk/rkward/rkward/debug.h	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/debug.h	2012-11-30 09:46:37 UTC (rev 4473)
@@ -20,6 +20,7 @@
 extern int RK_Debug_Level;
 extern int RK_Debug_Flags;
 extern int RK_Debug_CommandStep;
+extern void RKDebug (int flags, int level, const char *fmt, ...);
 
 // Debug-levels
 #define DL_TRACE 0
@@ -47,6 +48,7 @@
 #ifdef RKWARD_DEBUG
 // Debug functions 
 #	define RK_DO(expr,flags,level) if ((flags & RK_Debug_Flags) && (level >= RK_Debug_Level)) { expr; }
+#	define RK_DEBUG(flags,level,...) { if ((flags & RK_Debug_Flags) && (level >= RK_Debug_Level)) RKDebug (flags,level,__VA_ARGS__); }
 #	define RK_ASSERT(x) if (!(x)) qDebug ("Assert failed at %s - function %s line %d", __FILE__, __FUNCTION__, __LINE__);
 #	ifndef RKWARD_NO_TRACE
 #		define RK_TRACE(flags) RK_DO (qDebug ("Trace: %s - function %s line %d", __FILE__, __FUNCTION__, __LINE__), flags, DL_TRACE);
@@ -55,6 +57,7 @@
 #	endif
 #else
 #	define RK_DO(expr,flags,level)
+#	define RK_DEBUG(flags,level,fmt,...)
 #	define RK_ASSERT(x)
 #	define RK_TRACE(flags)
 #endif

Modified: trunk/rkward/rkward/dialogs/startupdialog.cpp
===================================================================
--- trunk/rkward/rkward/dialogs/startupdialog.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/dialogs/startupdialog.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -197,7 +197,7 @@
 	dialog->exec ();
 	delete dialog;
 	
-	RK_DO (qDebug ("startup-dialog result: %d, url: %s", result.result, qPrintable (result.open_url.url ())), DIALOGS, DL_DEBUG);
+	RK_DEBUG (DIALOGS, DL_DEBUG, "startup-dialog result: %d, url: %s", result.result, qPrintable (result.open_url.url ()));
 	
 	return result;
 }

Modified: trunk/rkward/rkward/main.cpp
===================================================================
--- trunk/rkward/rkward/main.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/main.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -94,6 +94,22 @@
 	RK_Debug_Mutex.unlock ();
 }
 
+/** The point of this redirect (to be called via the RK_DEBUG() macro) is to separate RKWard specific debug messages from
+ * any other noise, coming from Qt / kdelibs. Also it allows us to retain info on flags and level. Eventually, this could
+ * be made available in a tool window, esp. for debugging plugins. */
+void RKDebug (int flags, int level, const char *fmt, ...) {
+	Q_UNUSED (flags);
+	Q_UNUSED (level);
+	const int bufsize = 1024*8;
+	char buffer[bufsize];
+
+	va_list ap;
+	va_start (ap, fmt);
+	vsnprintf (buffer, bufsize-1, fmt, ap);
+	va_end (ap);
+	RKDebugMessageOutput (QtDebugMsg, buffer);
+}
+
 int main(int argc, char *argv[]) {
 /* #ifdef Q_WS_X11
 	This (along with the proper includes, of course) makes library (gWidgetsRGtk2) work on X11 on some systems.
@@ -144,7 +160,7 @@
 	RK_Debug_Level = DL_FATAL - QString (args->getOption ("debug-level")).toInt ();
 	RK_Debug_Flags = QString (args->getOption ("debug-flags")).toInt ();
 	if (!args->getOption ("debugger").isEmpty ()) {
-		RK_DO (qDebug ("--debugger option should have been handled by wrapper script. Ignoring."), ALL, DL_ERROR);
+		RK_DEBUG (ALL, DL_ERROR, "--debugger option should have been handled by wrapper script. Ignoring.");
 	}
 
 	RKWardStartupOptions *stoptions = new RKWardStartupOptions;
@@ -158,7 +174,7 @@
 	RKSettingsModuleDebug::debug_file = new QTemporaryFile (QDir::tempPath () + "/rkward.frontend");
 	RKSettingsModuleDebug::debug_file->setAutoRemove (false);
 	if (RKSettingsModuleDebug::debug_file->open ()) {
-		RK_DO (qDebug ("Full debug output is at %s", qPrintable (RKSettingsModuleDebug::debug_file->fileName ())), APP, DL_INFO);
+		RK_DEBUG (APP, DL_INFO, "Full debug output is at %s", qPrintable (RKSettingsModuleDebug::debug_file->fileName ()));
 		qInstallMsgHandler (RKDebugMessageOutput);
 	}
 

Modified: trunk/rkward/rkward/misc/rkxmlguisyncer.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkxmlguisyncer.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/misc/rkxmlguisyncer.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -94,7 +94,7 @@
 		}
 		RK_ASSERT (client->localXMLFile () == path);
 		client->reloadXML ();
-		RK_DO (qDebug ("reloaded client %p for file %s", client, qPrintable (path)), MISC, DL_DEBUG);
+		RK_DEBUG (MISC, DL_DEBUG, "reloaded client %p for file %s", client, qPrintable (path));
 		if (client->factory ()) {
 			affected_factories.insert (client->factory ());
 			connect (client->factory (), SIGNAL (destroyed(QObject*)), this, SLOT (guiFactoryDestroyed(QObject*)));
@@ -120,7 +120,7 @@
 		KXMLGUIFactory *factory = *(affected_factories.begin ());
 		affected_factories.remove (factory);
 
-		RK_DO (qDebug ("rebuilding factory %p", factory), MISC, DL_DEBUG);
+		RK_DEBUG (MISC, DL_DEBUG, "rebuilding factory %p", factory);
 		QList<KXMLGUIClient*> clients = factory->clients ();
 		for (int i = clients.size () - 1; i >= 0; --i) {
 			factory->removeClient (clients[i]);
@@ -132,7 +132,7 @@
 				clients[i]->actionCollection ()->readSettings();
 			}
 		}
-		RK_DO (qDebug ("done rebuilding factory"), MISC, DL_DEBUG);
+		RK_DEBUG (MISC, DL_DEBUG, "done rebuilding factory");
 	}
 }
 
@@ -157,7 +157,7 @@
 		notifier->deleteLater ();
 	}
 
-	RK_DO (qDebug ("action collection destroyed. Still watch %d clients with %d notifiers", client_map.size (), notifier_map.size ()), MISC, DL_DEBUG);
+	RK_DEBUG (MISC, DL_DEBUG, "action collection destroyed. Still watch %d clients with %d notifiers", client_map.size (), notifier_map.size ());
 }
 
 void RKXMLGUISyncerPrivate::guiFactoryDestroyed (QObject *object) {

Modified: trunk/rkward/rkward/misc/xmlhelper.cpp
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/misc/xmlhelper.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -349,7 +349,7 @@
 
 		backtrace += list.join ("->");
 
-		RK_DO (qDebug ("%s: %s", backtrace.toLatin1 ().data (), message.toLatin1 ().data ()), XML, message_level);
+		RK_DEBUG (XML, message_level, "%s: %s", backtrace.toLatin1 ().data (), message.toLatin1 ().data ());
 	}
 }
 

Modified: trunk/rkward/rkward/plugin/rkabstractoptionselector.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkabstractoptionselector.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkabstractoptionselector.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -89,7 +89,7 @@
 
 		QString mod = identifier.section (".", 1);
 		if (mod != "enabled") {
-			RK_DO (qDebug ("options do not have property '%s'", mod.toLatin1().data ()), PLUGIN, DL_DEBUG);
+			RK_DEBUG (PLUGIN, DL_DEBUG, "options do not have property '%s'", mod.toLatin1().data ());
 			return this;
 		}
 
@@ -118,11 +118,11 @@
 		RK_ASSERT (false);
 	}
 	if (new_id < 0) {
-		RK_DO (qDebug ("option selector '%s' has no such option:", qPrintable (getIdInParent ())), PLUGIN, DL_ERROR);
+		RK_DEBUG (PLUGIN, DL_ERROR, "option selector '%s' has no such option:", qPrintable (getIdInParent ()));
 		if (property == string) {
-			RK_DO (qDebug ("'%s'", qPrintable (fetchStringValue (string))), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "'%s'", qPrintable (fetchStringValue (string)));
 		} else {
-			RK_DO (qDebug ("index %d", number->intValue ()), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "index %d", number->intValue ());
 		}
 		return;
 	}
@@ -169,7 +169,7 @@
 				}
 			}
 			if (settable_opt >= 0) itemSelected (settable_opt);
-			else RK_DO (qDebug ("No option left enabled. Disable the entire component '%s', instead!", qPrintable (getIdInParent ())), PLUGIN, DL_ERROR);
+			else RK_DEBUG (PLUGIN, DL_ERROR, "No option left enabled. Disable the entire component '%s', instead!", qPrintable (getIdInParent ()));
 		}
 	}
 

Modified: trunk/rkward/rkward/plugin/rkcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkcomponent.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -29,7 +29,7 @@
 	RK_ASSERT (remainder);
 
 	if (identifier.isEmpty ()) return this;
-	RK_DO (qDebug ("looking up '%s'", identifier.toLatin1 ().data ()), PLUGIN, DL_DEBUG);
+	RK_DEBUG (PLUGIN, DL_DEBUG, "looking up '%s'", identifier.toLatin1 ().data ());
 
 	RKComponentBase *child = child_map.value (identifier.section (".", 0, 0));
 	if (!child) {	// if we do not have such a child, return this (and set remainder)
@@ -75,11 +75,11 @@
 		if (mod.isEmpty () && prop->isProperty ()) {		// found a property
 			RKComponentPropertyBase* p = static_cast<RKComponentPropertyBase*>(prop);
 			if (p->isInternal () && warn) {
-				RK_DO (qDebug ("Setting value for property %s, which is marked internal.", qPrintable (it.key ())), PLUGIN, DL_WARNING);
+				RK_DEBUG (PLUGIN, DL_WARNING, "Setting value for property %s, which is marked internal.", qPrintable (it.key ()));
 			}
 			p->setValue (it.value ());
 		} else {
-			if (warn) RK_DO (qDebug ("Property %s not found while setting values. Remainder was %s.", qPrintable (it.key ()), qPrintable (mod)), PLUGIN, DL_WARNING);
+			if (warn) RK_DEBUG (PLUGIN, DL_WARNING, "Property %s not found while setting values. Remainder was %s.", qPrintable (it.key ()), qPrintable (mod));
 		}
 	}
 }
@@ -185,12 +185,12 @@
 		if (hint == BooleanValue) {
 			bool ok;
 			return (RKComponentPropertyBool::variantToBool (val, &ok));
-			if (!ok) RK_DO (qDebug ("Could not convert value of %s to boolean", qPrintable (id)), PLUGIN, DL_WARNING);
+			if (!ok) RK_DEBUG (PLUGIN, DL_WARNING, "Could not convert value of %s to boolean", qPrintable (id));
 		} else {
 			if (hint == StringlistValue) {
-				if (val.type () != QVariant::StringList) RK_DO (qDebug ("Value of %s is not a string list", qPrintable (id)), PLUGIN, DL_WARNING);
+				if (val.type () != QVariant::StringList) RK_DEBUG (PLUGIN, DL_WARNING, "Value of %s is not a string list", qPrintable (id));
 			} else if (hint == NumericValue) {
-				if (!val.canConvert (QVariant::Double)) RK_DO (qDebug ("Value of %s is not numeric", qPrintable (id)), PLUGIN, DL_WARNING);
+				if (!val.canConvert (QVariant::Double)) RK_DEBUG (PLUGIN, DL_WARNING, "Value of %s is not numeric", qPrintable (id));
 			} else {
 				RK_ASSERT (false);
 			}
@@ -202,7 +202,7 @@
 QVariant RKComponentBase::value (const QString &modifier) {
 	RK_TRACE (PLUGIN);
 
-	RK_DO (qDebug ("Component type %d does not have a value. Remaining modifier is: '%s'", type (), modifier.toLatin1 ().data ()), PLUGIN, DL_WARNING);
+	RK_DEBUG (PLUGIN, DL_WARNING, "Component type %d does not have a value. Remaining modifier is: '%s'", type (), modifier.toLatin1 ().data ());
 	return QVariant ();
 }
 
@@ -223,7 +223,7 @@
 	if (isComponent () && static_cast<RKComponent*>(this)->isInactive ()) req = false;
 	if (!req) return Satisfied;
 	if (children_satisfied && isValid ()) return Satisfied;
- 	if (isComponent ()) RK_DO (qDebug ("component not satisfied: %s", qPrintable (static_cast<RKComponent*> (this)->getIdInParent ())), PLUGIN, DL_DEBUG);
+ 	if (isComponent ()) RK_DEBUG (PLUGIN, DL_DEBUG, "component not satisfied: %s", qPrintable (static_cast<RKComponent*> (this)->getIdInParent ()));
 	return Unsatisfied;
 }
 

Modified: trunk/rkward/rkward/plugin/rkcomponentcontext.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentcontext.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkcomponentcontext.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -120,7 +120,7 @@
 
 			RK_ASSERT (it.value ()->isProperty ());
 			if (!(client && remainder.isEmpty () && client->isProperty () && it.value ()->isProperty ())) {
-				RK_DO (qDebug ("Could not set context property %s", id.toLatin1 ().data ()), PLUGIN, DL_INFO);
+				RK_DEBUG (PLUGIN, DL_INFO, "Could not set context property %s", id.toLatin1 ().data ());
 				continue;
 			}
 

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -119,7 +119,7 @@
 
 		RKComponentHandle* handle = RKComponentMap::getComponentHandle (id);
 		if ((!handle) || (!handle->isPlugin ())) {
-			RK_DO (qDebug ("No such component found while creating menu-entries or component is not a standalone plugin: \"%s\". No entry created.", id.toLatin1 ().data ()), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "No such component found while creating menu-entries or component is not a standalone plugin: \"%s\". No entry created.", id.toLatin1 ().data ());
 		} else {
 			findOrCreateElement (menu_element, "Action", id, QString::null, xml->getIntAttribute ((*it), "index", -1, DL_INFO));
 			addedEntry (id, handle);
@@ -188,7 +188,7 @@
 	RKContextMap *context = getMap ()->getContextLocal (id);
 	if (context) return context;
 
-	RK_DO (qDebug ("no such context %s", id.toLatin1 ().data ()), PLUGIN, DL_WARNING);
+	RK_DEBUG (PLUGIN, DL_WARNING, "no such context %s", id.toLatin1 ().data ());
 	return (0);
 }
 
@@ -205,7 +205,7 @@
 	RKComponentHandle *handle = getMap ()->getComponentHandleLocal (id);
 	if (handle) return handle;
 
-	RK_DO (qDebug ("no such component %s", id.toLatin1 ().data ()), PLUGIN, DL_WARNING);
+	RK_DEBUG (PLUGIN, DL_WARNING, "no such component %s", id.toLatin1 ().data ());
 	return (0);
 }
 
@@ -289,7 +289,7 @@
 	QStringList problems = component->matchAgainstState (state);
 	if (!problems.isEmpty ()) {
 		_message = i18n ("Not all specified settings could be applied. Most likely this is because some R objects are no longer present in your current workspace.");
-		RK_DO (qDebug ("%s", qPrintable (problems.join ("\n"))), PLUGIN, DL_WARNING);	// TODO: make failures available to backend
+		RK_DEBUG (PLUGIN, DL_WARNING, "%s", qPrintable (problems.join ("\n")));	// TODO: make failures available to backend
 		if (message) *message = _message;
 		else KMessageBox::informationList (component, _message, problems, i18n ("Not all settings applied"));
 		// TODO: Don't show again-box?
@@ -325,7 +325,7 @@
 
 	QString plugin_map_file_abs = QFileInfo (plugin_map_file).absoluteFilePath ();
 	if (pluginmapfiles.contains (plugin_map_file_abs)) {
-		RK_DO (qDebug ("Plugin map file '%s' already loaded", plugin_map_file.toLatin1().data ()), PLUGIN, DL_INFO);
+		RK_DEBUG (PLUGIN, DL_INFO, "Plugin map file '%s' already loaded", plugin_map_file.toLatin1().data ());
 		return 0;
 	}
 
@@ -351,7 +351,7 @@
 		if (QFileInfo (file).isReadable ()) {
 			includelist.append (file);
 		} else {
-			RK_DO (qDebug ("Specified required file '%s' does not exist or is not readable. Ignoring.", file.toLatin1 ().data ()), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "Specified required file '%s' does not exist or is not readable. Ignoring.", file.toLatin1 ().data ());
 		}
 	}
 	for (QStringList::const_iterator it = includelist.constBegin (); it != includelist.constEnd (); ++it) {
@@ -369,9 +369,9 @@
 		QString label = xml->getStringAttribute ((*it), "label", i18n ("(no label)"), DL_WARNING);
 
 		if (components.contains (id)) {
-			RK_DO (qDebug ("RKComponentMap already contains a component with id \"%s\". Ignoring second entry.", id.toLatin1 ().data ()), PLUGIN, DL_WARNING);
+			RK_DEBUG (PLUGIN, DL_WARNING, "RKComponentMap already contains a component with id \"%s\". Ignoring second entry.", id.toLatin1 ().data ());
 		} else if (!QFileInfo (pluginmap_file_desc->makeFileName (filename)).isReadable ()) {
-			RK_DO (qDebug ("Specified file '%s' for component id \"%s\" does not exist or is not readable. Ignoring.", filename.toLatin1 ().data (), id.toLatin1 ().data ()), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "Specified file '%s' for component id \"%s\" does not exist or is not readable. Ignoring.", filename.toLatin1 ().data (), id.toLatin1 ().data ());
 		} else {
 			// create and initialize component handle
 			RKComponentHandle *handle = new RKComponentHandle (pluginmap_file_desc, filename, label, (RKComponentType) type);

Modified: trunk/rkward/rkward/plugin/rkcomponentproperties.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentproperties.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkcomponentproperties.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -148,7 +148,7 @@
 
 void RKComponentPropertyBase::warnModifierNotRecognized (const QString &modifier) {
 	RK_TRACE (PLUGIN);
-	RK_DO (qDebug ("Modifier '%s' not recognized.", modifier.toLatin1 (). data ()), PLUGIN, DL_ERROR);
+	RK_DEBUG (PLUGIN, DL_ERROR, "Modifier '%s' not recognized.", modifier.toLatin1 (). data ());
 }
 
 
@@ -398,7 +398,7 @@
 
 	validator->setBottom (lower);
 	if (default_value < lower) {
-		RK_DO (qDebug ("default value in integer property is lower than lower boundary"), PLUGIN, DL_DEBUG);	// actually this is ok. In this case the default is simply "invalid"
+		RK_DEBUG (PLUGIN, DL_DEBUG, "default value in integer property is lower than lower boundary");	// actually this is ok. In this case the default is simply "invalid"
 	}
 	if (current_value < lower) {
 		setIntValue (lower);
@@ -410,7 +410,7 @@
 
 	validator->setTop (upper);
 	if (default_value > upper) {
-		RK_DO (qDebug ("default value in integer property is larger than upper boundary"), PLUGIN, DL_DEBUG);	// see above
+		RK_DEBUG (PLUGIN, DL_DEBUG, "default value in integer property is larger than upper boundary");	// see above
 	}
 	if (current_value > upper) {
 		setIntValue (upper);
@@ -557,7 +557,7 @@
 
 	validator->setBottom (lower);
 	if (default_value < lower) {
-		RK_DO (qDebug ("default value in double property is lower than lower boundary"), PLUGIN, DL_DEBUG);	// actually this is ok. In this case the default is simply "invalid"
+		RK_DEBUG (PLUGIN, DL_DEBUG, "default value in double property is lower than lower boundary");	// actually this is ok. In this case the default is simply "invalid"
 	}
 	if (current_value < lower) {
 		setDoubleValue (lower);
@@ -569,7 +569,7 @@
 
 	validator->setTop (upper);
 	if (default_value > upper) {
-		RK_DO (qDebug ("default value in double property is larger than upper boundary"), PLUGIN, DL_DEBUG);	// see above
+		RK_DEBUG (PLUGIN, DL_DEBUG, "default value in double property is larger than upper boundary");	// see above
 	}
 	if (current_value > upper) {
 		setDoubleValue (upper);
@@ -956,7 +956,7 @@
 				if (ogov->dims <= 0) {
 					ogov->dims = dims;
 				} else if (ogov->dims != dims) {
-					RK_DO (qDebug ("Could not reconcile dimensionality in RObject properties"), PLUGIN, DL_WARNING);
+					RK_DEBUG (PLUGIN, DL_WARNING, "Could not reconcile dimensionality in RObject properties");
 				}
 			}
 			if (ogov->min_length < min_length) {
@@ -993,7 +993,7 @@
 						}
 					}
 					if (ogov->classes.isEmpty ()) {
-						RK_DO (qDebug ("Incompatible class filters for RObject properties"), PLUGIN, DL_WARNING);
+						RK_DEBUG (PLUGIN, DL_WARNING, "Incompatible class filters for RObject properties");
 						ogov->classes = classes;
 					}
 				}
@@ -1013,7 +1013,7 @@
 						}
 					}
 					if (ogov->types.isEmpty ()) {
-						RK_DO (qDebug ("Incompatible type filters for RObject properties"), PLUGIN, DL_WARNING);
+						RK_DEBUG (PLUGIN, DL_WARNING, "Incompatible type filters for RObject properties");
 						ogov->types = types;
 					}
 				}
@@ -1163,7 +1163,7 @@
 			sources.append (s);
 			connect (s.property, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (sourcePropertyChanged (RKComponentPropertyBase *)));
 		} else {
-			RK_DO (qDebug ("Not found or not a property: %s", (*it).toLatin1 ().data ()), PLUGIN, DL_WARNING);
+			RK_DEBUG (PLUGIN, DL_WARNING, "Not found or not a property: %s", (*it).toLatin1 ().data ());
 		}
 	}
 
@@ -1214,7 +1214,7 @@
 				double val = source.property->value (source.modifier).toDouble (&ok);
 				if (!ok) {
 					val = min;
-					RK_DO (qDebug ("Non-numeric property in convert sources, cannot check range"), PLUGIN, DL_WARNING);
+					RK_DEBUG (PLUGIN, DL_WARNING, "Non-numeric property in convert sources, cannot check range");
 				}
 
 				if ((min > val) || (max < val)) {
@@ -1231,7 +1231,7 @@
 						return;
 					}
 				} else {
-					RK_DO (qDebug ("Non-boolean property in convert sources, cannot check AND"), PLUGIN, DL_WARNING);
+					RK_DEBUG (PLUGIN, DL_WARNING, "Non-boolean property in convert sources, cannot check AND");
 				}
 				break;
 			} case Or: {
@@ -1243,7 +1243,7 @@
 						return;
 					}
 				} else {
-					RK_DO (qDebug ("Non-boolean property in convert sources, cannot check OR"), PLUGIN, DL_WARNING);
+					RK_DEBUG (PLUGIN, DL_WARNING, "Non-boolean property in convert sources, cannot check OR");
 				}
 				break;
 			}

Modified: trunk/rkward/rkward/plugin/rkformula.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkformula.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkformula.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -295,7 +295,7 @@
 	for (int i = 0; i < interactions.count (); ++i) {
 		QString dummy;
 		for (int j=0; j <= interactions[i].level; ++j) {
-			RK_DO (qDebug ("inserting interaction %d, level %d", i, j), PLUGIN, DL_DEBUG);
+			RK_DEBUG (PLUGIN, DL_DEBUG, "inserting interaction %d, level %d", i, j);
 			if (j) {
 				dummy.append (" X ");
 			}
@@ -314,7 +314,7 @@
 
 QList<RKFormula::Interaction> RKFormula::makeInteractions (int level, RObject::ObjectList source_vars) {
 	RK_TRACE (PLUGIN);
-	RK_DO (qDebug ("makeInteractions: level %d, source_count %d", level, source_vars.count ()), PLUGIN, DL_DEBUG);
+	RK_DEBUG (PLUGIN, DL_DEBUG, "makeInteractions: level %d, source_count %d", level, source_vars.count ());
 	RK_ASSERT (level >= 0);
 
 	QList<Interaction> ret;
@@ -387,7 +387,7 @@
 		int found_vars = 0;
 		for (int i=0; i <= inter.level; ++i) {
 			for (ItemMap::const_iterator item = predictors_map.constBegin (); item != predictors_map.constEnd (); ++item) {
-				RK_DO (qDebug ("level %d", i), PLUGIN, DL_DEBUG);
+				RK_DEBUG (PLUGIN, DL_DEBUG, "level %d", i);
 				if (item.value () == inter.vars[i]) {
 					++found_vars;
 					break;

Modified: trunk/rkward/rkward/plugin/rkoptionset.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkoptionset.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkoptionset.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -97,7 +97,7 @@
 		bool external = xml->getBoolAttribute (e, "external", false, DL_INFO);
 
 		while (child_map.contains (id)) {
-			RK_DO (qDebug ("optionset already contains a property named %s. Renaming to _%s", qPrintable (id), qPrintable (id)), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "optionset already contains a property named %s. Renaming to _%s", qPrintable (id), qPrintable (id));
 			id = "_" + id;
 		}
 
@@ -129,10 +129,10 @@
 	if (!keycol.isEmpty ()) {
 		keycolumn = static_cast<RKComponentPropertyStringList*> (child_map.value (keycol));
 		if (!column_map.contains (keycolumn)) {
-			RK_DO (qDebug ("optionset does not contain an optioncolumn named %s. Falling back to manual insertion mode", qPrintable (keycol)), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "optionset does not contain an optioncolumn named %s. Falling back to manual insertion mode", qPrintable (keycol));
 			keycolumn = 0;
 		} else if (!column_map[keycolumn].external) {
-			RK_DO (qDebug ("keycolumn (%s) is not marked as external. Falling back to manual insertion mode", qPrintable (keycol)), PLUGIN, DL_ERROR);
+			RK_DEBUG (PLUGIN, DL_ERROR, "keycolumn (%s) is not marked as external. Falling back to manual insertion mode", qPrintable (keycol));
 			keycolumn = 0;
 		} else {
 			updating = true;
@@ -152,14 +152,14 @@
 				RKComponentPropertyBase *gov_prop = static_cast<RKComponentPropertyBase*> (governor);
 				if (ci.external) {
 					if (!ci.governor_modifier.isEmpty ()) {
-						RK_DO (qDebug ("Cannot connect external column '%s' in optionset to property with modifier (%s).", qPrintable (ci.column_name), qPrintable (ci.governor)), PLUGIN, DL_ERROR);
+						RK_DEBUG (PLUGIN, DL_ERROR, "Cannot connect external column '%s' in optionset to property with modifier (%s).", qPrintable (ci.column_name), qPrintable (ci.governor));
 						continue;
 					}
 				}
 				columns_to_update.insertMulti (gov_prop, it.key ());
 				connect (gov_prop, SIGNAL (valueChanged(RKComponentPropertyBase *)), this, SLOT (governingPropertyChanged(RKComponentPropertyBase *)));
 			} else {
-				RK_DO (qDebug ("did not find governing property %s for column %s of optionset", qPrintable (ci.governor), qPrintable (ci.column_name)), PLUGIN, DL_ERROR);
+				RK_DEBUG (PLUGIN, DL_ERROR, "did not find governing property %s for column %s of optionset", qPrintable (ci.governor), qPrintable (ci.column_name));
 			}
 		}
 	}
@@ -170,7 +170,7 @@
 		const QDomElement &e = properties.at (i);
 		QString id = xml->getStringAttribute (e, "id", QString (), DL_ERROR);
 		if (contents_container->child_map.contains (id)) {
-			RK_DO (qDebug ("Id %s already in use. Skipping property declaration", qPrintable (id)), PLUGIN, DL_WARNING);
+			RK_DEBUG (PLUGIN, DL_WARNING, "Id %s already in use. Skipping property declaration", qPrintable (id));
 			continue;
 		}
 		RKComponentPropertyBase *prop = new RKComponentPropertyBase (contents_container, false);
@@ -218,7 +218,7 @@
 	layout->addWidget (box);
 
 	if (display) {
-		RK_DO (qDebug ("cannot create more than one optiondisplay per optionset"), PLUGIN, DL_ERROR);
+		RK_DEBUG (PLUGIN, DL_ERROR, "cannot create more than one optiondisplay per optionset");
 	} else {
 		display = new QTreeView (box);
 		display_show_index = show_index;
@@ -329,7 +329,7 @@
 		const QString &item = items[i];
 		int sep = item.indexOf ('=');
 		if (sep < 0) {
-			RK_DO (qDebug ("Bad format while trying to de-serialize optionset, line %d", i), PLUGIN, DL_WARNING);
+			RK_DEBUG (PLUGIN, DL_WARNING, "Bad format while trying to de-serialize optionset, line %d", i);
 			continue;
 		}
 		QString tag = item.left (sep);
@@ -337,7 +337,7 @@
 
 		if (tag == QLatin1String ("keys")) {
 			if (!keys_missing) {
-				RK_DO (qDebug ("Unexpected specification of keys while trying to de-serialize optionset, line %d", i), PLUGIN, DL_WARNING);
+				RK_DEBUG (PLUGIN, DL_WARNING, "Unexpected specification of keys while trying to de-serialize optionset, line %d", i);
 				continue;
 			}
 			old_keys = unserializeList (value);
@@ -346,7 +346,7 @@
 			new_rows.append (RowInfo (unserializeMap (value)));
 			++row;
 		} else {
-			RK_DO (qDebug ("Unexpected tag %s while trying to de-serialize optionset, line %d", qPrintable (tag), i), PLUGIN, DL_WARNING);
+			RK_DEBUG (PLUGIN, DL_WARNING, "Unexpected tag %s while trying to de-serialize optionset, line %d", qPrintable (tag), i);
 			continue;
 		}
 	}
@@ -570,7 +570,7 @@
 	RK_ASSERT (column_map.contains (target));
 	ColumnInfo& ci = column_map[target];
 	if (!ci.external) {
-		RK_DO (qDebug ("Column %s was touched externally, although it is not marked as external", qPrintable (ci.column_name)), PLUGIN, DL_ERROR);
+		RK_DEBUG (PLUGIN, DL_ERROR, "Column %s was touched externally, although it is not marked as external", qPrintable (ci.column_name));
 		return;
 	}
 
@@ -698,7 +698,7 @@
 
 		static_cast<RKComponentPropertyBase*> (governor)->setValue (value);
 	} else {
-		RK_DO (qDebug ("Lookup error while trying to restore row %d of optionset: %s. Remainder: %s", row, qPrintable (ci.governor), qPrintable (dummy)), PLUGIN, DL_WARNING);
+		RK_DEBUG (PLUGIN, DL_WARNING, "Lookup error while trying to restore row %d of optionset: %s. Remainder: %s", row, qPrintable (ci.governor), qPrintable (dummy));
 		RK_ASSERT (false);
 	}
 	updating = false;

Modified: trunk/rkward/rkward/plugin/rkpluginframe.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkpluginframe.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkpluginframe.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -57,7 +57,7 @@
 	RK_TRACE (PLUGIN);
 	RK_ASSERT (!checked);
 	if (!frame->isCheckable ()) {
-		RK_DO (qDebug ("This frame does not have a property 'checked', as it is not checkable"), PLUGIN, DL_DEBUG);
+		RK_DEBUG (PLUGIN, DL_DEBUG, "This frame does not have a property 'checked', as it is not checkable");
 		return;
 	}
 

Modified: trunk/rkward/rkward/plugin/rkpreviewbox.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkpreviewbox.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkpreviewbox.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -68,7 +68,7 @@
 		code_property = static_cast<RKComponentPropertyCode *> (cp);
 		connect (code_property, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (changedCode (RKComponentPropertyBase *)));
 	} else {
-		RK_DO (qDebug ("Could not find code property in preview box (remainder: %s)", dummy.toLatin1().data ()), PLUGIN, DL_WARNING);
+		RK_DEBUG (PLUGIN, DL_WARNING, "Could not find code property in preview box (remainder: %s)", dummy.toLatin1().data ());
 		code_property = 0;
 	}
 

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -765,7 +765,7 @@
 	XMLHelper *xml = XMLHelper::getStaticHelper ();
 
 	for (ConnectionList::const_iterator it = connection_list.constBegin (); it != connection_list.constEnd (); ++it) {
-		RK_DO (qDebug ("Connecting '%s' to '%s'", (*it).client_property.toLatin1 ().data (), (*it).governor_property.toLatin1 ().data ()), PLUGIN, DL_DEBUG);
+		RK_DEBUG (PLUGIN, DL_DEBUG, "Connecting '%s' to '%s'", (*it).client_property.toLatin1 ().data (), (*it).governor_property.toLatin1 ().data ());
 
 		QString dummy;
 		RKComponentBase *client = parent->lookupComponent ((*it).client_property, &dummy);

Modified: trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -264,7 +264,7 @@
 
 	if (!code_property->isValid ()) {
 		code_display->setText (i18n ("Processing. Please wait"));
-		RK_DO (qDebug ("code not ready to be displayed: pre %d, cal %d, pri %d", !code_property->preprocess ().isNull (), !code_property->calculate ().isNull (), !code_property->printout ().isNull ()), PLUGIN, DL_DEBUG);
+		RK_DEBUG (PLUGIN, DL_DEBUG, "code not ready to be displayed: pre %d, cal %d, pri %d", !code_property->preprocess ().isNull (), !code_property->calculate ().isNull (), !code_property->printout ().isNull ());
 		was_valid = false;
 	} else {
 		code_display->setText ("local({\n" + code_property->preprocess () + code_property->calculate () + code_property->printout () + "})\n");

Modified: trunk/rkward/rkward/plugin/rkvarselector.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkvarselector.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkvarselector.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -69,7 +69,7 @@
 	RK_TRACE (PLUGIN);
 
 	selected->setObjectList (list_view->selectedObjects ());
-	RK_DO (qDebug ("selected in varselector: %s", qPrintable (fetchStringValue (selected))), PLUGIN, DL_DEBUG);
+	RK_DEBUG (PLUGIN, DL_DEBUG, "selected in varselector: %s", qPrintable (fetchStringValue (selected)));
 }
 
 #include "rkvarselector.moc"

Modified: trunk/rkward/rkward/plugin/rkvarslot.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkvarslot.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/plugin/rkvarslot.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -128,7 +128,7 @@
 	list->clear ();
 	item_map.clear ();
 
-	RK_DO (qDebug ("contained in varslot: %s", qPrintable (fetchStringValue (available))), PLUGIN, DL_DEBUG);
+	RK_DEBUG (PLUGIN, DL_DEBUG, "contained in varslot: %s", qPrintable (fetchStringValue (available)));
 
 	RObject::ObjectList objlist = available->objectList ();
 	for (int i = 0; i < objlist.count (); ++i) {
@@ -171,7 +171,7 @@
 void RKVarSlot::selectPressed () {
 	RK_TRACE (PLUGIN);
 
-	RK_DO (qDebug ("select press in varslot: mode %d, source %s, selected %s", add_mode, qPrintable (fetchStringValue (source)), qPrintable (fetchStringValue (selected))), PLUGIN, DL_DEBUG);
+	RK_DEBUG (PLUGIN, DL_DEBUG, "select press in varslot: mode %d, source %s, selected %s", add_mode, qPrintable (fetchStringValue (source)), qPrintable (fetchStringValue (selected)));
 
 	// first update the properties
 	if (add_mode) {

Modified: trunk/rkward/rkward/rbackend/rcommand.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rcommand.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rcommand.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -107,7 +107,7 @@
 		}
 	}
 
-	RK_DO (qDebug ("Too many receivers for command"), RBACKEND, DL_ERROR);
+	RK_DEBUG (RBACKEND, DL_ERROR, "Too many receivers for command");
 }
 
 void RCommand::removeReceiver (RCommandReceiver *receiver) {
@@ -122,7 +122,7 @@
 		}
 	}
 
-	RK_DO (qDebug ("Was not a receiver in RCommand::removeReceiver: %p", receiver), RBACKEND, DL_WARNING);
+	RK_DEBUG (RBACKEND, DL_WARNING, "Was not a receiver in RCommand::removeReceiver: %p", receiver);
 }
 
 void RCommand::finished () {

Modified: trunk/rkward/rkward/rbackend/rdata.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rdata.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rdata.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -35,9 +35,9 @@
 
 void RData::doAssert(RData::RDataType requested_type) const {
 	if (this == 0) {
-		RK_DO (qDebug ("Requested data from a NULL RData"), RBACKEND, DL_ERROR);
+		RK_DEBUG (RBACKEND, DL_ERROR, "Requested data from a NULL RData");
 	} else { 
-		RK_DO (qDebug ("Reqeusted data of type %d, while %p has type %d", requested_type, this, datatype), RBACKEND, DL_ERROR);
+		RK_DEBUG (RBACKEND, DL_ERROR, "Reqeusted data of type %d, while %p has type %d", requested_type, this, datatype);
 	}
 }
 

Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -88,7 +88,7 @@
 
 // If R_HOME is not set, most certainly the user called the binary without the wrapper script
 	if (!getenv ("R_HOME")) {
-		RK_DO (qDebug ("No R_HOME environment variable set. RKWard will quit in a moment. Always start rkward in the default way unless you know what you're doing."), RBACKEND, DL_ERROR);
+		RK_DEBUG (RBACKEND, DL_ERROR, "No R_HOME environment variable set. RKWard will quit in a moment. Always start rkward in the default way unless you know what you're doing.");
 	}
 
 	new RCommandStackModel (this);
@@ -124,7 +124,7 @@
 RInterface::~RInterface(){
 	RK_TRACE (RBACKEND);
 
-	if (num_active_output_record_requests) RK_DO (qDebug ("%d requests for recording output still active on interface shutdown", num_active_output_record_requests), RBACKEND, DL_WARNING);
+	if (num_active_output_record_requests) RK_DEBUG (RBACKEND, DL_WARNING, "%d requests for recording output still active on interface shutdown", num_active_output_record_requests);
 	delete window_catcher;
 }
 
@@ -195,16 +195,16 @@
 		if (command->failed ()) {
 			command->status |= RCommand::WasTried | RCommand::Failed;
 			if (command->status & RCommand::ErrorIncomplete) {
-				RK_DO (qDebug ("Command failed (incomplete)"), RBACKEND, dl);
+				RK_DEBUG (RBACKEND, dl, "Command failed (incomplete)");
 			} else if (command->status & RCommand::ErrorSyntax) {
-				RK_DO (qDebug ("Command failed (syntax)"), RBACKEND, dl);
+				RK_DEBUG (RBACKEND, dl, "Command failed (syntax)");
 			} else if (command->status & RCommand::Canceled) {
-				RK_DO (qDebug ("Command failed (interrupted)"), RBACKEND, dl);
+				RK_DEBUG (RBACKEND, dl, "Command failed (interrupted)");
 			} else {
-				RK_DO (qDebug ("Command failed (other)"), RBACKEND, dl);
+				RK_DEBUG (RBACKEND, dl, "Command failed (other)");
 			}
-			RK_DO (qDebug ("failed command was: '%s'", qPrintable (command->command ())), RBACKEND, dl);
-			RK_DO (qDebug ("- error message was: '%s'", qPrintable (command->error ())), RBACKEND, dl);
+			RK_DEBUG (RBACKEND, dl, "failed command was: '%s'", qPrintable (command->command ()));
+			RK_DEBUG (RBACKEND, dl, "- error message was: '%s'", qPrintable (command->error ()));
 		}
 	#endif
 
@@ -230,7 +230,7 @@
 	if (command) {
 		proxy = command->makeProxy ();
 
-		RK_DO (qDebug ("running command: %s", command->command ().toLatin1().data ()), RBACKEND, DL_DEBUG);
+		RK_DEBUG (RBACKEND, DL_DEBUG, "running command: %s", command->command ().toLatin1().data ());
 		command->status |= RCommand::Running;
 		RCommandStackModel::getModel ()->itemChange (command);
 
@@ -376,11 +376,11 @@
 
 	foreach (ROutput *output, list) {
 		if (all_current_commands.isEmpty ()) {
-			RK_DO (qDebug ("output without receiver'%s'", qPrintable (output->output)), RBACKEND, DL_WARNING);
+			RK_DEBUG (RBACKEND, DL_WARNING, "output without receiver'%s'", qPrintable (output->output));
 			delete output;
 			continue;	// to delete the other output pointers, too
 		} else {
-			RK_DO (qDebug ("output '%s'", qPrintable (output->output)), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "output '%s'", qPrintable (output->output));
 		}
 
 		if (num_active_output_record_requests) {
@@ -640,18 +640,18 @@
 			QString object_name = calllist[i];
 			RObject *obj = RObjectList::getObjectList ()->findObject (object_name);
 			if (obj) {
-				RK_DO (qDebug ("triggering update for symbol %s", object_name.toLatin1 ().data()), RBACKEND, DL_DEBUG);
+				RK_DEBUG (RBACKEND, DL_DEBUG, "triggering update for symbol %s", object_name.toLatin1 ().data());
 				obj->markDataDirty ();
 				obj->updateFromR (in_chain);
 			} else {
-				RK_DO (qDebug ("lookup failed for changed symbol %s", object_name.toLatin1 ().data()), RBACKEND, DL_WARNING);
+				RK_DEBUG (RBACKEND, DL_WARNING, "lookup failed for changed symbol %s", object_name.toLatin1 ().data());
 			}
 		}
 	} else if (call == "syncenvs") {
-		RK_DO (qDebug ("triggering update of object list"), RBACKEND, DL_DEBUG);
+		RK_DEBUG (RBACKEND, DL_DEBUG, "triggering update of object list");
 		RObjectList::getObjectList ()->updateFromR (in_chain, calllist.mid (1));
 	} else if (call == "syncglobal") {
-		RK_DO (qDebug ("triggering update of globalenv"), RBACKEND, DL_DEBUG);
+		RK_DEBUG (RBACKEND, DL_DEBUG, "triggering update of globalenv");
 		RObjectList::getGlobalEnv ()->updateFromR (in_chain, calllist.mid (1));
 #ifndef DISABLE_RKWINDOWCATCHER
 	// NOTE: WARNING: When converting these to PlainGenericRequests, the occasional "error, figure margins too large" starts coming up, again. Not sure, why.

Modified: trunk/rkward/rkward/rbackend/rkbackendtransmitter.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkbackendtransmitter.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rkbackendtransmitter.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -34,7 +34,7 @@
 RKRBackendTransmitter::~RKRBackendTransmitter () {
 	RK_TRACE (RBACKEND);
 	if (!current_sync_requests.isEmpty ()) {
-		RK_DO (qDebug ("%d pending requests while exiting RKRBackendTransmitter", current_sync_requests.size ()), RBACKEND, DL_WARNING);
+		RK_DEBUG (RBACKEND, DL_WARNING, "%d pending requests while exiting RKRBackendTransmitter", current_sync_requests.size ());
 	}
 
 	if (!connection) return;
@@ -78,7 +78,7 @@
 
 	if (request->synchronous) {
 		current_sync_requests.append (request);
-		RK_DO (qDebug ("Expecting replies for %d requests (added %p)", current_sync_requests.size (), request), RBACKEND, DL_DEBUG);
+		RK_DEBUG (RBACKEND, DL_DEBUG, "Expecting replies for %d requests (added %p)", current_sync_requests.size (), request);
 	} else {
 		delete request;
 	}
@@ -104,7 +104,7 @@
 			current_sync_request->mergeReply (request);
 			current_sync_request->done = true;
 		}
-		RK_DO (qDebug ("Expecting replies for %d requests (popped %p)", current_sync_requests.size (), current_sync_request), RBACKEND, DL_DEBUG);
+		RK_DEBUG (RBACKEND, DL_DEBUG, "Expecting replies for %d requests (popped %p)", current_sync_requests.size (), current_sync_request);
 	}
 	delete request;
 }
@@ -126,7 +126,7 @@
 void RKRBackendTransmitter::handleTransmissionError (const QString &message) {
 	RK_TRACE (RBACKEND);
 
-	RK_DO (qDebug ("%s", qPrintable ("Transmission error " + message)), RBACKEND, DL_ERROR);
+	RK_DEBUG (RBACKEND, DL_ERROR, "%s", qPrintable ("Transmission error " + message));
 	RKRBackend::tryToDoEmergencySave ();
 }
 

Modified: trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rkpthreadsupport.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -89,7 +89,7 @@
 	// sanity check, as on some systems the stack direction is mis-detected somehow.
 	long usage = direction * ((unsigned long) (*base) - (unsigned long) (reference));
 	if ((usage < 0) || (unsigned long) usage > (unsigned long) (*size)) {
-		RK_DO (qDebug ("Stack boundaries detection produced bad results. Disabling stack checking."), RBACKEND, DL_WARNING);
+		RK_DEBUG (RBACKEND, DL_WARNING, "Stack boundaries detection produced bad results. Disabling stack checking.");
 		*size = (unsigned long) -1;
 	}
 }

Modified: trunk/rkward/rkward/rbackend/rkrbackend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackend.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rkrbackend.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -117,7 +117,7 @@
 
 ///// interrupting R
 void RK_scheduleIntr () {
-	RK_DO (qDebug ("interrupt scheduled"), RBACKEND, DL_DEBUG);
+	RK_DEBUG (RBACKEND, DL_DEBUG, "interrupt scheduled");
 	RKRBackend::repl_status.interrupted = true;
 #ifdef Q_WS_WIN
 	UserBreak = 1;
@@ -150,7 +150,7 @@
 	if (all_current_commands.isEmpty ()) return;
 	if ((command_id == -1) || (all_current_commands.last ()->id == command_id)) {
 		if (!too_late_to_interrupt) {
-			RK_DO (qDebug ("scheduling interrupt for command id %d", command_id), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "scheduling interrupt for command id %d", command_id);
 			scheduleInterrupt ();
 		}
 	} else {
@@ -158,7 +158,7 @@
 		foreach (RCommandProxy *candidate, all_current_commands) {
 			if (candidate->id == command_id) {
 				if (!current_commands_to_cancel.contains (candidate)) {
-					RK_DO (qDebug ("scheduling delayed interrupt for command id %d", command_id), RBACKEND, DL_DEBUG);
+					RK_DEBUG (RBACKEND, DL_DEBUG, "scheduling delayed interrupt for command id %d", command_id);
 					current_commands_to_cancel.append (candidate);
 				}
 			}
@@ -173,7 +173,7 @@
 void RKRBackend::clearPendingInterrupt () {
 	RK_TRACE (RBACKEND);
 	bool passed = R_ToplevelExec (clearPendingInterrupt_Worker, 0);
-	if (!passed) RK_DO (qDebug ("pending interrupt cleared"), RBACKEND, DL_DEBUG);
+	if (!passed) RK_DEBUG (RBACKEND, DL_DEBUG, "pending interrupt cleared");
 }
 
 // some functions we need that are not declared
@@ -883,13 +883,13 @@
 			if (RKRBackend::repl_status.user_command_status != RKRBackend::RKReplStatus::ReplIterationKilled) {	// was interrupted only to step out of the repl iteration
 				QMutexLocker lock (&(RKRBackend::this_pointer->all_current_commands_mutex));
 				foreach (RCommandProxy *command, RKRBackend::this_pointer->all_current_commands) command->status |= RCommand::Canceled;
-				RK_DO (qDebug ("interrupted"), RBACKEND, DL_DEBUG);
+				RK_DEBUG (RBACKEND, DL_DEBUG, "interrupted");
 			}
 		}
 	} else if (RKRBackend::repl_status.user_command_status != RKRBackend::RKReplStatus::ReplIterationKilled) {
 		QString string = RKRSupport::SEXPToString (call);
 		RKRBackend::this_pointer->handleOutput (string, string.length (), ROutput::Error);
-		RK_DO (qDebug ("error '%s'", qPrintable (string)), RBACKEND, DL_DEBUG);
+		RK_DEBUG (RBACKEND, DL_DEBUG, "error '%s'", qPrintable (string));
 	}
 	return R_NilValue;
 }
@@ -933,9 +933,9 @@
 SEXP doUpdateLocale () {
 	RK_TRACE (RBACKEND);
 
-	RK_DO (qDebug ("Changing locale"), RBACKEND, DL_WARNING);
+	RK_DEBUG (RBACKEND, DL_WARNING, "Changing locale");
 	RKRBackend::this_pointer->current_locale_codec = RKGetCurrentLocaleCodec ();
-	RK_DO (qDebug ("New locale codec is %s", RKRBackend::this_pointer->current_locale_codec->name ().data ()), RBACKEND, DL_WARNING);
+	RK_DEBUG (RBACKEND, DL_WARNING, "New locale codec is %s", RKRBackend::this_pointer->current_locale_codec->name ().data ());
 
 	return R_NilValue;
 }
@@ -1024,8 +1024,8 @@
 	// this has to come *after* the first setup_Rmainloop ()!
 	Rboolean stack_ok = R_ToplevelExec (R_CheckStackWrapper, (void *) 0);
 	if (!stack_ok) {
-		RK_DO (qDebug ("R_CheckStack() failed during initialization. Will disable stack checking and try to re-initialize."), RBACKEND, DL_WARNING);
-		RK_DO (qDebug ("Whether or not things work after this, *please* submit a bug report."), RBACKEND, DL_WARNING);
+		RK_DEBUG (RBACKEND, DL_WARNING, "R_CheckStack() failed during initialization. Will disable stack checking and try to re-initialize.");
+		RK_DEBUG (RBACKEND, DL_WARNING, "Whether or not things work after this, *please* submit a bug report.");
 		R_CStackStart = (uintptr_t) -1;
 		R_CStackLimit = (uintptr_t) -1;
 		setup_Rmainloop ();
@@ -1110,7 +1110,7 @@
 
 //	This was used to show a warning message. Unfortunately, however, forks also occur on every popen (i.e. in system(..., intern=TRUE).
 //	RKRBackend::this_pointer->handlePlainGenericRequest (QStringList ("forkNotification"), false);
-	RK_DO (qDebug ("Backend process forked (for the first time, this session)"), RBACKEND, DL_WARNING);
+	RK_DEBUG (RBACKEND, DL_WARNING, "Backend process forked (for the first time, this session)");
 //	NOTE: perhaps we can heuristically differentiate from popen by checking sys.calls() for something with "fork" in it. 
 //	esp., in case we discover adverse side-effects of blocking SIGCHLD, we should attempt this
 }
@@ -1350,7 +1350,7 @@
 
 void RKRBackend::commandFinished (bool check_object_updates_needed) {
 	RK_TRACE (RBACKEND);
-	RK_DO (qDebug ("done running command"), RBACKEND, DL_DEBUG);
+	RK_DEBUG (RBACKEND, DL_DEBUG, "done running command");
 
 	{
 		QMutexLocker lock (&all_current_commands_mutex);
@@ -1429,7 +1429,7 @@
 	{
 		QMutexLocker lock (&all_current_commands_mutex);
 		if (current_commands_to_cancel.contains (current_command)) {
-			RK_DO (qDebug ("will now interrupt parent command"), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "will now interrupt parent command");
 			current_commands_to_cancel.removeAll (current_command);
 			scheduleInterrupt ();
 		}
@@ -1530,14 +1530,14 @@
 
 	if (check_list) {	
 	// TODO: avoid parsing this over and over again
-		RK_DO (qDebug ("checkObjectUpdatesNeeded: getting search list"), RBACKEND, DL_TRACE);
+		RK_DEBUG (RBACKEND, DL_TRACE, "checkObjectUpdatesNeeded: getting search list");
 		RCommandProxy *dummy = runDirectCommand ("search ()\n", RCommand::GetStringVector);
 		if (dummy->stringVector () != toplevel_env_names) search_update_needed = true;
 		if (search_update_needed) toplevel_env_names = dummy->stringVector ();
 		delete dummy;
 	
 	// TODO: avoid parsing this over and over again
-		RK_DO (qDebug ("checkObjectUpdatesNeeded: getting globalenv symbols"), RBACKEND, DL_TRACE);
+		RK_DEBUG (RBACKEND, DL_TRACE, "checkObjectUpdatesNeeded: getting globalenv symbols");
 		dummy = runDirectCommand ("ls (globalenv (), all.names=TRUE)\n", RCommand::GetStringVector);
 		QStringList new_globalenv_toplevel_names = dummy->stringVector ();
 		if (new_globalenv_toplevel_names.count () != global_env_toplevel_names.count ()) {
@@ -1567,7 +1567,7 @@
 	}
 
 	if (search_update_needed || globalenv_update_needed) {
-		RK_DO (qDebug ("checkObjectUpdatesNeeded: updating watches"), RBACKEND, DL_TRACE);
+		RK_DEBUG (RBACKEND, DL_TRACE, "checkObjectUpdatesNeeded: updating watches");
 		runDirectCommand (".rk.watch.globalenv ()\n");
 	}
 

Modified: trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rkrbackendprotocol_backend.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -49,12 +49,12 @@
 		void exitThread () {
 			RK_TRACE (RBACKEND);
 			if (isRunning ()) {
-				RK_DO (qDebug ("Waiting for R thread to finish up..."), RBACKEND, DL_INFO);
+				RK_DEBUG (RBACKEND, DL_INFO, "Waiting for R thread to finish up...");
 				RKRBackendProtocolBackend::interruptProcessing ();
 				RKRBackend::this_pointer->kill ();
 				wait (1000);
 				if (isRunning ()) {
-					RK_DO (qDebug ("Backend thread is still running. It will be killed, now."), RBACKEND, DL_WARNING);
+					RK_DEBUG (RBACKEND, DL_WARNING, "Backend thread is still running. It will be killed, now.");
 					terminate ();
 					yieldCurrentThread ();
 					RK_ASSERT (false);
@@ -100,6 +100,21 @@
 		RK_Debug_Mutex.unlock ();
 	}
 
+	// NOTE: This function serves no benefit over qDebug() in the backend. But provided for consistency with the frontend.
+	// See the frontend version in main.cpp
+	void RKDebug (int flags, int level, const char *fmt, ...) {
+		Q_UNUSED (flags);
+		Q_UNUSED (level);
+		const int bufsize = 1024*8;
+		char buffer[bufsize];
+
+		va_list ap;
+		va_start (ap, fmt);
+		vsnprintf (buffer, bufsize-1, fmt, ap);
+		va_end (ap);
+		RKDebugMessageOutput (QtDebugMsg, buffer);
+	}
+
 	int main(int argc, char *argv[]) {
 		QCoreApplication app (argc, argv);
 

Modified: trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rkrbackendprotocol_shared.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -97,7 +97,7 @@
 	if (!buf_length) return false;
 	RK_TRACE (RBACKEND);
 
-	RK_DO (qDebug ("Output type %d: %s", output_type, qPrintable (output)), RBACKEND, DL_DEBUG);
+	RK_DEBUG (RBACKEND, DL_DEBUG, "Output type %d: %s", output_type, qPrintable (output));
 
 	// wait while the output buffer is exceeded to give downstream threads a chance to catch up
 	while ((out_buf_len > MAX_BUF_LENGTH) && allow_blocking) {

Modified: trunk/rkward/rkward/rbackend/rkstructuregetter.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkstructuregetter.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rkstructuregetter.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -144,7 +144,7 @@
 	if (TYPEOF (from) == PROMSXP) {
 		ret = PRVALUE(from);
 		if (ret == R_UnboundValue) {
-			RK_DO (qDebug ("temporarily resolving unbound promise"), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "temporarily resolving unbound promise");
 
 			PROTECT (from);
 			SET_PRSEEN(from, 1);
@@ -156,7 +156,7 @@
 			}
 			UNPROTECT (1);
 
-			RK_DO (qDebug ("resolved type is %d", TYPEOF (ret)), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "resolved type is %d", TYPEOF (ret));
 		}
 	}
 
@@ -175,7 +175,7 @@
 	bool no_recurse = (nesting_depth >= 2);	// TODO: should be configurable
 	unsigned int type = 0;
 
-	RK_DO (qDebug ("fetching '%s': %p, s-type %d", name.toLatin1().data(), val, TYPEOF (val)), RBACKEND, DL_DEBUG);
+	RK_DEBUG (RBACKEND, DL_DEBUG, "fetching '%s': %p, s-type %d", name.toLatin1().data(), val, TYPEOF (val));
 
 	SEXP value = val;
 	PROTECT_INDEX value_index;
@@ -248,7 +248,7 @@
 	if (is_container) {
 		if (no_recurse) {
 			type |= RObject::Incomplete;
-			RK_DO (qDebug ("Depth limit reached. Will not recurse into %s", name.toLatin1().data ()), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "Depth limit reached. Will not recurse into %s", name.toLatin1().data ());
 		}
 	}
 
@@ -294,7 +294,7 @@
 		type |= RObject::S4Object;
 		if (no_recurse) {
 			type |= RObject::Incomplete;
-			RK_DO (qDebug ("Depth limit reached. Will not recurse into slots of %s", name.toLatin1().data ()), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "Depth limit reached. Will not recurse into slots of %s", name.toLatin1().data ());
 		} else {
 			RData::RDataStorage dummy (1, 0);
 			dummy[0] = new RData ();
@@ -345,7 +345,7 @@
 		QStringList childnames = RKRSupport::SEXPToStringList (childnames_s);
 		int childcount = childnames.size ();
 		if (childcount > NAMED_CHILDREN_LIMIT) {
-			RK_DO (qDebug ("object %s has %d named children. Will only retrieve the first %d", name.toLatin1().data (), childcount, NAMED_CHILDREN_LIMIT), RBACKEND, DL_WARNING);
+			RK_DEBUG (RBACKEND, DL_WARNING, "object %s has %d named children. Will only retrieve the first %d", name.toLatin1().data (), childcount, NAMED_CHILDREN_LIMIT);
 			childcount = NAMED_CHILDREN_LIMIT;
 		}
 
@@ -355,7 +355,7 @@
 		}
 
 		if (do_env) {
-			RK_DO (qDebug ("recurse into environment %s", name.toLatin1().data ()), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "recurse into environment %s", name.toLatin1().data ());
 			if (!Rf_isEnvironment (value)) {
 				// some classes (ReferenceClasses) are identified as envionments by is.environment(), but are not internally ENVSXPs.
 				// For these, Rf_findVar would fail.
@@ -379,7 +379,7 @@
 				UNPROTECT (2); /* current_childname, child */
 			}
 		} else if (do_cont) {
-			RK_DO (qDebug ("recurse into list %s", name.toLatin1().data ()), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "recurse into list %s", name.toLatin1().data ());
 			// fewer elements than names() can happen, although I doubt it is supposed to happen.
 			// see http://sourceforge.net/tracker/?func=detail&aid=3002439&group_id=50231&atid=459007
 			bool may_be_special = Rf_length (value) < childcount;
@@ -416,7 +416,7 @@
 
 			if (no_recurse) {
 				type |= RObject::Incomplete;
-				RK_DO (qDebug ("Depth limit reached. Will not recurse into namespace of %s", name.toLatin1().data ()), RBACKEND, DL_DEBUG);
+				RK_DEBUG (RBACKEND, DL_DEBUG, "Depth limit reached. Will not recurse into namespace of %s", name.toLatin1().data ());
 			} else {
 				RData::RDataStorage dummy (1, 0);
 				dummy[0] = new RData ();

Modified: trunk/rkward/rkward/rbackend/rktransmitter.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rktransmitter.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rbackend/rktransmitter.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -222,7 +222,7 @@
 	}
 
 	QByteArray buffer = RKRBackendSerializer::serialize (*request);
-	RK_DO (qDebug ("Transmitting request of length %s", QString::number (buffer.length ()).toLocal8Bit ().data ()), RBACKEND, DL_DEBUG);
+	RK_DEBUG (RBACKEND, DL_DEBUG, "Transmitting request of length %s", QString::number (buffer.length ()).toLocal8Bit ().data ());
 	connection->write (QString::number (buffer.length ()).toLocal8Bit () + "\n");
 	connection->write (buffer);
 }

Modified: trunk/rkward/rkward/rkconsole.cpp
===================================================================
--- trunk/rkward/rkward/rkconsole.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/rkconsole.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -109,7 +109,7 @@
 			keas[i]->setShortcuts (noshort);
 		}
 	} else {
-		RK_DO (qDebug ("Could not retrieve the katepart's edit action collection"), APP, DL_ERROR);
+		RK_DEBUG (APP, DL_ERROR, "Could not retrieve the katepart's edit action collection");
 	}
 
 	if (view->focusProxy ()) view->focusProxy()->installEventFilter(this);
@@ -847,7 +847,7 @@
 
 void RKConsole::resetConsole () {
 	RK_TRACE (APP);
-	RK_DO (qDebug("received interrupt signal in console"), APP, DL_DEBUG);
+	RK_DEBUG (APP, DL_DEBUG, "received interrupt signal in console");
 
 	input_buffer.clear ();
 	if (current_command) {

Modified: trunk/rkward/rkward/scriptbackends/qtscriptbackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/qtscriptbackend.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/scriptbackends/qtscriptbackend.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -46,7 +46,7 @@
 	RK_TRACE (PHP);
 
 	if (script_thread) {
-		RK_DO (qDebug ("another template is already openend in this backend"), PHP, DL_ERROR);
+		RK_DEBUG (PHP, DL_ERROR, "another template is already openend in this backend");
 		return false;
 	}
 
@@ -93,7 +93,7 @@
 			}
 		}
 		
-		RK_DO (qDebug ("submitting QtScript code: %s", command_stack.first ()->command.toLatin1 ().data ()), PHP, DL_DEBUG);
+		RK_DEBUG (PHP, DL_DEBUG, "submitting QtScript code: %s", command_stack.first ()->command.toLatin1 ().data ());
 		if (script_thread) script_thread->goToSleep (false);
 		script_thread->setCommand (command_stack.first ()->command);
 		busy = true;
@@ -108,7 +108,7 @@
 void QtScriptBackend::writeData (const QVariant &data) {
 	RK_TRACE (PHP);
 
-	RK_DO (qDebug ("submitting data: %s", qPrintable (data.toString ())), PHP, DL_DEBUG);
+	RK_DEBUG (PHP, DL_DEBUG, "submitting data: %s", qPrintable (data.toString ()));
 	script_thread->setData (data);
 	tryNextFunction ();
 }

Modified: trunk/rkward/rkward/scriptbackends/scriptbackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/scriptbackend.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/scriptbackends/scriptbackend.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -36,7 +36,7 @@
 
 void ScriptBackend::callFunction (const QString &function, int flags, int type) {
 	RK_TRACE (PHP);
-	RK_DO (qDebug ("callFunction %s", function.toLatin1 ().data ()), PHP, DL_DEBUG);
+	RK_DEBUG (PHP, DL_DEBUG, "callFunction %s", function.toLatin1 ().data ());
 
 	ScriptCommand *command = new ScriptCommand;
 	command->command = function;

Modified: trunk/rkward/rkward/windows/rkcallstackviewer.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcallstackviewer.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/rkcallstackviewer.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -66,7 +66,7 @@
 	RK_TRACE (APP);
 
 	if (!real_widget) {
-		RK_DO (qDebug ("creating callstack viewer"), APP, DL_INFO);
+		RK_DEBUG (APP, DL_INFO, "creating callstack viewer");
 
 		real_widget = new RKCallstackViewerWidget (layout_widget);
 		setFocusProxy (real_widget);

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -1266,7 +1266,7 @@
 
 	QString mode_string = "R Script";
 	if (mode == RInteractiveSession) mode_string = "R interactive session";
-	if (!(doc->setHighlightingMode (mode_string) && doc->setMode (mode_string))) RK_DO (qDebug ("R syntax highlighting defintion ('%s')not found!", qPrintable (mode_string)), COMMANDEDITOR, DL_ERROR);
+	if (!(doc->setHighlightingMode (mode_string) && doc->setMode (mode_string))) RK_DEBUG (COMMANDEDITOR, DL_ERROR, "R syntax highlighting defintion ('%s')not found!", qPrintable (mode_string));
 }
 
 void RKCommandHighlighter::copyLinesToOutput (KTextEditor::View *view, HighlightingMode mode) {

Modified: trunk/rkward/rkward/windows/rkfilebrowser.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkfilebrowser.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/rkfilebrowser.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -72,7 +72,7 @@
 	RK_TRACE (APP);
 
 	if (!real_widget) {
-		RK_DO (qDebug ("creating file browser"), APP, DL_INFO);
+		RK_DEBUG (APP, DL_INFO, "creating file browser");
 
 		real_widget = new RKFileBrowserWidget (layout_widget);
 		setFocusProxy (real_widget);

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -515,7 +515,7 @@
 		} else {
 			help_file_name = help_base_dir + url.path () + ".rkh";
 		}
-		RK_DO (qDebug ("rendering help page for local file %s", help_file_name.toLatin1().data()), APP, DL_DEBUG);
+		RK_DEBUG (APP, DL_DEBUG, "rendering help page for local file %s", help_file_name.toLatin1().data());
 
 		// open help file
 		QDomElement help_doc_element = help_xml->openXMLFile (help_file_name, DL_ERROR);
@@ -673,7 +673,7 @@
 	ret.append ("</p>");
 	ret.replace ("\n\n", "</p>\n<p>");
 
-	RK_DO (qDebug ("%s", ret.toLatin1 ().data ()), APP, DL_DEBUG);
+	RK_DEBUG (APP, DL_DEBUG, "%s", ret.toLatin1 ().data ());
 	return ret;
 }
 
@@ -705,7 +705,7 @@
 
 			if (text.isEmpty ()) {
 				text = i18n ("BROKEN REFERENCE");
-				RK_DO (qDebug ("Broken reference to %s", url.path ().toLatin1 ().data ()), APP, DL_WARNING);
+				RK_DEBUG (APP, DL_WARNING, "Broken reference to %s", url.path ().toLatin1 ().data ());
 			}
 
 			link_element->appendChild (link_element->ownerDocument ().createTextNode (text));

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -43,7 +43,7 @@
 
 void RKWindowCatcher::start (int prev_cur_device) {
 	RK_TRACE (MISC);
-	RK_DO (qDebug ("Window Catcher activated"), RBACKEND, DL_DEBUG);
+	RK_DEBUG (RBACKEND, DL_DEBUG, "Window Catcher activated");
 
 	RKWardApplication::getApp ()->startWindowCreationDetection ();
 	last_cur_device = prev_cur_device;
@@ -51,7 +51,7 @@
 
 void RKWindowCatcher::stop (int new_cur_device) {
 	RK_TRACE (MISC);
-	RK_DO (qDebug ("Window Catcher deactivated"), RBACKEND, DL_DEBUG);
+	RK_DEBUG (RBACKEND, DL_DEBUG, "Window Catcher deactivated");
 
 	WId w = RKWardApplication::getApp ()->endWindowCreationDetection ();
 	if (new_cur_device != last_cur_device) {
@@ -89,7 +89,7 @@
 			int position = params[i+1].toInt ();
 			window->updateHistoryActions (history_length, position, labels);
 		} else {
-			RK_DO (qDebug ("Device %d is not managed, while trying to update history", params[i].toInt ()), RBACKEND, DL_DEBUG);
+			RK_DEBUG (RBACKEND, DL_DEBUG, "Device %d is not managed, while trying to update history", params[i].toInt ());
 		}
 	}
 }

Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -807,7 +807,7 @@
 RKMDIWindowHistory::~RKMDIWindowHistory () {
 	RK_TRACE (APP);
 
-	RK_DO (qDebug ("Remaining windows in history: %d", recent_windows.count ()), APP, DL_DEBUG);
+	RK_DEBUG (APP, DL_DEBUG, "Remaining windows in history: %d", recent_windows.count ());
 }
 
 void RKMDIWindowHistory::windowActivated (RKMDIWindow *window) {

Modified: trunk/rkward/rkward/windows/rkworkplaceview.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplaceview.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/rkworkplaceview.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -142,7 +142,7 @@
 	RK_TRACE (APP);
 
 	int id = indexOf (widget);		// which page is it?
-	RK_DO (if (id == -1) qDebug ("did not find page in RKWorkplaceView::removeWindow"), APP, DL_WARNING);
+	if (id == -1) RK_DEBUG (APP, DL_WARNING, "did not find page in RKWorkplaceView::removeWindow");
 	if (!destroyed) disconnect (widget, SIGNAL (captionChanged (RKMDIWindow *)), this, SLOT (childCaptionChanged (RKMDIWindow *)));
 
 	removeTab (id);
@@ -154,7 +154,7 @@
 	RK_TRACE (APP);
 
 	int id = indexOf (widget);
-	RK_DO (if (id == -1) qDebug ("did not find page in RKWorkplaceView::setActivePage"), APP, DL_WARNING);
+	if (id == -1) RK_DEBUG (APP, DL_WARNING, "did not find page in RKWorkplaceView::setActivePage");
 
 	setCurrentIndex (id);
 }

Modified: trunk/rkward/rkward/windows/robjectbrowser.cpp
===================================================================
--- trunk/rkward/rkward/windows/robjectbrowser.cpp	2012-11-29 18:20:26 UTC (rev 4472)
+++ trunk/rkward/rkward/windows/robjectbrowser.cpp	2012-11-30 09:46:37 UTC (rev 4473)
@@ -94,7 +94,7 @@
 	if (internal) return;
 	if (locked) return;
 
-	RK_DO (qDebug ("creating workspace browser"), APP, DL_INFO);
+	RK_DEBUG (APP, DL_INFO, "creating workspace browser");
 
 	internal = new RObjectBrowserInternal (layout_widget);
 	setFocusProxy (internal);

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list