[rkward-cvs] rkward/rkward/rbackend rcommand.h,1.16,1.17 rinterface.cpp,1.30,1.31 rinterface.h,1.17,1.18 rthread.cpp,1.19,1.20

Thomas Friedrichsmeier tfry at users.sourceforge.net
Thu Sep 29 16:02:53 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/rbackend
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6449/rkward/rbackend

Modified Files:
	rcommand.h rinterface.cpp rinterface.h rthread.cpp 
Log Message:
Code cleanups, focus: replacing "" with QString::null / QString.isEmpty (). Fix credits

Index: rinterface.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rinterface.h	13 Sep 2005 16:08:34 -0000	1.17
--- rinterface.h	29 Sep 2005 16:02:51 -0000	1.18
***************
*** 55,59 ****
  	void issueCommand (RCommand *command, RCommandChain *chain=0);
  /** convenience function to create a new command and issue it. See documentation on RCommand::RCommand () and RInterface::issueCommand () */
! 	void issueCommand (const QString &command, int type = 0, const QString &rk_equiv = "", RCommandReceiver *receiver=0, int flags=0, RCommandChain *chain=0);
  
  /** opens a new command chain. Returns a pointer to the new chain. If you specify a parent, the new chain will be a sub-chain of that chain. */
--- 55,59 ----
  	void issueCommand (RCommand *command, RCommandChain *chain=0);
  /** convenience function to create a new command and issue it. See documentation on RCommand::RCommand () and RInterface::issueCommand () */
! 	void issueCommand (const QString &command, int type = 0, const QString &rk_equiv = QString::null, RCommandReceiver *receiver=0, int flags=0, RCommandChain *chain=0);
  
  /** opens a new command chain. Returns a pointer to the new chain. If you specify a parent, the new chain will be a sub-chain of that chain. */
***************
*** 143,147 ****
  
  void MyReceiver::someFunction () {
! 	RKGlobals::rInter->issueCommand ("print (1+1)", RCommand::App, "", this);
  }
  
--- 143,147 ----
  
  void MyReceiver::someFunction () {
! 	RKGlobals::rInter->issueCommand ("print (1+1)", RCommand::App, QString::null, this);
  }
  
***************
*** 175,179 ****
  void RKVariable::updateFromR () {
  	//...
! 	RCommand *command = new RCommand ("length (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, "", this, UPDATE_DIM_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  }
--- 175,179 ----
  void RKVariable::updateFromR () {
  	//...
! 	RCommand *command = new RCommand ("length (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetIntVector, QString::null, this, UPDATE_DIM_COMMAND);
  	RKGlobals::rInterface ()->issueCommand (command, RKGlobals::rObjectList()->getUpdateCommandChain ());
  }
***************
*** 183,187 ****
  	if (command->getFlags () == UPDATE_DIM_COMMAND) {
  		// ...
! 		RCommand *ncommand = new RCommand ("class (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, UPDATE_CLASS_COMMAND);
  		RKGlobals::rInterface ()->issueCommand (ncommand, RKGlobals::rObjectList()->getUpdateCommandChain ());
  	} else if (command->getFlags () == UPDATE_CLASS_COMMAND) {
--- 183,187 ----
  	if (command->getFlags () == UPDATE_DIM_COMMAND) {
  		// ...
! 		RCommand *ncommand = new RCommand ("class (" + getFullName () + ")", RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, UPDATE_CLASS_COMMAND);
  		RKGlobals::rInterface ()->issueCommand (ncommand, RKGlobals::rObjectList()->getUpdateCommandChain ());
  	} else if (command->getFlags () == UPDATE_CLASS_COMMAND) {
***************
*** 308,312 ****
  
  \code
! RKGlobals::rInterface ()->issueCommand ("myobject", RCommand::Sync | RCommand::GetIntVector, "",this);
  \endcode
  
--- 308,312 ----
  
  \code
! RKGlobals::rInterface ()->issueCommand ("myobject", RCommand::Sync | RCommand::GetIntVector, QString::null,this);
  \endcode
  

Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rthread.cpp	25 Sep 2005 18:45:44 -0000	1.19
--- rthread.cpp	29 Sep 2005 16:02:51 -0000	1.20
***************
*** 157,161 ****
  			RK_DO (qDebug ("Command failed (other)"), RBACKEND, DL_WARNING);
  		}
! 		RK_DO (qDebug ("failed command was: '%s'", command->command ().latin1 ()), RBACKEND, DL_WARNING);
  	} else {
  		command->status |= RCommand::WasTried;
--- 157,161 ----
  			RK_DO (qDebug ("Command failed (other)"), RBACKEND, DL_WARNING);
  		}
! 		RK_DO (qDebug ("failed command was: '%s'", command->command ().latin1 ()), RBACKEND, DL_INFO);
  	} else {
  		command->status |= RCommand::WasTried;
***************
*** 301,305 ****
  
  	// we create a fake RCommand to capture all the output/errors during startup
! 	current_command = new RCommand ("", RCommand::App, "R Startup");
  
  	QString r_home = RKSettingsModuleR::rHomeDir();
--- 301,305 ----
  
  	// we create a fake RCommand to capture all the output/errors during startup
! 	current_command = new RCommand (QString::null, RCommand::App, "R Startup");
  
  	QString r_home = RKSettingsModuleR::rHomeDir();

Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** rinterface.cpp	29 Sep 2005 13:24:48 -0000	1.30
--- rinterface.cpp	29 Sep 2005 16:02:51 -0000	1.31
***************
*** 70,74 ****
  	char *env_r_home = getenv ("R_HOME");
  	if (!env_r_home) {
! 		if (RKSettingsModuleR::r_home_dir == "") {
  			RK_DO (qDebug ("guessing R_HOME"), RBACKEND, DL_WARNING);
  			RKSettingsModuleR::r_home_dir = "/usr/lib/R";
--- 70,74 ----
  	char *env_r_home = getenv ("R_HOME");
  	if (!env_r_home) {
! 		if (RKSettingsModuleR::r_home_dir.isEmpty ()) {
  			RK_DO (qDebug ("guessing R_HOME"), RBACKEND, DL_WARNING);
  			RKSettingsModuleR::r_home_dir = "/usr/lib/R";
***************
*** 218,222 ****
  
  	// clear reply object
! 	issueCommand (".rk.rkreply <- NULL", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  	if (!request->call_length) {
  		closeChain (request->in_chain);
--- 218,222 ----
  
  	// clear reply object
! 	issueCommand (".rk.rkreply <- NULL", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  	if (!request->call_length) {
  		closeChain (request->in_chain);
***************
*** 235,246 ****
  				i++;
  			}
! 			issueCommand (".rk.rkreply <- \"" + dir.filePath (file_prefix + QString::number (i) + file_extension) + "\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  		} else {
! 			issueCommand (".rk.rkreply <- \"Too few arguments in call to get.tempfile.name.\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  		}
  	} else if (call == "get.output.html.file") {
  		QDir dir (RKSettingsModuleLogfiles::filesPath ());
  		// TODO: make more generic, get filename sanely
! 		issueCommand (".rk.rkreply <- \"" + dir.filePath ("rk_out.html") + "\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  	} else if (call == "sync") {
  		RObject *obj = 0;
--- 235,246 ----
  				i++;
  			}
! 			issueCommand (".rk.rkreply <- \"" + dir.filePath (file_prefix + QString::number (i) + file_extension) + "\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  		} else {
! 			issueCommand (".rk.rkreply <- \"Too few arguments in call to get.tempfile.name.\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  		}
  	} else if (call == "get.output.html.file") {
  		QDir dir (RKSettingsModuleLogfiles::filesPath ());
  		// TODO: make more generic, get filename sanely
! 		issueCommand (".rk.rkreply <- \"" + dir.filePath ("rk_out.html") + "\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  	} else if (call == "sync") {
  		RObject *obj = 0;
***************
*** 257,263 ****
  			RKGlobals::tracker ()->objectDataChanged (obj, set);
  			
! 			issueCommand (".rk.rkreply <- \"Sync scheduled for object '" + obj->getFullName () + "'\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  		} else {
! 			issueCommand (".rk.rkreply <- \"Object not recognized or not specified in call to sync. Ignoring\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  		}
  	} else if (call == "require") {
--- 257,263 ----
  			RKGlobals::tracker ()->objectDataChanged (obj, set);
  			
! 			issueCommand (".rk.rkreply <- \"Sync scheduled for object '" + obj->getFullName () + "'\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  		} else {
! 			issueCommand (".rk.rkreply <- \"Object not recognized or not specified in call to sync. Ignoring\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  		}
  	} else if (call == "require") {
***************
*** 266,277 ****
  			KMessageBox::information (0, i18n ("The R-backend has indicated that in order to carry out the current task it needs the package '%1', which is not currently installed. We'll open the package-management tool, and there you can try to locate and install the needed package.").arg (lib_name), i18n ("Require package '%1'").arg (lib_name));
  			RKLoadLibsDialog::showInstallPackagesModal (0, request->in_chain);
! 			issueCommand (".rk.rkreply <- \"\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  		} else {
! 			issueCommand (".rk.rkreply <- \"Too few arguments in call to require.\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  		}
  	} else if (call == "quit") {
  		RKGlobals::rkApp ()->slotFileQuit ();
  		// if we're still alive, quitting was cancelled
! 		issueCommand (".rk.rkreply <- \"Quitting was cancelled\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  #ifndef DISABLE_RKWINDOWCATCHER
   // does not work, yet :-( R crashes.
--- 266,277 ----
  			KMessageBox::information (0, i18n ("The R-backend has indicated that in order to carry out the current task it needs the package '%1', which is not currently installed. We'll open the package-management tool, and there you can try to locate and install the needed package.").arg (lib_name), i18n ("Require package '%1'").arg (lib_name));
  			RKLoadLibsDialog::showInstallPackagesModal (0, request->in_chain);
! 			issueCommand (".rk.rkreply <- \"\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  		} else {
! 			issueCommand (".rk.rkreply <- \"Too few arguments in call to require.\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  		}
  	} else if (call == "quit") {
  		RKGlobals::rkApp ()->slotFileQuit ();
  		// if we're still alive, quitting was cancelled
! 		issueCommand (".rk.rkreply <- \"Quitting was cancelled\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  #ifndef DISABLE_RKWINDOWCATCHER
   // does not work, yet :-( R crashes.
***************
*** 285,289 ****
  #endif // DISABLE_RKWINDOWCATCHER
  	} else {
! 		issueCommand (".rk.rkreply <- \"Unrecognized call '" + call + "'. Ignoring\"", RCommand::App | RCommand::Sync, "", 0, 0, request->in_chain);
  	}
  	
--- 285,289 ----
  #endif // DISABLE_RKWINDOWCATCHER
  	} else {
! 		issueCommand (".rk.rkreply <- \"Unrecognized call '" + call + "'. Ignoring\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
  	}
  	

Index: rcommand.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rcommand.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rcommand.h	23 Sep 2005 17:19:30 -0000	1.16
--- rcommand.h	29 Sep 2005 16:02:51 -0000	1.17
***************
*** 121,125 ****
  @param flags A freely assignable integer, that you can use to identify what the command was all about. Only the RCommandReceiver handling the results will have to know what exactly the flags mean.
  */
! 	RCommand(const QString &command, int type = 0, const QString &rk_equiv = "", RCommandReceiver *receiver=0, int flags=0);
  /** destructor. Note: you should not delete RCommands manually. This is done in RInterface. TODO: make protected */
  	~RCommand();
--- 121,125 ----
  @param flags A freely assignable integer, that you can use to identify what the command was all about. Only the RCommandReceiver handling the results will have to know what exactly the flags mean.
  */
! 	RCommand(const QString &command, int type = 0, const QString &rk_equiv = QString::null, RCommandReceiver *receiver=0, int flags=0);
  /** destructor. Note: you should not delete RCommands manually. This is done in RInterface. TODO: make protected */
  	~RCommand();





More information about the rkward-tracker mailing list