[rkward-cvs] SF.net SVN: rkward:[3174] branches/2010_10_18_backend_restructuring_branch/ rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Nov 2 20:15:12 UTC 2010


Revision: 3174
          http://rkward.svn.sourceforge.net/rkward/?rev=3174&view=rev
Author:   tfry
Date:     2010-11-02 20:15:12 +0000 (Tue, 02 Nov 2010)

Log Message:
-----------
Remove the --disable-stack-check commandline option, and simplify a bit.

Modified Paths:
--------------
    branches/2010_10_18_backend_restructuring_branch/rkward/main.cpp
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp
    branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rthread.cpp
    branches/2010_10_18_backend_restructuring_branch/rkward/rkward.cpp
    branches/2010_10_18_backend_restructuring_branch/rkward/rkward.h

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/main.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/main.cpp	2010-11-02 20:03:31 UTC (rev 3173)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/main.cpp	2010-11-02 20:15:12 UTC (rev 3174)
@@ -98,7 +98,6 @@
 	options.add ("debug-level <level>", ki18n ("Verbosity of debug messages (0-5)"), "2");
 	options.add ("debug-flags <flags>", ki18n ("Mask for components to debug (see debug.h)"), "8191");
 	options.add ("debugger <command>", ki18n ("Debugger (enclose any debugger arguments in single quotes ('') together with the command)"), "");
-	options.add ("disable-stack-check", ki18n ("Disable R C stack checking"), 0);
 	options.add ("+[File]", ki18n ("R workspace file to open"), 0);
 
 	KAboutData aboutData("rkward", QByteArray (), ki18n ("RKWard"), VERSION, ki18n ("Frontend to the R statistics language"), KAboutData::License_GPL, ki18n ("(c) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010"), KLocalizedString (), "http://rkward.sf.net", "rkward-devel at lists.sourceforge.net");
@@ -144,7 +143,6 @@
 	if (args->count ()) {
 		stoptions->initial_url = KUrl (args->makeURL (args->arg (0).toLatin1()));
 	}
-	stoptions->no_stack_check = args->isSet ("disable-stack-check");
 	stoptions->evaluate = args->getOption ("evaluate");
 
 	RKWardApplication app;

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp	2010-11-02 20:03:31 UTC (rev 3173)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.cpp	2010-11-02 20:15:12 UTC (rev 3174)
@@ -754,7 +754,7 @@
 	return (R_NilValue);
 }
 
-bool RThread::startR (int argc, char** argv, bool stack_check) {
+bool RThread::startR () {
 	RK_TRACE (RBACKEND);
 
 	setupCallbacks ();
@@ -762,20 +762,19 @@
 	RKSignalSupport::saveDefaultSignalHandlers ();
 
 	r_running = true;
-	Rf_initialize_R (argc, argv);
+	int argc = 3;
+	char* argv[3] = { "--slave", "--no-save", "--no-restore" };
+	Rf_initialize_R (3, argv);
 
-#ifndef Q_WS_WIN
 	// in R on windows the stack limits detection seems to work out of the box for threads
-	if (stack_check) {
+#ifndef Q_WS_WIN
+	{
 		char dummy;
 		size_t stacksize;
 		void *stackstart;
 		RKGetCurrentThreadStackLimits (&stacksize, &stackstart, &dummy);
 		R_CStackStart = (uintptr_t) stackstart;
 		R_CStackLimit = stacksize;
-	} else {
-		R_CStackStart = (uintptr_t) -1;
-		R_CStackLimit = (uintptr_t) -1;
 	}
 #endif
 
@@ -787,18 +786,15 @@
 	setup_Rmainloop ();
 
 #ifndef Q_WS_WIN
-	// in R on windows the stack limits detection seems to work out of the box for threads
-	if (stack_check) {
-		// safety check: If we are beyond the stack boundaries already, we better disable stack checking
-		// 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 ("If this does not work, try the --disable-stack-check command line option, *and* submit a bug report."), RBACKEND, DL_WARNING);
-			R_CStackStart = (uintptr_t) -1;
-			R_CStackLimit = (uintptr_t) -1;
-			setup_Rmainloop ();
-		}
+	// safety check: If we are beyond the stack boundaries already, we better disable stack checking
+	// 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);
+		R_CStackStart = (uintptr_t) -1;
+		R_CStackLimit = (uintptr_t) -1;
+		setup_Rmainloop ();
 	}
 #endif
 

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h	2010-11-02 20:03:31 UTC (rev 3173)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rembedinternal.h	2010-11-02 20:15:12 UTC (rev 3174)
@@ -154,11 +154,8 @@
 
 	void enterEventLoop ();
 protected:
-/** low-level initialization of R
- at param argc Number of arguments as would be passed on the commandline to R
- at param argv Arguments as would be passed on the commandline to R
- at param stack_check C stack checking enabled */
-	bool startR (int argc, char **argv, bool stack_check);
+/** low-level initialization of R */
+	bool startR ();
 public:
 /** convenience low-level function for running a command, directly
 @param command command to be runCommand

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp	2010-11-02 20:03:31 UTC (rev 3173)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rinterface.cpp	2010-11-02 20:15:12 UTC (rev 3174)
@@ -373,7 +373,6 @@
 
 		closeChain (chain);
 		request->completed ();
-		RKWardMainWindow::discardStartupOptions ();
 	} else {
 		processRBackendRequest (request);
 	}

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rthread.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rthread.cpp	2010-11-02 20:03:31 UTC (rev 3173)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rbackend/rthread.cpp	2010-11-02 20:15:12 UTC (rev 3174)
@@ -18,11 +18,11 @@
 
 #include "rinterface.h"
 #include "../rkglobals.h"
-#include "../rkward.h"		// for startup options
 #include "../version.h"
 
 #include "../debug.h"
 
+#include <QCoreApplication>
 #include <klocale.h>
 
 #ifndef Q_WS_WIN
@@ -193,15 +193,8 @@
 	repl_status.eval_depth++;
 	fetchNextCommand ();
 
-	int argc = 2;
-	char* argv[2] = { qstrdup ("--slave"), qstrdup ("--no-save") };
-	RKWardStartupOptions *options = RKWardMainWindow::getStartupOptions ();
-	RK_ASSERT (options);
+	startR ();
 
-	startR (argc, argv, !(options->no_stack_check));
-
-	connectCallbacks ();
-
 	bool lib_load_fail = false;
 	bool sink_fail = false;
 	if (!runDirectCommand ("library (\"rkward\")\n")) lib_load_fail = true;

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rkward.cpp
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rkward.cpp	2010-11-02 20:03:31 UTC (rev 3173)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rkward.cpp	2010-11-02 20:15:12 UTC (rev 3174)
@@ -141,7 +141,6 @@
 		startup_options = options;
 	} else {
 		startup_options = new RKWardStartupOptions;
-		startup_options->no_stack_check = false;
 		startup_options->initial_url = KUrl();
 	}
 
@@ -208,6 +207,8 @@
 	// startup options will be deleted from the R thread (TODO correct this!), so we need to copy the initial_url here, or run into race conditions
 	KUrl open_url = startup_options->initial_url;
 	QString evaluate_code = startup_options->evaluate;
+	delete startup_options;
+	startup_options = 0;
 	startR ();
 	
 	initPlugins ();

Modified: branches/2010_10_18_backend_restructuring_branch/rkward/rkward.h
===================================================================
--- branches/2010_10_18_backend_restructuring_branch/rkward/rkward.h	2010-11-02 20:03:31 UTC (rev 3173)
+++ branches/2010_10_18_backend_restructuring_branch/rkward/rkward.h	2010-11-02 20:15:12 UTC (rev 3174)
@@ -43,7 +43,6 @@
 
 struct RKWardStartupOptions {
 	KUrl initial_url;	/**< The workspace file to load on startup. If empty, show a dialog asking what to do. **/
-	bool no_stack_check;	/**< Disable R C stack checking */
 	QString evaluate;	/**< R code to run after startup */
 };
 
@@ -73,13 +72,6 @@
 
 	static RKWardMainWindow *getMain () { return rkward_mainwin; };
 
-/** return pointer to startup options. WARNING: The options are deleted shortly after startup */
-	static RKWardStartupOptions* getStartupOptions () { return getMain()->startup_options; };
-	static void discardStartupOptions () {
-		delete (getMain()->startup_options);
-		getMain()->startup_options = 0;
-	};
-
 /** (try to) close all windows, and ask whether it is ok to quit */
 	bool doQueryQuit ();
 protected:


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