Ticket #32837: patch-rkward-rbackend-rkstructuregetter.cpp.diff
File patch-rkward-rbackend-rkstructuregetter.cpp.diff, 1.7 KB (added by meik.michalke@…, 11 years ago) |
---|
-
rkward/rbackend/rkstructuregetter.cpp
193 193 194 194 // get classes 195 195 SEXP classes_s; 196 QStringList classes; 196 197 197 198 if ((TYPEOF (value) == LANGSXP) || (TYPEOF (value) == SYMSXP)) { // if it's a call, we should NEVER send it through eval 198 extern SEXP R_data_class (SEXP, Rboolean); 199 classes_s = R_data_class (value, (Rboolean) 0); 199 // stripped down and adjusted from R_data_class 200 PROTECT (classes_s = Rf_getAttrib (value, R_ClassSymbol)); 201 if (Rf_length (classes_s)) classes = RKRSupport::SEXPToStringList(classes_s); 202 UNPROTECT (1); 203 if (classes.isEmpty ()) { 204 if (TYPEOF (value) == LANGSXP) { 205 SEXP symb = PROTECT (CAR (value)); 206 QString cl; 207 if (TYPEOF (symb) == SYMSXP) cl = CHAR (PRINTNAME (symb)); 208 UNPROTECT (1); 209 if ((cl != "if") && (cl != "while") && (cl != "for") && (cl != "=") && (cl != "<-") && (cl != "(") && (cl != "{")) cl = "call"; 210 classes = QStringList (cl); 211 } else { 212 classes = QStringList ("name"); 213 } 214 } 200 215 201 216 REPROTECT (value = Rf_coerceVector (value, EXPRSXP), value_index); // make sure the object is safe for everything to come 202 203 PROTECT (classes_s);204 217 } else { 205 classes_s = RKRSupport::callSimpleFun (class_fun, value, baseenv); 206 PROTECT (classes_s); 218 PROTECT (classes_s = RKRSupport::callSimpleFun (class_fun, value, baseenv)); 219 classes = RKRSupport::SEXPToStringList (classes_s); 220 UNPROTECT (1); 207 221 } 208 222 209 QStringList classes = RKRSupport::SEXPToStringList (classes_s);210 UNPROTECT (1); /* classes_s */211 212 223 // store classes 213 224 RData *classdata = new RData; 214 225 classdata->setData (classes);