[Rcpp-commits] r1188 - pkg/Rcpp/inst/include/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat May 8 22:01:25 CEST 2010


Author: romain
Date: 2010-05-08 22:01:24 +0200 (Sat, 08 May 2010)
New Revision: 1188

Removed:
   pkg/Rcpp/inst/include/Rcpp/class_start.h
   pkg/Rcpp/inst/include/Rcpp/class_stop.h
Modified:
   pkg/Rcpp/inst/include/Rcpp/preprocessor.h
Log:
remove dead code

Deleted: pkg/Rcpp/inst/include/Rcpp/class_start.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/class_start.h	2010-05-07 16:15:00 UTC (rev 1187)
+++ pkg/Rcpp/inst/include/Rcpp/class_start.h	2010-05-08 20:01:24 UTC (rev 1188)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// class_start.h: Rcpp R/C++ interface class library -- preprocessor helpers
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-// no ifdef protection on purpose
-
-#undef RCPP_REGISTER 
-
-#ifndef RCPP_CLASS
-#error "the macro RCPP_CLASS must be defined to use the RCPP_CLASS_START"
-#else
-#define __RCPP__COLLECTOR RCPP_PP_CAT(rcpp__collector__, RCPP_CLASS)
-#define RCPP_METHOD(__METHOD__) RCPP_PP_CAT( RCPP_CLASS, RCPP_PP_CAT(__,__METHOD__ ))
-static std::vector<std::string> __RCPP__COLLECTOR ;
-#define RCPP_REGISTER(__NAME__) __RCPP__COLLECTOR.push_back( #__NAME__ ) ;
-#endif
-

Deleted: pkg/Rcpp/inst/include/Rcpp/class_stop.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/class_stop.h	2010-05-07 16:15:00 UTC (rev 1187)
+++ pkg/Rcpp/inst/include/Rcpp/class_stop.h	2010-05-08 20:01:24 UTC (rev 1188)
@@ -1,39 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// class_stop.h: Rcpp R/C++ interface class library -- preprocessor helpers
-//
-// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
-//
-// This file is part of Rcpp.
-//
-// Rcpp is free software: you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Rcpp is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
-
-// no ifdef protection on purpose
-
-#ifndef __RCPP__COLLECTOR
-#error "unpaired RCPP_CLASS_START/RCPP_CLASS_STOP"
-#else
-#undef __RCPP_BOOTSTRAP
-#define __RCPP_BOOTSTRAP RCPP_PP_CAT(__rcpp__class__bootstrap__,RCPP_CLASS)
-extern "C" __RCPP_BOOTSTRAP(){
-	return ::Rcpp::wrap( __RCPP__COLLECTOR ) ;	
-}
-#undef __RCPP_BOOTSTRAP
-#undef __RCPP__COLLECTOR
-#undef RCPP_CLASS
-#undef RCPP_REGISTER
-#undef RCPP_METHOD
-#define RCPP_REGISTER(__NAME__) 
-#endif
-

Modified: pkg/Rcpp/inst/include/Rcpp/preprocessor.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/preprocessor.h	2010-05-07 16:15:00 UTC (rev 1187)
+++ pkg/Rcpp/inst/include/Rcpp/preprocessor.h	2010-05-08 20:01:24 UTC (rev 1188)
@@ -56,8 +56,19 @@
 #endif
 
 #include <Rcpp/preprocessor_generated.h>
+// from boost preprocessor library
+#include <Rcpp/preprocessor/cat.hpp>
 
 #define RCPP_XP_FIELD_GET(__NAME__,__CLASS__,__FIELD__)        \
+extern "C" SEXP RCPP_PP_CAT(__NAME__,__rcpp_info__)(){         \
+	using Rcpp::_ ;                                            \
+	Rcpp::List info = Rcpp::List::create(                      \
+        _["class"]  = #__CLASS__  ,                            \
+        _["field"]  = #__FIELD__ ,                             \
+        )   ;                                                  \
+    info.attr( "class" ) = "rcppxpfieldgetinfo" ;              \
+    return info   ;                                            \
+}                                                              \
 extern "C" SEXP __NAME__( SEXP xp ){                           \
 	SEXP res = R_NilValue ;                                    \
 	BEGIN_RCPP                                                 \
@@ -68,6 +79,15 @@
 }
 
 #define RCPP_XP_FIELD_SET(__NAME__,__CLASS__,__FIELD__)        \
+extern "C" SEXP RCPP_PP_CAT(__NAME__,__rcpp_info__)(){         \
+	using Rcpp::_ ;                                            \
+	Rcpp::List info = Rcpp::List::create(                      \
+        _["class"]  = #__CLASS__  ,                            \
+        _["field"]  = #__FIELD__ ,                             \
+        )   ;                                                  \
+    info.attr( "class" ) = "rcppxpfieldsetinfo" ;              \
+    return info   ;                                            \
+}                                                              \
 extern "C" SEXP __NAME__( SEXP xp, SEXP value ){               \
 	BEGIN_RCPP                                                 \
 		::Rcpp::XPtr<__CLASS__> ptr(xp) ;                      \
@@ -77,8 +97,8 @@
 }
 
 #define RCPP_XP_FIELD(__PREFIX__,__CLASS__,__FIELD__)          \
-RCPP_XP_FIELD_GET( __PREFIX__##_get, __CLASS__, __FIELD__ )    \
-RCPP_XP_FIELD_SET( __PREFIX__##_set, __CLASS__, __FIELD__ )    
+RCPP_XP_FIELD_GET( RCPP_PP_CAT(__PREFIX__,_get), __CLASS__, __FIELD__ )    \
+RCPP_XP_FIELD_SET( RCPP_PP_CAT(__PREFIX__,_set), __CLASS__, __FIELD__ )    
 
 
 #define RCPP_TRAITS(__CLASS__,__SEXPTYPE__)                     \
@@ -123,10 +143,5 @@
 
 #define RCPP_REGISTER(__NAME__) 
 
-// from boost preprocessor library
-#include <Rcpp/preprocessor/cat.hpp>
 
-#define RCPP_CLASS_START <Rcpp/class_start.h>
-#define RCPP_CLASS_STOP <Rcpp/class_stop.h>
-
 #endif



More information about the Rcpp-commits mailing list