[rkward-cvs] rkward/rkward/rbackend rembedinternal.cpp,1.31,1.32 rembedinternal.h,1.17,1.18 rinterface.cpp,1.40,1.41 rthread.cpp,1.29,1.30

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Nov 13 14:31:31 UTC 2005


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

Modified Files:
	rembedinternal.cpp rembedinternal.h rinterface.cpp rthread.cpp 
Log Message:
Removing obsolete R_HOME mechanisms

Index: rembedinternal.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rembedinternal.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rembedinternal.h	3 Nov 2005 19:34:29 -0000	1.17
--- rembedinternal.h	13 Nov 2005 14:31:29 -0000	1.18
***************
*** 76,83 ****
  protected:
  /** low-level initialization of R
- @param r_home R_HOME-directory
  @param argc Number of arguments as would be passed on the commandline to R
  @param argv Arguments as would be passed on the commandline to R */
! 	bool startR (const char* r_home, int argc, char **argv);
  /** low-level running of a command.
  @param command char* of the command to be run
--- 76,82 ----
  protected:
  /** low-level initialization of R
  @param argc Number of arguments as would be passed on the commandline to R
  @param argv Arguments as would be passed on the commandline to R */
! 	bool startR (int argc, char **argv);
  /** low-level running of a command.
  @param command char* of the command to be run

Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** rinterface.cpp	3 Nov 2005 21:35:50 -0000	1.40
--- rinterface.cpp	13 Nov 2005 14:31:29 -0000	1.41
***************
*** 64,85 ****
  #endif // DISABLE_RKWINDOWCATCHER
  	
! // note: we can safely mess with RKSettingsModuleR::r_home_dir, since if the setting is bad, the app will exit without anything being saved. If the
! // setting is good, everything is fine anyway.
! 	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";
! 			RKSettingsModuleR::r_home_dir = KInputDialog::getText (i18n ("R_HOME not set"), i18n ("Could not find an R_HOME-environment variable and don't have a stored setting for that either.\nThe R backend requires that variable. Please enter your R_HOME directory below.\nIf you don't get it right, the application will quit immediately and you'll have to start RKWard again."), RKSettingsModuleR:: r_home_dir);
! 		}
! 	} else {
! 		if (env_r_home != RKSettingsModuleR::r_home_dir) {
! 			RK_DO (qDebug ("R_HOME conflict"), RBACKEND, DL_WARNING);
! 			if (KMessageBox::warningYesNo (0, i18n ("RKWard has a stored setting for the R_HOME-variable. However, in the environment, that variable is currently set to a different value. It's probably safe to assume the environment-setting is correct/more up to date. Using a wrong setting however will cause the application to quit immediately. Do you want to use the stored setting instead of the environment-setting?"), i18n ("Conflicting settings for R_HOME")) != KMessageBox::Yes) {
! 				RKSettingsModuleR::r_home_dir = env_r_home;
! 			}
! 		}
  	}
! 	
  	RCommandStack::regular_stack = new RCommandStack ();
  	running_command_canceled = 0;
--- 64,72 ----
  #endif // DISABLE_RKWINDOWCATCHER
  	
! // 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);
  	}
! 
  	RCommandStack::regular_stack = new RCommandStack ();
  	running_command_canceled = 0;

Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** rthread.cpp	6 Nov 2005 12:25:08 -0000	1.29
--- rthread.cpp	13 Nov 2005 14:31:29 -0000	1.30
***************
*** 359,368 ****
  	current_command = new RCommand (QString::null, RCommand::App, "R Startup");
  
- 	QString r_home = RKSettingsModuleR::rHomeDir();
- 
  	int argc = 2;	
  	char* argv[2] = { qstrdup ("--slave"), qstrdup ("--no-save") };
  
! 	startR (r_home, argc, argv);
  
  	for (--argc; argc >= 0; --argc) {
--- 359,366 ----
  	current_command = new RCommand (QString::null, RCommand::App, "R Startup");
  
  	int argc = 2;	
  	char* argv[2] = { qstrdup ("--slave"), qstrdup ("--no-save") };
  
! 	startR (argc, argv);
  
  	for (--argc; argc >= 0; --argc) {

Index: rembedinternal.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rembedinternal.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** rembedinternal.cpp	8 Nov 2005 13:13:16 -0000	1.31
--- rembedinternal.cpp	13 Nov 2005 14:31:29 -0000	1.32
***************
*** 335,340 ****
  }
  
! bool REmbedInternal::startR (const char* r_home, int argc, char** argv) {
! 	setenv("R_HOME", r_home, 1);
  	if (Rf_initEmbeddedR(argc, argv) < 0) {
  		return false;
--- 335,339 ----
  }
  
! bool REmbedInternal::startR (int argc, char** argv) {
  	if (Rf_initEmbeddedR(argc, argv) < 0) {
  		return false;





More information about the rkward-tracker mailing list