[rkward-cvs] SF.net SVN: rkward: [882] trunk/rkward/rkward/rbackend
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Oct 19 14:11:46 UTC 2006
Revision: 882
http://svn.sourceforge.net/rkward/?rev=882&view=rev
Author: tfry
Date: 2006-10-19 07:11:38 -0700 (Thu, 19 Oct 2006)
Log Message:
-----------
Also do search list and global env updates in subchains
Add rk.edit () call
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rinterface.cpp
trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
trunk/rkward/rkward/rbackend/rthread.cpp
trunk/rkward/rkward/rbackend/rthread.h
Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp 2006-10-19 12:34:18 UTC (rev 881)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp 2006-10-19 14:11:38 UTC (rev 882)
@@ -162,13 +162,6 @@
RKwardApp::getApp ()->setRStatus (false);
} else if ((e->type () == RBUSY_EVENT)) {
RKwardApp::getApp ()->setRStatus (true);
- } else if ((e->type () == RSEARCHLIST_CHANGED_EVENT)) {
- RK_DO (qDebug ("triggering update of object list"), RBACKEND, DL_DEBUG);
- RObjectList::getObjectList ()->updateFromR (0);
- } else if ((e->type () == RGLOBALENV_SYMBOLS_CHANGED_EVENT)) {
- RK_DO (qDebug ("triggering update of globalenv"), RBACKEND, DL_DEBUG);
- // TODO: maybe this should be put inside a chain
- RObjectList::getGlobalEnv ()->updateFromR (0);
} else if ((e->type () == R_EVAL_REQUEST_EVENT)) {
r_thread->pauseOutput (false); // we may be recursing downwards into event loops here. Hence we need to make sure, we don't create a deadlock
processREvalRequest (static_cast<REvalRequest *> (e->data ()));
@@ -304,6 +297,26 @@
RK_DO (qDebug ("lookup failed for changed symbol %s", object_name.latin1 ()), RBACKEND, DL_WARNING);
}
}
+ } else if (call == "syncall") {
+ RK_ASSERT (request->call_length == 1);
+
+ RK_DO (qDebug ("triggering update of object list"), RBACKEND, DL_DEBUG);
+ RObjectList::getObjectList ()->updateFromR (request->in_chain);
+ } else if (call == "syncglobal") {
+ RK_ASSERT (request->call_length == 1);
+
+ RK_DO (qDebug ("triggering update of globalenv"), RBACKEND, DL_DEBUG);
+ RObjectList::getGlobalEnv ()->updateFromR (request->in_chain);
+ } else if (call == "edit") {
+ RK_ASSERT (request->call_length >= 2);
+
+ for (int i = 1; i < request->call_length; ++i) {
+ QString object_name = request->call[i];
+ RObject *obj = RObjectList::getObjectList ()->findObject (object_name);
+ if (!(obj && RKWorkplace::mainWorkplace()->editObject (obj, false))) {
+ KMessageBox::information (0, i18n ("The object '%1', could not be opened for editing. Either it does not exist, or RKWard does not support editing this type of object, yet.").arg (object_name), i18n ("Cannot edit '%1'").arg (object_name));
+ }
+ }
} else if (call == "require") {
if (request->call_length >= 2) {
QString lib_name = request->call[1];
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R 2006-10-19 12:34:18 UTC (rev 881)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public.R 2006-10-19 14:11:38 UTC (rev 882)
@@ -82,6 +82,11 @@
.rk.do.call ("sync", object)
}
+"rk.edit" <- function (x) {
+ object <- deparse (substitute (x))
+ .rk.do.call ("edit", object)
+}
+
"rk.get.tempfile.name" <- function (prefix="image", extension=".jpg") {
return (.rk.do.call ("get.tempfile.name", c (prefix, extension)))
}
Modified: trunk/rkward/rkward/rbackend/rthread.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.cpp 2006-10-19 12:34:18 UTC (rev 881)
+++ trunk/rkward/rkward/rbackend/rthread.cpp 2006-10-19 14:11:38 UTC (rev 882)
@@ -84,6 +84,10 @@
while (locked) {
msleep (10);
}
+
+ MUTEX_LOCK;
+ checkObjectUpdatesNeeded (true);
+ MUTEX_UNLOCK;
while (1) {
MUTEX_LOCK;
@@ -449,11 +453,10 @@
if (error) status |= OtherFail;
// TODO: error-handling?
- checkObjectUpdatesNeeded (true);
-
MUTEX_LOCK;
flushOutput ();
MUTEX_UNLOCK;
+
QCustomEvent *event = new QCustomEvent (RCOMMAND_OUT_EVENT);
event->setData (current_command);
qApp->postEvent (RKGlobals::rInterface (), event);
@@ -517,11 +520,15 @@
global_env_toplevel_count = count;
if (search_update_needed) { // this includes an update of the globalenv, even if not needed
- QCustomEvent *event = new QCustomEvent (RSEARCHLIST_CHANGED_EVENT);
- qApp->postEvent (RKGlobals::rInterface (), event);
+ QString call = "syncall";
+ MUTEX_UNLOCK;
+ handleSubstackCall (&call, 1);
+ MUTEX_LOCK;
} else if (globalenv_update_needed) {
- QCustomEvent *event = new QCustomEvent (RGLOBALENV_SYMBOLS_CHANGED_EVENT);
- qApp->postEvent (RKGlobals::rInterface (), event);
+ QString call = "syncglobal";
+ MUTEX_UNLOCK;
+ handleSubstackCall (&call, 1);
+ MUTEX_LOCK;
}
}
Modified: trunk/rkward/rkward/rbackend/rthread.h
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.h 2006-10-19 12:34:18 UTC (rev 881)
+++ trunk/rkward/rkward/rbackend/rthread.h 2006-10-19 14:11:38 UTC (rev 882)
@@ -38,8 +38,6 @@
#define R_CALLBACK_REQUEST_EVENT 12002
// don't use the numbers following RSTARTUP_ERROR_EVENT, because an error code will be added!
#define RSTARTUP_ERROR_EVENT 13000
-#define RSEARCHLIST_CHANGED_EVENT 14000
-#define RGLOBALENV_SYMBOLS_CHANGED_EVENT 14001
/** This class represents the thread the R backend is running in. So to speak, this is where the "eventloop" of R is running. The main thing happening
in this class, is that an infinite loop is running. Whenever there are commands to be executed, those get evaluated. Also, at regular intervals,
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