[Rcpp-commits] r3433 - in pkg/Rcpp: . inst inst/doc/Rcpp-FAQ inst/doc/Rcpp-modules inst/include inst/include/Rcpp inst/include/Rcpp/int64 inst/include/Rcpp/internal inst/include/Rcpp/module inst/include/Rcpp/traits inst/unitTests inst/unitTests/testRcppModule/src src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Dec 25 16:28:42 CET 2011
Author: edd
Date: 2011-12-25 16:28:41 +0100 (Sun, 25 Dec 2011)
New Revision: 3433
Removed:
pkg/Rcpp/inst/include/Rcpp/int64/LongVector.h
pkg/Rcpp/inst/include/Rcpp/int64/get_bits.h
pkg/Rcpp/inst/include/Rcpp/int64/get_class.h
pkg/Rcpp/inst/include/Rcpp/int64/get_long.h
pkg/Rcpp/inst/include/Rcpp/int64/int64_lite.h
pkg/Rcpp/inst/include/Rcpp/int64/new_long.h
pkg/Rcpp/inst/include/Rcpp/int64/read_string.h
pkg/Rcpp/inst/include/Rcpp/traits/or.h
pkg/Rcpp/inst/unitTests/runit.int64.R
pkg/Rcpp/src/int64_lite.cpp
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/DESCRIPTION
pkg/Rcpp/inst/NEWS
pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw
pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
pkg/Rcpp/inst/include/Rcpp/as.h
pkg/Rcpp/inst/include/Rcpp/internal/export.h
pkg/Rcpp/inst/include/Rcpp/internal/wrap.h
pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Pointer_CppMethod.h
pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Pointer_method.h
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.Module.client.package.R
pkg/Rcpp/inst/unitTests/runit.XPTr.R
pkg/Rcpp/inst/unitTests/runit.client.package.R
pkg/Rcpp/inst/unitTests/runit.macros.R
pkg/Rcpp/inst/unitTests/testRcppModule/src/stdVector.cpp
Log:
The big cleanup commit, removing int64 from trunk
The changes were tested extensive on Linux (64 bit), Windows (32 bit and win-builder 32/64)
A local virtual Windows XP instance was used to fine-tune the unitTests for some new Windows failures
The code also passes the example scripts, and build tests again RcppGSL and RcppDE where 0.9.8 broke
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/ChangeLog 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,3 +1,20 @@
+2011-12-24 Dirk Eddelbuettel <edd at debian.org>
+
+ * Reverting the 'int64' changes listed below (during the period from
+ Oct-31 to Nov-07) which adversely affect packages using Rcpp
+ We will re-apply the 'int64' changes in a way which should
+ cooperate more easily with 'long' and 'unsigned long'
+ This covered svn revisions 3264 to 3308.
+
+ * DESCRIPTION: Remove (for now) Depends: on int64
+ * inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw: Dito for int64_t example
+
+ * inst/unitTests/runit.Module.client.package.R: On Windows,
+ deactivate 'test.Module.package'
+
+ * inst/unitTests/runit.client.package.R: On Windows, deactivate
+ 'test.client.packageA' test
+
2011-12-23 Dirk Eddelbuettel <edd at debian.org>
* inst/unitTests/runTests.R: unit tests output 'fallback' directory
Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/DESCRIPTION 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,6 +1,6 @@
Package: Rcpp
Title: Seamless R and C++ Integration
-Version: 0.9.8
+Version: 0.9.8.4
Date: $Date$
Author: Dirk Eddelbuettel and Romain Francois,
with contributions by Douglas Bates and John Chambers
@@ -38,7 +38,7 @@
been factored out of Rcpp into the package RcppClassic, and it is still
available for code relying on the older interface. New development, however,
should use the Rcpp package instead.
-Depends: R (>= 2.12.0), methods, int64
+Depends: R (>= 2.12.0), methods
Suggests: RUnit, inline, rbenchmark
URL: http://dirk.eddelbuettel.com/code/rcpp.html, http://romainfrancois.blog.free.fr/index.php?category/R-package/Rcpp
License: GPL (>= 2)
Modified: pkg/Rcpp/inst/NEWS
===================================================================
--- pkg/Rcpp/inst/NEWS 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/NEWS 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,7 +1,16 @@
0.9.9 2012-xx-yy
+ o Reverting the 'int64' changes listed below (during the period from
+ Oct-31 to Nov-07) which adversely affect packages using Rcpp
+ We will re-apply the 'int64' changes in a way which should
+ cooperate more easily with 'long' and 'unsigned long'.
+ This covered svn revisions 3249 and 3264 to 3308.
+
o Unit test output directory fallback changed to use Rcpp.Rcheck/
+ o Conditioned two unit tests to not run on Windows where they now break
+ whereas they passed before, and continue to pass on other OSs
+
0.9.8 2011-12-21
o wrap now handles 64 bit integers (int64_t, uint64_t) and containers
Modified: pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw 2011-12-25 15:28:41 UTC (rev 3433)
@@ -546,33 +546,40 @@
@
%
-\subsection{Can I use 64 bits integer types ?}
+\subsection{Why can long long types not be cast correctly?}
-Yes. Since version 0.9.8, \pkg{Rcpp} depends on the \pkg{int64}
-package. \pkg{int64} brings 64 bit integer vectors to R, with the
-two S4 classes \code{int64} and \code{uint64} that internally
-handle C++ types \code{int64\_t} and \code{uint64\_t}.
+That is a good and open question. We rely on the basic \proglang{R} types,
+notably \code{integer} and \code{numeric}. These can be cast to and from
+\proglang{C++} types without problems. But there are corner cases. The
+following example, contributed by a user, shows that we cannot reliably cast
+\code{long} types (on a 64-bit machines).
-\pkg{Rcpp}'s \code{wrap} function is able to handle the
-primitives \code{int64\_t} and \code{uint64\_t} as well as containers
-of these:
-
-<<>>=
+<<eval=FALSE>>=
BigInts <- cxxfunction(signature(),
- 'std::vector<int64_t> bigints;
+ 'std::vector<long> bigints;
bigints.push_back(12345678901234567LL);
bigints.push_back(12345678901234568LL);
Rprintf("Difference of %ld\\n", 12345678901234568LL - 12345678901234567LL);
- return wrap(bigints);',
-plugin="Rcpp" )
+ return wrap(bigints);', plugin="Rcpp", includes="#include <vector>")
retval<-BigInts()
-retval
+
+# Unique 64-bit integers were cast to identical lower precision numerics
+# behind my back with no warnings or errors whatsoever. Error.
+
+stopifnot(length(unique(retval)) == 2)
@
+%
-The vignette in the \pkg{int64} package has the details on how 64 bit
-integer types are handled. In short, we split the higher bits and the lower
-into two integers.
+While the difference of one is evident at the \proglang{C++} level, it is no
+longer present once cast to \proglang{R}. The 64-bit integer values get cast
+to a floating point types with a 53-bit mantissa. We do not have a good
+suggestion or fix for casting 64-bit integer values: 32-bit integer values
+fit into \code{integer} types, up to 53 bit precision fits into
+\code{numeric} and beyond that truly large integers may have to converted
+(rather crudely) to text and re-parsed. Using a different representation as
+for example from the \href{http://gmplib.org/}{GNU Multiple Precision Arithmetic
+ Library} may be an alternative.
\section{Support}
Modified: pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw 2011-12-25 15:28:41 UTC (rev 3433)
@@ -930,7 +930,7 @@
} )
@
-% TODO: mention R inheritance (John ?)
+TODO: mention R inheritance (John ?)
\subsubsection{Full example}
@@ -961,12 +961,6 @@
obj->at( i ) = value;
}
-int vec_size( vec* obj ){ return obj->size(); }
-int vec_max_size( vec* obj){ return obj->max_size() ; }
-int vec_capacity( vec* obj){ return obj->capacity() ; }
-void vec_reserve( vec* obj, int n){ obj->reserve( n ); }
-void vec_resize(vec* obj, int n){ obj->resize(n); }
-
RCPP_MODULE(mod_vec) {
using namespace Rcpp;
@@ -978,12 +972,12 @@
.constructor<int>()
// exposing member functions
- .method( "size", &vec_size)
- .method( "max_size", &vec_max_size)
- .method( "capacity", &vec_capacity)
- .method( "resize", &vec_resize)
- .method( "reserve", &vec_reserve)
+ .method( "size", &vec::size)
+ .method( "max_size", &vec::max_size)
+ .method( "resize", &vec::resize)
+ .method( "capacity", &vec::capacity)
.method( "empty", &vec::empty)
+ .method( "reserve", &vec::reserve)
.method( "push_back", &vec::push_back )
.method( "pop_back", &vec::pop_back )
.method( "clear", &vec::clear )
@@ -1030,13 +1024,6 @@
obj->at( i ) = value;
}
-int vec_size( vec* obj ){ return obj->size(); }
-int vec_max_size( vec* obj){ return obj->max_size() ; }
-int vec_capacity( vec* obj){ return obj->capacity() ; }
-void vec_reserve( vec* obj, int n){ obj->reserve( n ); }
-void vec_resize(vec* obj, int n){ obj->resize(n); }
-double vec_at( const vec* obj, int i){ return obj->at(i); }
-
RCPP_MODULE(mod_vec) {
using namespace Rcpp;
@@ -1048,12 +1035,12 @@
.constructor<int>()
// exposing member functions
- .method( "size", &vec_size)
- .method( "max_size", &vec_max_size)
- .method( "capacity", &vec_capacity)
- .method( "resize", &vec_resize)
- .method( "reserve", &vec_reserve)
+ .method( "size", &vec::size)
+ .method( "max_size", &vec::max_size)
+ .method( "resize", &vec::resize)
+ .method( "capacity", &vec::capacity)
.method( "empty", &vec::empty)
+ .method( "reserve", &vec::reserve)
.method( "push_back", &vec::push_back )
.method( "pop_back", &vec::pop_back )
.method( "clear", &vec::clear )
@@ -1061,7 +1048,7 @@
// specifically exposing const member functions
.const_method( "back", &vec::back )
.const_method( "front", &vec::front )
- .const_method( "at", &vec_at )
+ .const_method( "at", &vec::at )
// exposing free functions taking a std::vector<double>*
// as their first argument
@@ -1070,7 +1057,7 @@
.method( "as.vector", &vec_asR )
// special methods for indexing
- .const_method( "[[", &vec_at )
+ .const_method( "[[", &vec::at )
.method( "[[<-", &vec_set )
;
Modified: pkg/Rcpp/inst/include/Rcpp/as.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/as.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/as.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -53,32 +53,6 @@
return exporter.get() ;
}
- template <typename T> T as(SEXP x, ::Rcpp::traits::r_type_int64_tag){
- if( Rf_inherits( x, "int64" ) ){
- Rcpp::int64::LongVector<int64_t> data(x) ;
- return data.get(0) ;
- } else if( TYPEOF(x) == INTSXP ){
- return (int64_t)INTEGER(x)[0] ;
- } else if( TYPEOF(x) == REALSXP ){
- return (int64_t)REAL(x)[0] ;
- } else {
- Rf_error("expexting an int64_t, an integer or a numeric value") ;
- }
- }
-
- template <typename T> T as(SEXP x, ::Rcpp::traits::r_type_uint64_tag){
- if( Rf_inherits( x, "uint64" ) ){
- Rcpp::int64::LongVector<uint64_t> data(x) ;
- return data.get(0) ;
- } else if( TYPEOF(x) == INTSXP ){
- return (uint64_t)INTEGER(x)[0] ;
- } else if( TYPEOF(x) == REALSXP ){
- return (uint64_t)REAL(x)[0] ;
- } else {
- Rf_error("expexting an uint64, an integer or a numeric value") ;
- }
- }
-
}
Deleted: pkg/Rcpp/inst/include/Rcpp/int64/LongVector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/int64/LongVector.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/int64/LongVector.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,159 +0,0 @@
-// LongVector.h : 64 bit integers
-//
-// Copyright (C) 2011 Romain Francois and Dirk Eddelbuettel
-// Copyright (C) 2011 Google Inc. All rights reserved.
-//
-// 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/>.
-
-#ifndef Rcpp__int64__LongVector_h
-#define Rcpp__int64__LongVector_h
-
-namespace Rcpp{
- namespace int64{
-
-template <class LONG>
- class LongVector {
- private :
- SEXP data ;
-
- public:
- LongVector(SEXP x) : data(R_NilValue) {
- if( Rf_inherits( x, get_class<LONG>().c_str() ) ){
- data = x ;
- R_PreserveObject(data) ;
- } else {
- switch( TYPEOF(x) ){
- case INTSXP:
- {
- int n = Rf_length(x) ;
- SEXP y = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
- int hb, lb ;
- LONG tmp ;
- int* p_i_x = INTEGER(x) ;
- for( int i=0; i<n; i++){
- tmp = (LONG) p_i_x[i] ;
- hb = get_high_bits<LONG>(tmp) ;
- lb = get_low_bits<LONG>(tmp) ;
- SET_VECTOR_ELT( y, i, Rcpp::int64::int2(hb,lb) ) ;
- }
- UNPROTECT(1) ; // y
- data = y ;
- R_PreserveObject(data) ;
- break ;
- }
- case REALSXP:
- {
- int n = Rf_length(x) ;
- SEXP y = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
- int hb, lb ;
- LONG tmp ;
- double* p_d_x = REAL(x) ;
- for( int i=0; i<n; i++){
- tmp = (LONG) p_d_x[i] ;
- hb = get_high_bits<LONG>(tmp) ;
- lb = get_low_bits<LONG>(tmp) ;
- SET_VECTOR_ELT( y, i, Rcpp::int64::int2(hb,lb) ) ;
- }
- UNPROTECT(1) ; // y
- data = y ;
- R_PreserveObject(data) ;
- break ;
- }
- case STRSXP:
- {
- int n = Rf_length(x) ;
- SEXP y = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
- int hb, lb ;
- LONG tmp ;
- for( int i=0; i<n; i++){
- tmp = read_string<LONG>( CHAR(STRING_ELT(x,i)) ) ;
- hb = get_high_bits<LONG>(tmp) ;
- lb = get_low_bits<LONG>(tmp) ;
- SET_VECTOR_ELT( y, i, Rcpp::int64::int2(hb,lb) ) ;
- }
- UNPROTECT(1) ; // y
- data = y ;
- R_PreserveObject(data) ;
- break ;
- }
- default:
- {
- Rf_error( "unimplemented conversion" ) ;
- }
- }
- }
- }
-
- operator SEXP(){
- std::string klass = get_class<LONG>() ;
- SEXP res = PROTECT(
- R_do_slot_assign(
- R_do_new_object( R_do_MAKE_CLASS( klass.c_str() ) ),
- Rf_install(".Data"),
- data ) ) ;
- UNPROTECT(1) ;
- return res ;
-
- }
-
- LongVector(int n) : data(R_NilValue) {
- SEXP x = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
- for( int i=0; i<n; i++){
- SET_VECTOR_ELT( x, i, Rcpp::int64::int2(0,0) ) ;
- }
- UNPROTECT(1) ; // x
- data = x ;
- R_PreserveObject(data) ;
- }
-
- template <typename ITERATOR>
- LongVector(int n, ITERATOR start, ITERATOR end) : data(R_NilValue) {
- SEXP x = PROTECT( Rf_allocVector( VECSXP, n ) ) ;
- int hb, lb ;
- for( int i=0; i<n; i++, ++start){
- hb = get_high_bits<LONG>(*start) ;
- lb = get_low_bits<LONG>(*start) ;
- SET_VECTOR_ELT( x, i, Rcpp::int64::int2(hb,lb) ) ;
- }
- UNPROTECT(1) ; // x
- data = x ;
- R_PreserveObject(data) ;
- }
-
-
- ~LongVector(){
- if( !Rf_isNull(data)) R_ReleaseObject(data) ;
- }
-
- inline LONG get(int i) const {
- int* p = INTEGER(VECTOR_ELT(data,i)) ;
- return Rcpp::int64::get_long<LONG>( p[0], p[1] ) ;
- }
-
- inline void set(int i, LONG x){
- int* p = INTEGER(VECTOR_ELT(data,i)) ;
- p[0] = Rcpp::int64::get_high_bits(x) ;
- p[1] = Rcpp::int64::get_low_bits(x) ;
- }
-
- inline int size() const { return Rf_length(data); }
-
- } ;
-
-
- }
-}
-#endif
Deleted: pkg/Rcpp/inst/include/Rcpp/int64/get_bits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/int64/get_bits.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/int64/get_bits.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,41 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
-//
-// get_bits.h : Rcpp R/C++ interface class library --
-//
-// Copyright (C) 2011 Romain Francois
-// Copyright (C) 2011 Google Inc. All rights reserved.
-//
-// 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/>.
-
-#ifndef Rcpp__int64__get_bits__h
-#define Rcpp__int64__get_bits__h
-
-namespace Rcpp{
- namespace int64{
-
-template <typename T64>
-inline int get_low_bits( T64 x){
- return (int)( x & 0x00000000FFFFFFFF ) ;
-}
-
-template <typename T64>
-inline int get_high_bits( T64 x){
- return (int)( x >> 32 ) ;
-}
-
- } // namespace int64
-} // namespace Rcpp
-#endif
Deleted: pkg/Rcpp/inst/include/Rcpp/int64/get_class.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/int64/get_class.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/int64/get_class.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,43 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
-//
-// get_class.h : Rcpp R/C++ interface class library --
-//
-// Copyright (C) 2011 Romain Francois
-// Copyright (C) 2011 Google Inc. All rights reserved.
-//
-// 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/>.
-
-#ifndef Rcpp__int64__get_class__h
-#define Rcpp__int64__get_class__h
-
-namespace Rcpp{
- namespace int64{
-
- template <typename T>
- inline std::string get_class(){ return "" ; }
-
- template <>
- inline std::string get_class<int64_t>(){
- return "int64" ;
- }
- template <>
- inline std::string get_class<uint64_t>(){
- return "uint64" ;
- }
-
- } // namespace int64
-} // namespace Rcpp
-#endif
Deleted: pkg/Rcpp/inst/include/Rcpp/int64/get_long.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/int64/get_long.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/int64/get_long.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,36 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
-//
-// get_long.h : Rcpp R/C++ interface class library --
-//
-// Copyright (C) 2011 Romain Francois
-// Copyright (C) 2011 Google Inc. All rights reserved.
-//
-// 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/>.
-
-#ifndef Rcpp__int64__get_long__h
-#define Rcpp__int64__get_long__h
-
-namespace Rcpp{
- namespace int64{
-
-template <typename T>
-inline T get_long( int highbits, int lowbits ){
- return ( ( (T) (unsigned int)highbits ) << 32 ) | ( (T) (unsigned int)lowbits ) ;
-}
-
- } // namespace int64
-} // namespace Rcpp
-#endif
Deleted: pkg/Rcpp/inst/include/Rcpp/int64/int64_lite.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/int64/int64_lite.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/int64/int64_lite.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,39 +0,0 @@
-// int64_lite.h : 64 bit integers
-//
-// Copyright (C) 2011 Romain Francois and Dirk Eddelbuettel
-// Copyright (C) 2011 Google Inc. All rights reserved.
-//
-// 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/>.
-
-#ifndef int64__lite_h
-#define int64__lite_h
-
-namespace Rcpp{
- namespace int64{
- SEXP int2(int,int);
-
- template <typename LONG> class LongVector ;
- }
-}
-
-#include <Rcpp/int64/get_class.h>
-#include <Rcpp/int64/get_long.h>
-#include <Rcpp/int64/read_string.h>
-#include <Rcpp/int64/get_bits.h>
-#include <Rcpp/int64/new_long.h>
-#include <Rcpp/int64/LongVector.h>
-
-#endif
Deleted: pkg/Rcpp/inst/include/Rcpp/int64/new_long.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/int64/new_long.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/int64/new_long.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,45 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
-//
-// new_long.h : Rcpp R/C++ interface class library --
-//
-// Copyright (C) 2011 Romain Francois
-// Copyright (C) 2011 Google Inc. All rights reserved.
-//
-// 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/>.
-
-#ifndef Rcpp__int64__new_long__h
-#define Rcpp__int64__new_long__h
-
-namespace Rcpp{
- namespace int64{
-
- template <typename LONG>
- SEXP new_long(LONG x){
- std::string klass = get_class<LONG>() ;
- int64::LongVector<LONG> y(1) ;
- y.set(0, x) ;
- SEXP res = PROTECT(
- R_do_slot_assign(
- R_do_new_object( R_do_MAKE_CLASS( klass.c_str() ) ),
- Rf_install(".Data"),
- y ) ) ;
- UNPROTECT(1) ;
- return res ;
- }
-
- } // namespace int64
-} // namespace Rcpp
-#endif
Deleted: pkg/Rcpp/inst/include/Rcpp/int64/read_string.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/int64/read_string.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/int64/read_string.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -1,45 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 4 -*-
-//
-// read_string.h : Rcpp R/C++ interface class library --
-//
-// Copyright (C) 2011 Romain Francois
-// Copyright (C) 2011 Google Inc. All rights reserved.
-//
-// 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/>.
-
-#ifndef Rcpp__int64__read_string__h
-#define Rcpp__int64__read_string__h
-
-namespace Rcpp{
- namespace int64{
-
- template <typename LONG>
- inline LONG read_string(const char* s) ;
-
- template <>
- inline int64_t read_string<int64_t>(const char* s ){
- return strtoll( s, NULL, 0 ) ;
- }
-
- template <>
- inline uint64_t read_string<uint64_t>(const char* s){
- return strtoull( s, NULL, 0 ) ;
- }
-
-
- } // namespace int64
-} // namespace Rcpp
-#endif
Modified: pkg/Rcpp/inst/include/Rcpp/internal/export.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/internal/export.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/internal/export.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -66,50 +66,6 @@
}
}
- /* iterators over int64_t */
- template <typename InputIterator, typename value_type>
- void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_int64_tag ) {
- int n = Rf_length(x) ;
- if( Rf_inherits( x, "int64" ) ){
- Rcpp::int64::LongVector<int64_t> data(x) ;
- for( int i=0; i<n; i++, ++first){
- *first = data.get(i) ;
- }
- } else if( TYPEOF(x) == INTSXP ){
- int* p_i_x = INTEGER(x) ;
- for( int i=0; i<n; i++, ++first){
- *first = (int64_t)p_i_x[i] ;
- }
- } else if( TYPEOF(x) == REALSXP ){
- double* p_d_x = REAL(x) ;
- for( int i=0; i<n; i++, ++first){
- *first = (int64_t)p_d_x[i] ;
- }
- }
- }
-
- /* iterators over uint64_t */
- template <typename InputIterator, typename value_type>
- void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_uint64_tag ) {
- int n = Rf_length(x) ;
- if( Rf_inherits( x, "uint64" ) ){
- Rcpp::int64::LongVector<uint64_t> data(x) ;
- for( int i=0; i<n; i++, ++first){
- *first = data.get(i) ;
- }
- } else if( TYPEOF(x) == INTSXP ){
- int* p_i_x = INTEGER(x) ;
- for( int i=0; i<n; i++, ++first){
- *first = (uint64_t)p_i_x[i] ;
- }
- } else if( TYPEOF(x) == REALSXP ){
- double* p_d_x = REAL(x) ;
- for( int i=0; i<n; i++, ++first){
- *first = (uint64_t)p_d_x[i] ;
- }
- }
- }
-
template <typename InputIterator>
void export_range( SEXP x, InputIterator first ) {
export_range__dispatch<InputIterator,typename std::iterator_traits<InputIterator>::value_type>(
@@ -119,6 +75,7 @@
);
}
+
/* indexing */
template <typename T, typename value_type>
@@ -165,56 +122,7 @@
}
}
- /* indexing int64_t */
template <typename T, typename value_type>
- void export_indexing__dispatch( SEXP x, T& res, ::Rcpp::traits::r_type_int64_tag ) {
- int n = Rf_length(x) ;
- if( Rf_inherits( x, "int64")){
- Rcpp::int64::LongVector<int64_t> data(x) ;
- for( int i=0; i<n; i++){
- res[i] = data.get(i) ;
- }
- } else if( TYPEOF(x) == INTSXP ){
- int* p_i_x = INTEGER(x) ;
- for( int i=0; i<n; i++){
- res[i] = (int64_t)p_i_x[i] ;
- }
- } else if( TYPEOF(x) == REALSXP ){
- double* p_d_x = REAL(x) ;
- for( int i=0; i<n; i++){
- res[i] = (int64_t)p_d_x[i] ;
- }
- } else {
- Rf_error( "expecting an int64 an integer or a numeric vector" );
- }
- }
-
- /* indexing int64_t */
- template <typename T, typename value_type>
- void export_indexing__dispatch( SEXP x, T& res, ::Rcpp::traits::r_type_uint64_tag ) {
- int n = Rf_length(x) ;
- if( Rf_inherits( x, "uint64")){
- Rcpp::int64::LongVector<uint64_t> data(x) ;
- for( int i=0; i<n; i++){
- res[i] = data.get(i) ;
- }
- } else if( TYPEOF(x) == INTSXP ){
- int* p_i_x = INTEGER(x) ;
- for( int i=0; i<n; i++){
- res[i] = (uint64_t)p_i_x[i] ;
- }
- } else if( TYPEOF(x) == REALSXP ){
- double* p_d_x = REAL(x) ;
- for( int i=0; i<n; i++){
- res[i] = (uint64_t)p_d_x[i] ;
- }
- } else {
- Rf_error( "expecting an uint64 an integer or a numeric vector" );
- }
- }
-
-
- template <typename T, typename value_type>
void export_indexing( SEXP x, T& res ) {
export_indexing__dispatch<T,value_type>(
x,
Modified: pkg/Rcpp/inst/include/Rcpp/internal/wrap.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/internal/wrap.h 2011-12-23 14:15:32 UTC (rev 3432)
+++ pkg/Rcpp/inst/include/Rcpp/internal/wrap.h 2011-12-25 15:28:41 UTC (rev 3433)
@@ -250,16 +250,6 @@
typename ::Rcpp::traits::r_sexptype_needscast<typename T::second_type>() ) ;
}
-template <typename InputIterator, typename T>
-inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_int64_tag){
- return Rcpp::int64::LongVector<T>( std::distance(first, last), first, last ) ;
-}
-template <typename InputIterator, typename T>
-inline SEXP range_wrap_dispatch___impl( InputIterator first, InputIterator last, ::Rcpp::traits::r_type_uint64_tag){
- return Rcpp::int64::LongVector<T>( std::distance(first, last), first, last ) ;
-}
-
-
/**
* Range based wrap implementation that deals with iterators over
* pair<const string, U> where U is wrappable. This is the kind of
@@ -630,27 +620,8 @@
return x ;
}
-template <typename T, typename elem_type>
-inline SEXP wrap_dispatch_importer_int64( const T& object ){
- int size = object.size() ;
- Rcpp::int64::LongVector<elem_type> res(size) ;
- for( int i=0; i<size; i++){
- res.set(i, object.get(i) ) ;
- }
- return res ;
-}
template <typename T, typename elem_type>
-inline SEXP wrap_dispatch_importer__impl( const T& object, ::Rcpp::traits::r_type_int64_tag ){
- return wrap_dispatch_importer_int64<T,elem_type>( object ) ;
-}
-template <typename T, typename elem_type>
-inline SEXP wrap_dispatch_importer__impl( const T& object, ::Rcpp::traits::r_type_uint64_tag ){
- return wrap_dispatch_importer_int64<T,elem_type>( object ) ;
-}
-
-
-template <typename T, typename elem_type>
inline SEXP wrap_dispatch_importer( const T& object ){
return wrap_dispatch_importer__impl<T,elem_type>( object,
typename ::Rcpp::traits::r_type_traits<elem_type>::r_category()
@@ -715,17 +686,6 @@
inline SEXP wrap_dispatch( const T& object, ::Rcpp::traits::wrap_type_unknown_tag ){
return wrap_dispatch_unknown_importable( object, typename ::Rcpp::traits::is_importer<T>::type() ) ;
}
-
-/**
- * This is called by wrap when the wrap_type_traits is wrap_type_int64_tag
- *
- * This wraps a single int64
- */
-template <typename T>
-inline SEXP wrap_dispatch( const T& object, ::Rcpp::traits::wrap_type_int64_tag ){
- return Rcpp::int64::new_long<T>( object ) ;
-}
-
// }}}
// {{{ wrap a container that is structured in row major order
Modified: pkg/Rcpp/inst/include/Rcpp/module/Module_generated_Pointer_CppMethod.h
===================================================================
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rcpp -r 3433
More information about the Rcpp-commits
mailing list