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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Apr 20 11:18:30 UTC 2007


Revision: 1834
          http://svn.sourceforge.net/rkward/?rev=1834&view=rev
Author:   tfry
Date:     2007-04-20 04:18:29 -0700 (Fri, 20 Apr 2007)

Log Message:
-----------
Add command line option disable-stack-check

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/main.cpp
    trunk/rkward/rkward/rbackend/rinterface.h
    trunk/rkward/rkward/rbackend/rthread.cpp
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2007-04-19 13:37:01 UTC (rev 1833)
+++ trunk/rkward/ChangeLog	2007-04-20 11:18:29 UTC (rev 1834)
@@ -1,3 +1,4 @@
+- add command line option --disable-stack-check for systems where R C stack checking is buggy
 - the modifier "not" for boolean properties returns a (negated) boolean sub-propery instead of just a string
 - add possibility to blacklist packages from fetching structure information. Package GO is blacklisted by default.
 - when fetching the structure of "promise" R objects, don't keep them in memory

Modified: trunk/rkward/rkward/main.cpp
===================================================================
--- trunk/rkward/rkward/main.cpp	2007-04-19 13:37:01 UTC (rev 1833)
+++ trunk/rkward/rkward/main.cpp	2007-04-20 11:18:29 UTC (rev 1834)
@@ -74,6 +74,7 @@
   { "+[File]", I18N_NOOP ("file to open"), 0 },
   { "debug-level <level>", I18N_NOOP ("Verbosity of debug messages (0-5)"), "2"}, 
   { "debug-flags <flags>", I18N_NOOP ("Mask for components to debug (see debug.h)"), "8191" }, 
+  { "disable-stack-check", I18N_NOOP ("Disable R C stack checking"), 0 }, 
   { 0, 0, 0 }
   // INSERT YOUR COMMANDLINE OPTIONS HERE
 };
@@ -103,23 +104,26 @@
 	argv[0] = qstrdup (QString (argv_zero_copy).remove (".bin").local8Bit ());
 	KCmdLineArgs::init( argc, argv, &aboutData );
 	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
-	
+
+	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+	RK_Debug_Level = 5 - QString (args->getOption ("debug-level")).toInt ();
+	RK_Debug_Flags = QString (args->getOption ("debug-flags")).toInt ();
+
+	RKWardStartupOptions *stoptions = new RKWardStartupOptions;
+	KURL *open_url = 0;
+	if (args->count ()) {
+		open_url = new KURL (args->makeURL (args->arg (0)));
+	}
+	stoptions->initial_url = open_url;
+	stoptions->no_stack_check = args->isSet ("disable-stack-check");
+
 	RKWardApplication app;
 	if (app.isRestored ()) {
 		RESTORE(RKWardMainWindow);	// well, whatever this is supposed to do -> TODO
 	} else {
-		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-		RK_Debug_Level = 5 - QString (args->getOption ("debug-level")).toInt ();
-		RK_Debug_Flags = QString (args->getOption ("debug-flags")).toInt ();
-		
-		KURL *open_url = 0;
-		if (args->count ()) {
-			open_url = new KURL (args->makeURL (args->arg (0)));
-		}
-		args->clear();
-		
-		new RKWardMainWindow(open_url);
+		new RKWardMainWindow(stoptions);
 	}
+	args->clear();
 
 	// do it!
 	int status = app.exec ();

Modified: trunk/rkward/rkward/rbackend/rinterface.h
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.h	2007-04-19 13:37:01 UTC (rev 1833)
+++ trunk/rkward/rkward/rbackend/rinterface.h	2007-04-20 11:18:29 UTC (rev 1834)
@@ -39,6 +39,7 @@
 class RThread;
 class RCommandReceiver;
 struct REvalRequest;
+struct RKWardStartupOptions;
 
 /** This class provides the main interface to the R-processor.
 

Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp	2007-04-19 13:37:01 UTC (rev 1833)
+++ trunk/rkward/rkward/rbackend/rthread.cpp	2007-04-20 11:18:29 UTC (rev 1834)
@@ -22,6 +22,7 @@
 #include "../settings/rksettingsmoduler.h"
 #include "../settings/rksettingsmodulegeneral.h"
 #include "../rkglobals.h"
+#include "../rkward.h"		// for startup options
 
 #include "../debug.h"
 
@@ -459,10 +460,17 @@
 
 	int argc = 2;
 	char* argv[2] = { qstrdup ("--slave"), qstrdup ("--no-save") };
+	RKWardStartupOptions *options = RKWardMainWindow::getStartupOptions ();
+	RK_ASSERT (options);
 
 	size_t stacksize;
 	void *stackstart;
-	RKGetCurrentThreadStackLimits (&stacksize, &stackstart);
+	if (options->no_stack_check) {
+		stacksize = (unsigned long) -1;
+		stackstart = (void *) -1;
+	} else {
+		RKGetCurrentThreadStackLimits (&stacksize, &stackstart);
+	}
 	startR (argc, argv, stacksize, stackstart);
 
 	connectCallbacks ();

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2007-04-19 13:37:01 UTC (rev 1833)
+++ trunk/rkward/rkward/rkward.cpp	2007-04-20 11:18:29 UTC (rev 1834)
@@ -90,7 +90,7 @@
 //static
 RKWardMainWindow *RKWardMainWindow::rkward_mainwin = 0;
 
-RKWardMainWindow::RKWardMainWindow (KURL *load_url) : DCOPObject ("rkwardapp"), KMdiMainFrm (0, 0, KMdi::IDEAlMode) {
+RKWardMainWindow::RKWardMainWindow (RKWardStartupOptions *options) : DCOPObject ("rkwardapp"), KMdiMainFrm (0, 0, KMdi::IDEAlMode) {
 	RK_TRACE (APP);
 	RK_ASSERT (rkward_mainwin == 0);
 
@@ -130,7 +130,13 @@
 	RKGlobals::mtracker = new RKModificationTracker (this);
 	RKComponentMap::initialize ();
 
-	initial_url = load_url;
+	if (options) {
+		startup_options = options;
+	} else {
+		startup_options = new RKWardStartupOptions;
+		startup_options->no_stack_check = false;
+		startup_options->initial_url = 0;
+	}
 
 	QTimer::singleShot (50, this, SLOT (doPostInit ()));
 
@@ -220,9 +226,10 @@
 	RKOutputWindow::initialize ();
 	RControlWindow::getControl ()->initialize ();
 
-	if (initial_url) {
-		openWorkspace (*initial_url);
-		delete initial_url;
+	if (startup_options->initial_url) {
+		openWorkspace (*(startup_options->initial_url));
+		delete (startup_options->initial_url);
+		startup_options->initial_url = 0;
 	} else {
 		StartupDialog::StartupDialogResult *result = StartupDialog::getStartupAction (this, fileOpenRecentWorkspace);
 		if (result->result == StartupDialog::EmptyWorkspace) {
@@ -247,6 +254,9 @@
 	}
 
 	setCaption (QString::null);	// our version of setCaption takes care of creating a correct caption, so we do not need to provide it here
+
+	delete startup_options;
+	startup_options = 0;
 }
 
 void RKWardMainWindow::initPlugins () {

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2007-04-19 13:37:01 UTC (rev 1833)
+++ trunk/rkward/rkward/rkward.h	2007-04-20 11:18:29 UTC (rev 1834)
@@ -59,17 +59,20 @@
 class RKMDIWindow;
 class QHBox;
 
+struct RKWardStartupOptions {
+	KURL *initial_url;	/**< The workspace file to load on startup. If 0, show a dialog asking what to do. **/
+	bool no_stack_check;	/**< Disable R C stack checking */
+};
+
 /**
 The main class of rkward. This is where all strings are tied togther, controlls the initialization, and there are some of the most important slots for user actions. All real work is done elsewhere.
 */
-
-
 class RKWardMainWindow : public KMdiMainFrm, virtual public KParts::PartBase, virtual public RKWardDCOPInterface {
 	Q_OBJECT
 public:
 /** construtor
- at param load_url The workspace file to load on startup. If 0, show a dialog asking what to do. */
-	RKWardMainWindow (KURL *load_url=0);
+ at param options Options from command line. RKWardMainWindow will take ownership of this pointer, and delete it, once not longer needed. */
+	RKWardMainWindow (RKWardStartupOptions *options = 0);
 /** destructor */
 	~RKWardMainWindow ();
 
@@ -91,6 +94,9 @@
 
 	void makeRKWardHelpMenu (QWidget *for_window, KActionCollection *ac);
 
+/** return pointer to startup options. WARNING: The options are deleted shortly after startup */
+	static RKWardStartupOptions* getStartupOptions () { return getMain()->startup_options; };
+
 /** (try to) close all windows, and ask whether it is ok to quit */
 	bool doQueryQuit ();
 protected:
@@ -246,7 +252,7 @@
 	/** Finds plugins and inserts them into the menu-structure */
 	void initPlugins ();
 
-	KURL *initial_url;
+	RKWardStartupOptions *startup_options;
 
 	static RKWardMainWindow *rkward_mainwin;
 


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