[Rcpp-commits] r1251 - in pkg/Rcpp/inst: include include/Rcpp/traits unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon May 17 09:24:56 CEST 2010
Author: romain
Date: 2010-05-17 09:24:56 +0200 (Mon, 17 May 2010)
New Revision: 1251
Modified:
pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h
pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h
pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h
pkg/Rcpp/inst/include/RcppCommon.h
pkg/Rcpp/inst/unitTests/runit.macros.R
Log:
one more shot
Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2010-05-17 02:16:04 UTC (rev 1250)
+++ pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2010-05-17 07:24:56 UTC (rev 1251)
@@ -56,28 +56,12 @@
template<> struct r_sexptype_traits<short>{ enum{ rtype = INTSXP } ; } ;
template<> struct r_sexptype_traits<unsigned short>{ enum{ rtype = INTSXP } ; } ;
-// #ifdef __GNUC__
-// __extension__ typedef long long long_long_type;
-// __extension__ typedef unsigned long long ulong_long_type;
-// #else
-// typedef long long long_long_type;
-// typedef unsigned long long ulong_long_type;
-// #endif
-
/* long long int */
-//#ifdef __GNUC__
-//#ifdef HAS_CXX0X
-//#ifdef LONG_LONG_MAX
-//template<> struct r_sexptype_traits<long long int>{ enum{ rtype = REALSXP } ; } ;
-//#endif
+#ifdef RCPP_HAS_LONG_LONG_TYPES
+template<> struct r_sexptype_traits<rcpp_long_long_type>{ enum{ rtype = REALSXP } ; } ;
+template<> struct r_sexptype_traits<rcpp_ulong_long_type>{ enum{ rtype = REALSXP } ; } ;
+#endif
-/* unsigned long long int */
-//#ifdef ULONG_LONG_MAX
-//template<> struct r_sexptype_traits<unsigned long long int>{ enum{ rtype = REALSXP } ; } ;
-//#endif
-//#endif
-//#endif
-
/**
* Indicates if a primitive type needs a static_cast
*/
Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2010-05-17 02:16:04 UTC (rev 1250)
+++ pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2010-05-17 07:24:56 UTC (rev 1251)
@@ -111,30 +111,14 @@
template<> struct r_type_traits<unsigned short>{ typedef r_type_primitive_tag r_category ; } ;
template<> struct r_type_traits< std::pair<const std::string,unsigned short> >{ typedef r_type_primitive_tag r_category ; } ;
-// #ifdef __GNUC__
-// __extension__ typedef long long long_long_type;
-// __extension__ typedef unsigned long long ulong_long_type;
-// #else
-// typedef long long long_long_type;
-// typedef unsigned long long ulong_long_type;
-// #endif
-
-//#ifdef __GNUC__
-//#ifdef HAS_CXX0X
/* long long int */
-//#ifdef LONG_LONG_MAX
-//template<> struct r_type_traits<long long int>{ typedef r_type_primitive_tag r_category ; } ;
-//template<> struct r_type_traits< std::pair<const std::string,long long int> >{ typedef r_type_primitive_tag r_category ; } ;
-//#endif
+#ifdef RCPP_HAS_LONG_LONG_TYPES
+template<> struct r_type_traits<rcpp_long_long_type>{ typedef r_type_primitive_tag r_category ; } ;
+template<> struct r_type_traits< std::pair<const std::string,rcpp_long_long_type> >{ typedef r_type_primitive_tag r_category ; } ;
+template<> struct r_type_traits<rcpp_ulong_long_type>{ typedef r_type_primitive_tag r_category ; } ;
+template<> struct r_type_traits< std::pair<const std::string,rcpp_ulong_long_type> >{ typedef r_type_primitive_tag r_category ; } ;
+#endif
-/* unsigned long long int */
-//#ifdef ULONG_LONG_MAX
-//template<> struct r_type_traits<unsigned long long int>{ typedef r_type_primitive_tag r_category ; } ;
-//template<> struct r_type_traits< std::pair<const std::string,unsigned long long int> >{ typedef r_type_primitive_tag r_category ; } ;
-//#endif
-//#endif
-//#endif
-
} // traits
} // Rcpp
Modified: pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h 2010-05-17 02:16:04 UTC (rev 1250)
+++ pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h 2010-05-17 07:24:56 UTC (rev 1251)
@@ -71,26 +71,11 @@
template <> struct wrap_type_traits<short> { typedef wrap_type_primitive_tag wrap_category; } ;
template <> struct wrap_type_traits<unsigned short> { typedef wrap_type_primitive_tag wrap_category; } ;
-// #ifdef __GNUC__
-// __extension__ typedef long long long_long_type;
-// __extension__ typedef unsigned long long ulong_long_type;
-// #else
-// typedef long long long_long_type;
-// typedef unsigned long long ulong_long_type;
-// #endif
+#ifdef RCPP_HAS_LONG_LONG_TYPES
+template <> struct wrap_type_traits<rcpp_long_long_type> { typedef wrap_type_primitive_tag wrap_category; } ;
+template <> struct wrap_type_traits<rcpp_ulong_long_type> { typedef wrap_type_primitive_tag wrap_category; } ;
+#endif
-//#ifdef __GNUC__
-//#ifdef HAS_CXX0X
-//#ifdef LONG_LONG_MAX
-//template <> struct wrap_type_traits<long long int> { typedef wrap_type_primitive_tag wrap_category; } ;
-//#endif
-
-//#ifdef ULONG_LONG_MAX
-//template <> struct wrap_type_traits<unsigned long long int> { typedef wrap_type_primitive_tag wrap_category; } ;
-//#endif
-//#endif
-//#endif
-
} // namespace traits
} // namespace Rcpp
#endif
Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h 2010-05-17 02:16:04 UTC (rev 1250)
+++ pkg/Rcpp/inst/include/RcppCommon.h 2010-05-17 07:24:56 UTC (rev 1251)
@@ -196,6 +196,14 @@
#include <typeinfo>
#endif
+#ifdef __GNUC__
+#ifdef LONG_LONG_MAX
+ __extension__ typedef long long int rcpp_long_long_type;
+ __extension__ typedef unsigned long long int rcpp_ulong_long_type;
+ #define RCPP_HAS_LONG_LONG_TYPES
+#endif
+#endif
+
// DO NOT CHANGE THE ORDER OF THESE INCLUDES
#include <Rcpp/traits/integral_constant.h>
#include <Rcpp/traits/same_type.h>
Modified: pkg/Rcpp/inst/unitTests/runit.macros.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.macros.R 2010-05-17 02:16:04 UTC (rev 1250)
+++ pkg/Rcpp/inst/unitTests/runit.macros.R 2010-05-17 07:24:56 UTC (rev 1251)
@@ -125,62 +125,64 @@
}
-## test.RCPPXPMETHOD <- function(){
+test.RCPPXPMETHOD <- function(){
-## fx <- cppfunction( signature(), '
-## std::vector<int>* v = new std::vector<int>(5) ;
-## return XPtr< std::vector<int> >(v,true) ;
-## ' )
-## xp <- fx()
+ fx <- cppfunction( signature(), '
+ std::vector<int>* v = new std::vector<int>(5) ;
+ v->push_back( 5 ) ;
+ return XPtr< std::vector<int> >(v,true) ;
+ ' )
+ xp <- fx()
-## f_size <- cppfunction( signature( xp = "externalptr" ), '
-## return get_size( xp ) ;
-## ', includes = '
-## RCPP_XP_METHOD_0( get_size, std::vector<int>, size )
-## ' )
-## checkEquals( f_size(xp), 5L, msg = "RCPP_XP_METHOD_0" )
+ f_back <- cppfunction( signature( xp = "externalptr" ), '
+ return get_back( xp ) ;
+ ', includes = '
+ RCPP_XP_METHOD_0( get_back, std::vector<int>, back )
+ ' )
+ checkEquals( f_back(xp), 5L, msg = "RCPP_XP_METHOD_0" )
-## info <- .getInfo( "get_size", f_size )
-## checkEquals( info[["n"]], 0L )
-## checkEquals( info[["class"]], "std::vector<int>" )
-## checkEquals( info[["method"]], "size")
-## checkEquals( class(info), "rcppxpmethodinfo" )
+ info <- .getInfo( "get_back", f_size )
+ checkEquals( info[["n"]], 0L )
+ checkEquals( info[["class"]], "std::vector<int>" )
+ checkEquals( info[["method"]], "back")
+ checkEquals( class(info), "rcppxpmethodinfo" )
-## f_push_back <- cppfunction( signature( xp = "externalptr", x = "integer" ), '
-## vec_push_back( xp, x );
-## return R_NilValue ;
-## ', includes = '
-## RCPP_XP_METHOD_VOID_1( vec_push_back, std::vector<int>, push_back )
-## ' )
-## f_push_back( xp, 10L )
-## f_push_back( xp, 20L )
-## checkEquals( f_size(xp), 7L, msg = "RCPP_XP_METHOD_0" )
+ f_push_back <- cppfunction( signature( xp = "externalptr", x = "integer" ), '
+ vec_push_back( xp, x );
+ return R_NilValue ;
+ ', includes = '
+ RCPP_XP_METHOD_VOID_1( vec_push_back, std::vector<int>, push_back )
+ ' )
+ f_push_back( xp, 10L )
+ checkEquals( f_back(xp), 10L, msg = "RCPP_XP_METHOD_0" )
+ f_push_back( xp, 20L )
+ checkEquals( f_back(xp), 20L, msg = "RCPP_XP_METHOD_0" )
-## info <- .getInfo( "vec_push_back", f_push_back )
-## checkEquals( info[["n"]], 1L )
-## checkEquals( info[["class"]], "std::vector<int>" )
-## checkEquals( info[["method"]], "push_back")
-## checkEquals( class(info), "rcppxpmethodvoidinfo" )
+ info <- .getInfo( "vec_push_back", f_push_back )
+ checkEquals( info[["n"]], 1L )
+ checkEquals( info[["class"]], "std::vector<int>" )
+ checkEquals( info[["method"]], "push_back")
+ checkEquals( class(info), "rcppxpmethodvoidinfo" )
-## f_front_cast <- cppfunction( signature( xp = "externalptr" ), '
-## return front( xp ) ;
-## ', includes = '
-## RCPP_XP_METHOD_CAST_0( front, std::vector<int>, front, double )
-## ' )
-## checkEquals( f_front_cast(xp), 0, msg = "RCPP_XP_METHOD_CAST value" )
-## checkEquals( typeof( f_front_cast(xp) ), "double", msg = "RCPP_XP_METHOD_CAST type" )
+ f_front_cast <- cppfunction( signature( xp = "externalptr" ), '
+ return front( xp ) ;
+ ', includes = '
+ RCPP_XP_METHOD_CAST_0( front, std::vector<int>, front, double )
+ ' )
+ checkEquals( f_front_cast(xp), 0, msg = "RCPP_XP_METHOD_CAST value" )
+ checkEquals( typeof( f_front_cast(xp) ), "double", msg = "RCPP_XP_METHOD_CAST type" )
-## info <- .getInfo( "front", f_front_cast )
-## checkEquals( info[["n"]], 0L )
-## checkEquals( info[["class"]], "std::vector<int>" )
-## checkEquals( info[["method"]], "front")
-## checkEquals( info[["cast"]], "double")
+ info <- .getInfo( "front", f_front_cast )
+ checkEquals( info[["n"]], 0L )
+ checkEquals( info[["class"]], "std::vector<int>" )
+ checkEquals( info[["method"]], "front")
+ checkEquals( info[["cast"]], "double")
-## checkEquals( class(info), "rcppxpmethodcastinfo" )
+ checkEquals( class(info), "rcppxpmethodcastinfo" )
-## }
+}
test.RCPPXPFIELD <- function(){
More information about the Rcpp-commits
mailing list