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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Oct 9 10:43:10 UTC 2006


Revision: 832
          http://svn.sourceforge.net/rkward/?rev=832&view=rev
Author:   tfry
Date:     2006-10-09 03:43:02 -0700 (Mon, 09 Oct 2006)

Log Message:
-----------
Fix the do_browser issue by initializing the console buffer via R_ReplDLLinit ()

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/TODO
    trunk/rkward/rkward/rbackend/rembedinternal.cpp
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2006-10-08 23:28:43 UTC (rev 831)
+++ trunk/rkward/ChangeLog	2006-10-09 10:43:02 UTC (rev 832)
@@ -1,3 +1,4 @@
+- do not crash on call to "browser ()"
 - the object browser is updated automatically when needed
 - allow some more configuration in object browser
 - include all package environments in object list

Modified: trunk/rkward/TODO
===================================================================
--- trunk/rkward/TODO	2006-10-08 23:28:43 UTC (rev 831)
+++ trunk/rkward/TODO	2006-10-09 10:43:02 UTC (rev 832)
@@ -16,15 +16,6 @@
 		- Produce lots and lots of output -> watch mem usage grow
 		- Probably the RKConsole is to blame (run outside console -> no significant increase)
 			- Maybe the kate-part needs to be reset (syntax parse tree) every once in a while?
-	- A call to "browser ()" *will* crash rkward.
-		- I suppose it's a long jump out of the tryEval context.
-			- do_browser() seems to guard against that. Instead, it's likely that the console io buffer is used, but not set up
-		- investigate why exactly this happens, and whether it's fixable in R or rkward
-		- maybe we can fix this issue (and save other work), by actually running User/Console commands through run_Rmainloop. The command-text would be fed in via R_ReadConsole (would need to keep a buffer). To terminate the loop, we can return 0 there, which should get us out.
-			- How to differentiate readline calls to get new command data from readline calls to get user info?! The prompt may not be realiable enough. Is there other info?
-				- the hist parameter may be a hint, but is also set in do_browser
-				- Does R_ResetConsole play any role in this?
-			- Where would we jump after a SIGINT?
 	- rnorm () and friends auto-print value only once. R_Visible is 0 on subsequent calls (what in the world is going on, here?)
 
 Compilation / technical
@@ -77,6 +68,15 @@
 	- use RKGlobals::marginHint (), RKGlobals::spacingHint () everywhere
 
 Internal stuff:
+	- maybe we can do stuff like auto-printing, toplevel handlers, syntax error information by using R_ReplDLLdo1 () for user/console commands
+		The command-text would be fed in via R_ReadConsole (would need to keep a buffer).
+			- How to differentiate readline calls to get new command data from readline calls to get user info?! The prompt may not be realiable enough. Is there other info?
+				- the hist parameter may be a hint, but is also set in do_browser
+				- Does R_ResetConsole play any role in this?
+				- maybe (but this would really be taking chances) do so by determining, if the buffer belongs to the main Repl_Console (currently that buffer always remains the same during one loop, but can we be certain, this never changes?)
+				- RBusy is set to 0 just before the command data is read!
+			- Where would we jump after a SIGINT? I suppose we'd have to make sure to clear the buffer before signalling (another mutex)
+			- It's R_ReplDLLinit (), and R_ReplDLLdo1 () for us, not run_Rmainloop!
 	RCommandReceiver:
 		- add virtual rCommandStarted () function, so receivers can find out, when their command becomes active
 	REmbedInternal:

Modified: trunk/rkward/rkward/rbackend/rembedinternal.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rembedinternal.cpp	2006-10-08 23:28:43 UTC (rev 831)
+++ trunk/rkward/rkward/rbackend/rembedinternal.cpp	2006-10-09 10:43:02 UTC (rev 832)
@@ -48,6 +48,16 @@
 #define R_2_3
 #endif
 
+#if (R_VERSION > R_Version(2, 3, 9))
+#define R_2_4
+#endif
+
+#ifdef R_2_4
+#include "Rembedded.h"
+#else
+extern void R_ReplDLLinit (void);
+#endif
+
 // some functions we need that are not declared
 extern int Rf_initEmbeddedR(int argc, char **argv);
 extern SEXP R_ParseVector(SEXP, int, ParseStatus*);
@@ -444,10 +454,12 @@
 	R_CStackLimit = (unsigned long) -1;
 	setup_Rmainloop ();
 	RKGlobals::na_double = NA_REAL;
+	R_ReplDLLinit ();
 	return true;
 #else
 	bool ok = (Rf_initEmbeddedR (argc, argv) >= 0);
 	RKGlobals::na_double = NA_REAL;
+	R_ReplDLLinit ();
 	return ok;
 #endif
 }

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2006-10-08 23:28:43 UTC (rev 831)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2006-10-09 10:43:02 UTC (rev 832)
@@ -194,10 +194,6 @@
 	eval (substitute (class (x) <<- classes))
 }
 
-"browser" <- function (...) {
-	stop ("Function browser () is disabled, as it will crash rkward. We're investigating this issue.")
-}
-
 # these functions can be used to track assignments to R objects. The main interfaces are .rk.watch.symbol (k) and .rk.unwatch.symbol (k). This works by copying the symbol to a backup environment, removing it, and replacing it by an active binding to the backup location
 ".rk.watched.symbols" <- new.env ()
 


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