[rkward-cvs] SF.net SVN: rkward:[3068] trunk/rkward/rkward/rbackend
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Sep 23 07:32:42 UTC 2010
Revision: 3068
http://rkward.svn.sourceforge.net/rkward/?rev=3068&view=rev
Author: tfry
Date: 2010-09-23 07:32:42 +0000 (Thu, 23 Sep 2010)
Log Message:
-----------
Fix for R 2.12.0
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rembedinternal.cpp
trunk/rkward/rkward/rbackend/rembedinternal.h
Modified: trunk/rkward/rkward/rbackend/rembedinternal.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rembedinternal.cpp 2010-09-23 06:57:09 UTC (rev 3067)
+++ trunk/rkward/rkward/rbackend/rembedinternal.cpp 2010-09-23 07:32:42 UTC (rev 3068)
@@ -127,6 +127,8 @@
QString SEXPToString (SEXP from_exp);
int *SEXPToIntArray (SEXP from_exp, unsigned int *count);
int SEXPToInt (SEXP from_exp, int def_value = INT_MIN);
+SEXP parseCommand (const QString &command_qstring, REmbedInternal::RKWardRError *error);
+SEXP runCommandInternalBase (SEXP pr, REmbedInternal::RKWardRError *error);
// ############## R Standard callback overrides BEGIN ####################
void RSuicide (const char* message) {
@@ -873,6 +875,15 @@
connectCallbacks();
+ // get info on R runtime version
+ REmbedInternal::RKWardRError error;
+ unsigned int count;
+ int *dummy = getCommandAsIntVector ("as.numeric (R.version$major) * 1000 + as.numeric (R.version$minor) * 10", &count, &error);
+ RK_ASSERT ((error == REmbedInternal::NoError) && (count == 1));
+ if (count) r_version = dummy[0];
+ else r_version = 0;
+ delete [] dummy;
+
return true;
}
@@ -1011,6 +1022,9 @@
} while (((repldll_result = R_ReplDLLdo1 ()) == 2) && (!repldll_buffer_transfer_finished)); // keep iterating while the statement is incomplete, and we still have more in the buffer to transfer
//Rprintf ("iteration complete, status: %d\n", repldll_result);
PROTECT (R_LastvalueSymbol); // why do we need this? No idea, but R_ToplevelExec tries to unprotect something
+ if (REmbedInternal::this_pointer->RRuntimeIsVersion (2, 11, 9)) {
+ PROTECT (R_LastvalueSymbol); // ... and with R 2.12.0 it tries to unprotect two things
+ }
}
void REmbedInternal::runCommandInternal (const QString &command_qstring, RKWardRError *error, bool print_result) {
Modified: trunk/rkward/rkward/rbackend/rembedinternal.h
===================================================================
--- trunk/rkward/rkward/rbackend/rembedinternal.h 2010-09-23 06:57:09 UTC (rev 3067)
+++ trunk/rkward/rkward/rbackend/rembedinternal.h 2010-09-23 07:32:42 UTC (rev 3068)
@@ -162,6 +162,10 @@
static REmbedInternal *this_pointer;
static char *na_char_internal;
bool r_running;
+/** Check whether the runtime version of R is at least the given version. Valid only *after* startR() has been called! */
+ bool RRuntimeIsVersion (int major, int minor, int revision) {
+ return (r_version >= (1000 * major + 10 * minor + revision));
+ }
/** Flags used to classify output. */
// static bool output_is_warning;
@@ -169,6 +173,7 @@
// static bool next_output_is_error;
QTextCodec *current_locale_codec;
private:
+ int r_version;
// can't declare this as part of the class, as it would confuse REmbed
// SEXPREC *runCommandInternalBase (const char *command, bool *error);
};
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