[rkward-cvs] SF.net SVN: rkward-code:[4660] trunk/rkward/rkward/rbackend/ rkstructuregetter.cpp

tfry at users.sf.net tfry at users.sf.net
Thu Apr 4 07:12:34 UTC 2013


Revision: 4660
          http://sourceforge.net/p/rkward/code/4660
Author:   tfry
Date:     2013-04-04 07:12:31 +0000 (Thu, 04 Apr 2013)
Log Message:
-----------
Fix some problems with the R_data_class replacement.

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rkstructuregetter.cpp

Modified: trunk/rkward/rkward/rbackend/rkstructuregetter.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkstructuregetter.cpp	2013-04-03 06:51:35 UTC (rev 4659)
+++ trunk/rkward/rkward/rbackend/rkstructuregetter.cpp	2013-04-04 07:12:31 UTC (rev 4660)
@@ -198,13 +198,13 @@
 	if ((TYPEOF (value) == LANGSXP) || (TYPEOF (value) == SYMSXP)) {	// if it's a call, we should NEVER send it through eval
 		// stripped down and adjusted from R_data_class
 		PROTECT (classes_s = Rf_getAttrib (value, R_ClassSymbol));
-		classes = RKRSupport::SEXPToStringList(classes_s);
+		if (Rf_length (classes_s)) classes = RKRSupport::SEXPToStringList(classes_s);
 		UNPROTECT (1);
 		if (classes.isEmpty ()) {
 			if (TYPEOF (value) == LANGSXP) {
-				SEXP cl_s = PRINTNAME (value);
-				PROTECT (cl_s);
-				QString cl = RKRSupport::SEXPToString (cl_s);
+				SEXP symb = PROTECT (CAR (value));
+				QString cl;
+				if (TYPEOF (symb) == SYMSXP) cl = CHAR (PRINTNAME (symb));
 				UNPROTECT (1);
 				if ((cl != "if") && (cl != "while") && (cl != "for") && (cl != "=") && (cl != "<-") && (cl != "(") && (cl != "{")) cl = "call";
 				classes = QStringList (cl);





More information about the rkward-tracker mailing list