[Rcpp-commits] r3478 - pkg/Rcpp/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 15 17:34:46 CET 2012


Author: edd
Date: 2012-02-15 17:34:46 +0100 (Wed, 15 Feb 2012)
New Revision: 3478

Modified:
   pkg/Rcpp/src/S4.cpp
Log:
another Doug patch

Modified: pkg/Rcpp/src/S4.cpp
===================================================================
--- pkg/Rcpp/src/S4.cpp	2012-02-15 16:13:28 UTC (rev 3477)
+++ pkg/Rcpp/src/S4.cpp	2012-02-15 16:34:46 UTC (rev 3478)
@@ -69,16 +69,22 @@
         if( ! clazz.compare( cl[0] ) ) return true ;
                 
         try{
+            SEXP containsSym = ::Rf_install("contains");
+            CharacterVector res(::Rf_getAttrib(
+                                    ::R_do_slot(::R_getClassDef(CHAR(::Rf_asChar(as<SEXP>(cl)))),
+                                                containsSym),
+                                    R_NamesSymbol));
+
             // 
             // mimic the R call: 
             // names( slot( getClassDef( cl ), "contains" ) )
             // 
-            SEXP slotSym = Rf_install( "slot" ), // cannot cause gc() once in symbol table
-                getClassDefSym = Rf_install( "getClassDef" );
-            CharacterVector res = internal::try_catch(Rf_lang2(R_NamesSymbol,
-                                                               Rf_lang3(slotSym,
-                                                                        Rf_lang2( getClassDefSym, cl ), 
-                                                                        Rf_mkString( "contains" )))) ;
+            // SEXP slotSym = Rf_install( "slot" ), // cannot cause gc() once in symbol table
+            //     getClassDefSym = Rf_install( "getClassDef" );
+            // CharacterVector res = internal::try_catch(Rf_lang2(R_NamesSymbol,
+            //                                                    Rf_lang3(slotSym,
+            //                                                             Rf_lang2( getClassDefSym, cl ), 
+            //                                                             Rf_mkString( "contains" )))) ;
             return any( res.begin(), res.end(), clazz.c_str() ) ;
         } catch( ... ){
             // we catch eval_error and also not_compatible when 



More information about the Rcpp-commits mailing list