[rkward-cvs] SF.net SVN: rkward: [1043] trunk/rkward/rkward/rbackend
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Jan 2 13:10:13 UTC 2007
Revision: 1043
http://svn.sourceforge.net/rkward/?rev=1043&view=rev
Author: tfry
Date: 2007-01-02 05:10:13 -0800 (Tue, 02 Jan 2007)
Log Message:
-----------
krazy fixes
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rcommand.h
trunk/rkward/rkward/rbackend/rinterface.cpp
trunk/rkward/rkward/rbackend/rinterface.h
trunk/rkward/rkward/rbackend/rthread.h
Modified: trunk/rkward/rkward/rbackend/rcommand.h
===================================================================
--- trunk/rkward/rkward/rbackend/rcommand.h 2007-01-02 13:04:52 UTC (rev 1042)
+++ trunk/rkward/rkward/rbackend/rcommand.h 2007-01-02 13:10:13 UTC (rev 1043)
@@ -124,7 +124,7 @@
@param receiver The RCommandReceiver this command should be passed on to, when finished.
@param flags A freely assignable integer, that you can use to identify what the command was all about. Only the RCommandReceiver handling the results will have to know what exactly the flags mean.
*/
- RCommand (const QString &command, int type = 0, const QString &rk_equiv = QString::null, RCommandReceiver *receiver=0, int flags=0);
+ explicit RCommand (const QString &command, int type = 0, const QString &rk_equiv = QString::null, RCommandReceiver *receiver=0, int flags=0);
/** destructor. Note: you should not delete RCommands manually. This is done in RInterface. TODO: make protected */
~RCommand();
/** @returns the type as specified in RCommand::RCommand */
@@ -172,7 +172,7 @@
HasWarnings=16, /**< command has warning-message(s) retrievable via RCommand::warnings () */
ErrorIncomplete=512, /**< backend rejected command as being incomplete */
ErrorSyntax=1024, /**< backend rejected command as having a syntax error */
- ErrorOther=2048, /**< another error (not incomplete, not syntax error) has occured while trying to execute the command */
+ ErrorOther=2048, /**< another error (not incomplete, not syntax error) has occurred while trying to execute the command */
Canceled=8192 /**< Command was cancelled. */
};
/** the command has been passed to the backend. */
Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp 2007-01-02 13:04:52 UTC (rev 1042)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp 2007-01-02 13:10:13 UTC (rev 1043)
@@ -181,7 +181,7 @@
message.append (i18n ("\t-There was a problem opening the files needed for communication with R. Most likely this is due to an incorrect setting for the location of these files. Check whether you have correctly configured the location of the log-files (Settings->Configure Settings->Logfiles) and restart RKWard.\n"));
}
if (err & RThread::OtherFail) {
- message.append (i18n ("\t-An unspecified error occured that is not yet handled by RKWard. Likely RKWard will not function properly. Please check your setup.\n"));
+ message.append (i18n ("\t-An unspecified error occurred that is not yet handled by RKWard. Likely RKWard will not function properly. Please check your setup.\n"));
}
KMessageBox::error (0, message, i18n ("Error starting R"));
r_thread->unlock (RThread::Startup);
@@ -322,7 +322,7 @@
if (request->call_length >= 2) {
QString lib_name = request->call[1];
issueCommand (".rk.rkreply <- NULL", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
- KMessageBox::information (0, i18n ("The R-backend has indicated that in order to carry out the current task it needs the package '%1', which is not currently installed. We'll open the package-management tool, and there you can try to locate and install the needed package.").arg (lib_name), i18n ("Require package '%1'").arg (lib_name));
+ KMessageBox::information (0, i18n ("The R-backend has indicated that in order to carry out the current task it needs the package '%1', which is not currently installed. We will open the package-management tool, and there you can try to locate and install the needed package.").arg (lib_name), i18n ("Require package '%1'").arg (lib_name));
RKLoadLibsDialog::showInstallPackagesModal (0, request->in_chain, lib_name);
issueCommand (".rk.rkreply <- \"\"", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);
} else {
Modified: trunk/rkward/rkward/rbackend/rinterface.h
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.h 2007-01-02 13:04:52 UTC (rev 1042)
+++ trunk/rkward/rkward/rbackend/rinterface.h 2007-01-02 13:10:13 UTC (rev 1043)
@@ -93,7 +93,7 @@
RThread *r_thread;
/** Timer to trigger flushing output */
QTimer *flush_timer;
-/** cancelling the command that is (or seems to be) currently running is tricky: In order to do so, we need to signal an interrupt to the RThread. We need this pointer to find out, when the command has actually been interrupted, and we can resume processing. */
+/** canceling the command that is (or seems to be) currently running is tricky: In order to do so, we need to signal an interrupt to the RThread. We need this pointer to find out, when the command has actually been interrupted, and we can resume processing. */
RCommand *running_command_canceled;
/** See \ref RThread::doSubstack (). Does the actual job. */
@@ -134,7 +134,7 @@
\endcode
You will note, that actually there are two RInterface::issueCommand functions, this one is obviously the one taking a QString and several further
-parameters as argument. It is actually quite similar to the other RInterface::issueCommand function which takes an RCommand as a paramter. This convenience class basically just creates an RCommand with the same parameters as the constructor of RCommand (RCommand::RCommand), and then submits this RCommand. We'll discuss what an RCommand really is further down below. For now a good enough explanations is, that it's simply a container for a command.
+parameters as argument. It is actually quite similar to the other RInterface::issueCommand function which takes an RCommand as a parameter. This convenience class basically just creates an RCommand with the same parameters as the constructor of RCommand (RCommand::RCommand), and then submits this RCommand. We'll discuss what an RCommand really is further down below. For now a good enough explanations is, that it's simply a container for a command.
The first parameter here is fairly obvious, the command-string the R backend should evaluate.
@@ -144,7 +144,7 @@
\section UsingTheInterfaceToRHandlingReturns A slightly more realistic example: Handling the result of an RCommand
-Most of the time you don't just want to run a command, but you also want to know the result. Now, this is a tad bit more difficult than one might expect at first glance. The reason for this is that the R backend runs in a separate thread. Hence, whenever you submit a command, it generally does not get executed right away - or at least you just don't know, when exactly it gets executed, and when the result is available. This is neccessary, so (expensive) commands running in the backend do not block operations in the GUI/frontend.
+Most of the time you don't just want to run a command, but you also want to know the result. Now, this is a tad bit more difficult than one might expect at first glance. The reason for this is that the R backend runs in a separate thread. Hence, whenever you submit a command, it generally does not get executed right away - or at least you just don't know, when exactly it gets executed, and when the result is available. This is necessary, so (expensive) commands running in the backend do not block operations in the GUI/frontend.
Ok, so how do you get informed, when your command was completed? Using RCommandReceiver. What you will want to do is inherit the class you
want to handle the results of RCommands from RCommandReceiver. When finished, the RCommand will be submitted to the (pure virtual) RCommandReceiver::rCommandDone function, which of course you'll have to implement in a meaningful way in your derived class.
Modified: trunk/rkward/rkward/rbackend/rthread.h
===================================================================
--- trunk/rkward/rkward/rbackend/rthread.h 2007-01-02 13:04:52 UTC (rev 1042)
+++ trunk/rkward/rkward/rbackend/rthread.h 2007-01-02 13:10:13 UTC (rev 1043)
@@ -86,7 +86,7 @@
more errors/crashes. @see unlock @see RInterface::cancelCommand @see RInterface::pauseProcessing
@param reason As there are several reasons to lock the thread, and more than one reason may be in place at a given time, a reason needs to be specified for both lock () and unlock (). Only if all "reasons are unlocked ()", processing continues. */
void lock (LockType reason) { locked |= reason; };
-/** Unlocks the thread. Also the thread may get locked when cancelling the currently running command. @see lock */
+/** Unlocks the thread. Also the thread may get locked when canceling the currently running command. @see lock */
void unlock (LockType reason) { locked -= (locked & reason); };
/** "Kills" the thread. Actually this just tells the thread that is is about to be terminated. Allows the thread to terminate gracefully */
void kill () { killed = true; };
@@ -184,7 +184,7 @@
unsigned int global_env_toplevel_count;
/** A list of symbols that have been assigned new values during the current command */
QStringList changed_symbol_names;
-/** check wether the object list / global environemnt / individual symbols have changed, and updates them, if needed */
+/** check wether the object list / global environment / individual symbols have changed, and updates them, if needed */
void checkObjectUpdatesNeeded (bool check_list);
};
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