[Rcpp-commits] r4118 - in pkg/RcppClassic: . src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Dec 9 16:25:45 CET 2012
Author: romain
Date: 2012-12-09 16:25:45 +0100 (Sun, 09 Dec 2012)
New Revision: 4118
Modified:
pkg/RcppClassic/ChangeLog
pkg/RcppClassic/src/RcppResultSet.cpp
Log:
anticipate change in rcpp 0.10.2
Modified: pkg/RcppClassic/ChangeLog
===================================================================
--- pkg/RcppClassic/ChangeLog 2012-12-09 15:09:14 UTC (rev 4117)
+++ pkg/RcppClassic/ChangeLog 2012-12-09 15:25:45 UTC (rev 4118)
@@ -1,3 +1,8 @@
+2012-12-09 Romain Francois <romain at r-enthusiasts.com>
+
+ * src/RcppResultSet.cpp : define getPosixClasses, new_posixt_object and
+ new_date_object as these will no longer be included in Rcpp 0.10.2
+
2012-07-23 Dirk Eddelbuettel <edd at debian.org>
* DESCRIPTION: Release 0.9.2
Modified: pkg/RcppClassic/src/RcppResultSet.cpp
===================================================================
--- pkg/RcppClassic/src/RcppResultSet.cpp 2012-12-09 15:09:14 UTC (rev 4117)
+++ pkg/RcppClassic/src/RcppResultSet.cpp 2012-12-09 15:25:45 UTC (rev 4118)
@@ -4,7 +4,7 @@
//
// Copyright (C) 2005 - 2006 Dominick Samperi
// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
-// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
//
// This file is part of RcppClassic.
//
@@ -26,7 +26,35 @@
RcppResultSet::RcppResultSet() : numProtected(0), values() { }
namespace Rcpp {
-
+
+ // these functions are no longer exported in Rcpp.h as of Rcpp 0.10.2
+ #if defined(RCPP_VERSION) && RCPP_VERSION > Rcpp_Version(0,10,1)
+ namespace internal{
+
+ SEXP getPosixClasses(){
+ SEXP datetimeclass = PROTECT(Rf_allocVector(STRSXP,2));
+ SET_STRING_ELT(datetimeclass, 0, Rf_mkChar("POSIXct"));
+ SET_STRING_ELT(datetimeclass, 1, Rf_mkChar("POSIXt"));
+ UNPROTECT(1) ;
+ return datetimeclass ;
+ }
+
+ SEXP new_posixt_object( double d){
+ SEXP x = PROTECT( Rf_ScalarReal( d ) ) ;
+ Rf_setAttrib(x, R_ClassSymbol, getPosixClasses() );
+ UNPROTECT(1);
+ return x ;
+ }
+
+ SEXP new_date_object( double d){
+ SEXP x = PROTECT(Rf_ScalarReal( d ) ) ;
+ Rf_setAttrib(x, R_ClassSymbol, Rf_mkString("Date"));
+ UNPROTECT(1);
+ return x;
+ }
+ }
+ #endif
+
// template specialisation for wrap() on the date and datetime classes
template <> SEXP wrap(const RcppDate &date) {
return internal::new_date_object( date.getJDN() - RcppDate::Jan1970Offset ) ;
More information about the Rcpp-commits
mailing list