[Rcpp-commits] r4095 - in pkg/Rcpp: . inst/include inst/include/Rcpp inst/include/Rcpp/api/meat src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 6 02:20:20 CET 2012


Author: romain
Date: 2012-12-06 02:20:19 +0100 (Thu, 06 Dec 2012)
New Revision: 4095

Added:
   pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h
Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/DataFrame.h
   pkg/Rcpp/inst/include/Rcpp/DottedPair.h
   pkg/Rcpp/inst/include/Rcpp/Promise.h
   pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h
   pkg/Rcpp/inst/include/Rcpp/grow.h
   pkg/Rcpp/inst/include/Rcpp/r_cast.h
   pkg/Rcpp/inst/include/RcppCommon.h
   pkg/Rcpp/src/DottedPair.cpp
   pkg/Rcpp/src/posixt.cpp
   pkg/Rcpp/src/r_cast.cpp
Log:
includes

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/ChangeLog	2012-12-06 01:20:19 UTC (rev 4095)
@@ -14,6 +14,8 @@
         of templates using as and wrap
         * include/RcppCommon.h: removed unused test_named
         * src/RcppCommon.cpp: removed unused test_named
+        * src/r_cast.cpp: less includes
+        * src/posixt.cpp: less includes
         
 2012-12-05  JJ Allaire <jj at rstudio.org>
 

Modified: pkg/Rcpp/inst/include/Rcpp/DataFrame.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DataFrame.h	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/inst/include/Rcpp/DataFrame.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -23,6 +23,7 @@
 #define Rcpp__DataFrame_h
 
 #include <RcppCommon.h>
+#include <Rcpp/r_cast.h>
 #include <Rcpp/Vector.h>
 
 namespace Rcpp{

Modified: pkg/Rcpp/inst/include/Rcpp/DottedPair.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/DottedPair.h	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/inst/include/Rcpp/DottedPair.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -2,7 +2,7 @@
 //
 // DottedPair.h: Rcpp R/C++ interface class library -- dotted pair list template
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -23,12 +23,7 @@
 #define Rcpp_DottedPair_h
 
 #include <RcppCommon.h>
-#include <Rcpp/exceptions.h>
-
-#include <Rcpp/Symbol.h>
-#include <Rcpp/grow.h>
 #include <Rcpp/Named.h>
-
 #include <Rcpp/RObject.h>
 
 namespace Rcpp{ 
@@ -64,20 +59,7 @@
 	 * are treated specially
 	 */
 	template <typename T>
-	void push_back( const T& object){
-		if( isNULL() ){
-			setSEXP( grow( object, m_sexp ) ) ;
-		} else {
-			SEXP x = m_sexp ;
-			/* traverse the pairlist */
-			while( !Rf_isNull(CDR(x)) ){
-				x = CDR(x) ;
-			}
-			SEXP tail = PROTECT( pairlist( object ) ); 
-			SETCDR( x, tail ) ;
-			UNPROTECT(1) ;
-		}
-	}
+	void push_back( const T& object) ;
 
 	/**
 	 * wraps an object and add it in front of the pairlist. 
@@ -86,9 +68,7 @@
 	 * of the wrap functions, or an object of class Named
 	 */
 	template <typename T>
-	void push_front( const T& object){
-		setSEXP( grow(object, m_sexp) ) ;
-	}
+	void push_front( const T& object) ;
 
 	/**
 	 * insert an object at the given position, pushing other objects
@@ -98,27 +78,7 @@
 	 * @param object object to wrap
 	 */
 	template <typename T>
-	void insert( const size_t& index, const T& object) {
-		if( index == 0 ) {
-			push_front( object ) ;
-		} else{
-		    // tautological comparison flagged by clang++
-//			if( index <  0 ) throw index_out_of_bounds() ;
-			if( isNULL( ) ) throw index_out_of_bounds() ;
-			
-			if( static_cast<R_len_t>(index) > ::Rf_length(m_sexp) ) throw index_out_of_bounds() ;
-			
-			size_t i=1;
-			SEXP x = m_sexp ;
-			while( i < index ){
-				x = CDR(x) ;
-				i++; 
-			}
-			SEXP tail = PROTECT( grow( object, CDR(x) ) ) ; 
-			SETCDR( x, tail ) ;
-			UNPROTECT(1) ;
-		}
-	}
+	void insert( const size_t& index, const T& object) ;
 	
 	/**
 	 * replaces an element of the list
@@ -127,22 +87,10 @@
 	 * @param object object that can be wrapped
 	 */
 	template <typename T>
-	void replace( const int& index, const T& object ) {
- 	        if( static_cast<R_len_t>(index) >= ::Rf_length(m_sexp) ) throw index_out_of_bounds() ;
-		
-		/* pretend we do a pairlist so that we get Named to work for us */
-		SEXP x = PROTECT(pairlist( object ));
-		SEXP y = m_sexp ;
-		int i=0;
-		while( i<index ){ y = CDR(y) ; i++; }
-		
-		SETCAR( y, CAR(x) );
-		SET_TAG( y, TAG(x) );
-		UNPROTECT(1) ;
-	}
+	void replace( const int& index, const T& object ) ;
 
-        inline R_len_t length() const { return ::Rf_length(m_sexp) ; }
-        inline R_len_t size() const { return ::Rf_length(m_sexp) ; }
+    inline R_len_t length() const { return ::Rf_length(m_sexp) ; }
+    inline R_len_t size() const { return ::Rf_length(m_sexp) ; }
 	
 	/**
 	 * Remove the element at the given position
@@ -160,21 +108,21 @@
 		Proxy& operator=(SEXP rhs) ;
 		
 		template <typename T>
-		Proxy& operator=(const T& rhs){
-			SETCAR( node, wrap(rhs) ) ;
-			return *this ;
-		}
+		Proxy& operator=(const T& rhs) ;
 		
 		template <typename U>
-		Proxy& operator=(const traits::named_object<U>& rhs){
-			SETCAR( node, rhs.object ) ;
-			SEXP rhsNameSym = ::Rf_install( rhs.name.c_str() ); // cannot be gc()ed once in symbol table
-			SET_TAG( node, rhsNameSym ) ;
-			return *this ;
-		}
+		Proxy& operator=(const traits::named_object<U>& rhs) ;
 		
-		template <typename T> operator T() const {
-			return as<T>( CAR(node) ) ;
+		template <typename T> operator T() const ;
+		
+		inline SEXP get() const { return CAR(node); }
+		inline operator SEXP() const { return get() ; }
+		inline Proxy& set(SEXP x){ SETCAR( node, x ) ; return *this ;} 
+		inline Proxy& set(SEXP x, const char* name){
+            SETCAR( node, x ) ;
+            SEXP rhsNameSym = ::Rf_install( name ); // cannot be gc()ed once in symbol table
+            SET_TAG( node, rhsNameSym ) ;
+            return *this ;
 		}
 		
 	private:

Modified: pkg/Rcpp/inst/include/Rcpp/Promise.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/Promise.h	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/inst/include/Rcpp/Promise.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -28,7 +28,6 @@
 #include <Rcpp/RObject.h>
 
 namespace Rcpp{ 
-
     class Promise : public RObject {     
     public:
 

Added: pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/api/meat/DottedPair.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -0,0 +1,102 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
+//
+// DottedPair.h: Rcpp R/C++ interface class library --  DottedPair meat
+//
+// Copyright (C) 2012    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/>.
+
+#ifndef Rcpp_api_meat_DottedPair_h
+#define Rcpp_api_meat_DottedPair_h
+
+namespace Rcpp{ 
+
+    template <typename T>
+    DottedPair::Proxy& DottedPair::Proxy::operator=( const T& rhs ){
+        return set( wrap( rhs) );
+    }
+    
+    template <typename T> 
+    DottedPair::Proxy::operator T() const{ return as<T>(get()); } 
+
+    template <typename U>
+    DottedPair::Proxy& DottedPair::Proxy::operator=(const traits::named_object<U>& rhs){
+    	return set( rhs.object, rhs.name.c_str() ) ;
+    }
+		
+    template <typename T>
+	void DottedPair::push_front( const T& object){
+		setSEXP( grow(object, m_sexp) ) ;
+	}
+
+	template <typename T>
+	void DottedPair::push_back( const T& object){
+		if( isNULL() ){
+			setSEXP( grow( object, m_sexp ) ) ;
+		} else {
+			SEXP x = m_sexp ;
+			/* traverse the pairlist */
+			while( !Rf_isNull(CDR(x)) ){
+				x = CDR(x) ;
+			}
+			SEXP tail = PROTECT( pairlist( object ) ); 
+			SETCDR( x, tail ) ;
+			UNPROTECT(1) ;
+		}
+	}
+
+    template <typename T>
+	void DottedPair::insert( const size_t& index, const T& object) {
+		if( index == 0 ) {
+			push_front( object ) ;
+		} else{
+		    // tautological comparison flagged by clang++
+//			if( index <  0 ) throw index_out_of_bounds() ;
+			if( isNULL( ) ) throw index_out_of_bounds() ;
+			
+			if( static_cast<R_len_t>(index) > ::Rf_length(m_sexp) ) throw index_out_of_bounds() ;
+			
+			size_t i=1;
+			SEXP x = m_sexp ;
+			while( i < index ){
+				x = CDR(x) ;
+				i++; 
+			}
+			SEXP tail = PROTECT( grow( object, CDR(x) ) ) ; 
+			SETCDR( x, tail ) ;
+			UNPROTECT(1) ;
+		}
+	}
+	
+	template <typename T>
+	void DottedPair::replace( const int& index, const T& object ) {
+ 	        if( static_cast<R_len_t>(index) >= ::Rf_length(m_sexp) ) throw index_out_of_bounds() ;
+		
+		/* pretend we do a pairlist so that we get Named to work for us */
+		SEXP x = PROTECT(pairlist( object ));
+		SEXP y = m_sexp ;
+		int i=0;
+		while( i<index ){ y = CDR(y) ; i++; }
+		
+		SETCAR( y, CAR(x) );
+		SET_TAG( y, TAG(x) );
+		UNPROTECT(1) ;
+	}
+
+	
+} // namespace Rcpp
+
+#endif

Modified: pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/inst/include/Rcpp/api/meat/meat.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -19,9 +19,11 @@
 // 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_api_meat_backward_h
-#define Rcpp_api_meat_backward_h
+#ifndef Rcpp_api_meat_meat_h
+#define Rcpp_api_meat_meat_h
 
 #include <Rcpp/api/meat/RObject.h>
+#include <Rcpp/api/meat/DottedPair.h>
+#include <Rcpp/api/meat/grow.h>
 
 #endif

Modified: pkg/Rcpp/inst/include/Rcpp/grow.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/grow.h	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/inst/include/Rcpp/grow.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -2,7 +2,7 @@
 //
 // grow.h: Rcpp R/C++ interface class library -- grow a pairlist
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -29,49 +29,47 @@
 
     inline SEXP pairlist() { return R_NilValue ; }
 
-    namespace internal {
+    namespace internal{
+     
+        template <typename T>
+    	inline SEXP grow__dispatch( ::Rcpp::traits::false_type, const T& head, SEXP tail ){
+    	    return grow( wrap(head), tail ) ;
+    	}
+    
+    	template <typename T>
+    	inline SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){
+    	    SEXP y = PROTECT( wrap( head.object) ) ;
+    	    SEXP x = PROTECT( Rf_cons( y , tail) ) ;
+    	    SEXP headNameSym = ::Rf_install( head.name.c_str() ); // cannot be gc()ed once in symbol table
+    	    SET_TAG( x, headNameSym ); 
+    	    UNPROTECT(2); 
+    	    return x; 	
+    	}
+    
+    } // internal
 
-	template <typename T>
-	SEXP grow__dispatch( ::Rcpp::traits::false_type, const T& head, SEXP tail ){
-	    SEXP x = PROTECT( wrap( head ) ) ;
-	    SEXP res = PROTECT( Rf_cons( x, tail ) ) ;
-	    UNPROTECT(2) ;
-	    return res ;
-	}
-
-	template <typename T>
-	SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){
-	    SEXP y = PROTECT( wrap( head.object) ) ;
-	    SEXP x = PROTECT( Rf_cons( y , tail) ) ;
-	    SEXP headNameSym = ::Rf_install( head.name.c_str() ); // cannot be gc()ed once in symbol table
-	    SET_TAG( x, headNameSym ); 
-	    UNPROTECT(2); 
-	    return x; 	
-	}
-
-    } // namespace internal
-
-
     /**
      * grows a pairlist. First wrap the head into a SEXP, then 
      * grow the tail pairlist
      */
     template <typename T>
     SEXP grow(const T& head, SEXP tail) {
-	return internal::grow__dispatch( typename traits::is_named<T>::type(), head, tail );
+        return internal::grow__dispatch( typename traits::is_named<T>::type(), head, tail );
     }
-
+    
+    SEXP grow( SEXP head, SEXP tail ) ; 
+    
 #ifdef HAS_VARIADIC_TEMPLATES
 
     /* end of the recursion, wrap first to make the CAR and use R_NilValue as the CDR of the list */
     template<typename T>
     SEXP pairlist( const T& first){
-	return grow(first, R_NilValue ); 
+        return grow(first, R_NilValue ); 
     }
 
     template<typename T, typename... Args>
     SEXP pairlist( const T& first, const Args&... args ){
-	return grow(first, pairlist(args...) );
+        return grow(first, pairlist(args...) );
     }
 
 #else

Modified: pkg/Rcpp/inst/include/Rcpp/r_cast.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/r_cast.h	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/inst/include/Rcpp/r_cast.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -2,7 +2,7 @@
 //
 // rcast.h: Rcpp R/C++ interface class library -- cast from one SEXP type to another
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -27,6 +27,9 @@
 namespace Rcpp{
     namespace internal {
         
+        /* defined in Evaluator.cpp */
+        SEXP convert_using_rfunction(SEXP x, const char* const fun);
+        
         // r_true_cast is only meant to be used when the target SEXP type
         // is different from the SEXP type of x 
         template <int TARGET>

Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/inst/include/RcppCommon.h	2012-12-06 01:20:19 UTC (rev 4095)
@@ -286,9 +286,6 @@
     /* internal namespace for things not intended to be used by the user */
     namespace internal{     
         
-        /* defined in Evaluator.cpp */
-        SEXP convert_using_rfunction(SEXP x, const char* const fun);
-        
         SEXP try_catch( SEXP expr, SEXP env );
         SEXP try_catch( SEXP expr );
         
@@ -392,9 +389,6 @@
 #include <Rcpp/internal/Proxy_Iterator.h>
 #include <Rcpp/internal/SEXP_Iterator.h>
 
-RcppExport SEXP RcppXPtrExample_create_external_pointer() ;
-RcppExport SEXP RcppXPtrExample_get_external_pointer(SEXP ); 
-
 #include <Rcpp/preprocessor.h>
 #include <Rcpp/algo.h>
 

Modified: pkg/Rcpp/src/DottedPair.cpp
===================================================================
--- pkg/Rcpp/src/DottedPair.cpp	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/src/DottedPair.cpp	2012-12-06 01:20:19 UTC (rev 4095)
@@ -20,57 +20,66 @@
 // You should have received a copy of the GNU General Public License
 // along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
+#include <Rcpp/grow.h>
 #include <Rcpp/DottedPair.h>
 
 namespace Rcpp {
-
+    
+    SEXP grow( SEXP head, SEXP tail ){
+        SEXP x = PROTECT( head ) ;
+	    SEXP res = PROTECT( Rf_cons( x, tail ) ) ;
+	    UNPROTECT(2) ;
+	    return res ;    
+    }
+    SEXP grow( const char* head, SEXP tail ) {
+        return grow( Rf_mkString(head), tail ) ; 
+    }
+    
+    
     DottedPair::~DottedPair(){}
     DottedPair::DottedPair() : RObject(){}
         
     DottedPair& DottedPair::operator=(const DottedPair& other){
-	setSEXP( other.asSexp() ) ;
-	return *this ;
+        setSEXP( other.asSexp() ) ;
+        return *this ;
     }
         
     void DottedPair::remove( const size_t& index ) {
-	if( static_cast<R_len_t>(index) >= Rf_length(m_sexp) ) throw index_out_of_bounds() ;
-	if( index == 0 ){
-	    setSEXP( CDR( m_sexp) ) ;
-	} else{
-	    SEXP x = m_sexp ;
-	    size_t i=1;
-	    while( i<index ){ x = CDR(x) ; i++; }
-	    SETCDR( x, CDDR(x) ) ;
-	}
+        if( static_cast<R_len_t>(index) >= Rf_length(m_sexp) ) throw index_out_of_bounds() ;
+        if( index == 0 ){
+            setSEXP( CDR( m_sexp) ) ;
+        } else{
+            SEXP x = m_sexp ;
+            size_t i=1;
+            while( i<index ){ x = CDR(x) ; i++; }
+            SETCDR( x, CDDR(x) ) ;
+        }
     }
         
     DottedPair::Proxy::Proxy( DottedPair& v, const size_t& index_ ) : node(){
-	if( static_cast<R_len_t>(index_) >= v.length() ) throw index_out_of_bounds() ;
-	SEXP x = v ; /* implicit conversion */
-	size_t i = 0 ;
-	while( i<index_) {
-	    x = CDR(x) ;
-	    ++i ;
-	}
-	node = x ;
+        if( static_cast<R_len_t>(index_) >= v.length() ) throw index_out_of_bounds() ;
+        SEXP x = v ; /* implicit conversion */
+        size_t i = 0 ;
+        while( i<index_) {
+            x = CDR(x) ;
+            ++i ;
+        }
+        node = x ;
     }
         
     DottedPair::Proxy& DottedPair::Proxy::operator=(const Proxy& rhs){
-	SEXP y = rhs ; /* implicit conversion */
-	SETCAR( node, y ) ;
-	return *this ;
+        return set(rhs) ;
     }
         
     DottedPair::Proxy& DottedPair::Proxy::operator=(SEXP rhs){
-	SETCAR( node, rhs) ;
-	return *this ;
+        return set(rhs) ;
     }
         
     const DottedPair::Proxy DottedPair::operator[]( int i ) const {
-	return Proxy( const_cast<DottedPair&>(*this), i) ;
+        return Proxy( const_cast<DottedPair&>(*this), i) ;
     }
     DottedPair::Proxy DottedPair::operator[]( int i ) {
-	return Proxy( *this, i );
+        return Proxy( *this, i );
     }
         
         

Modified: pkg/Rcpp/src/posixt.cpp
===================================================================
--- pkg/Rcpp/src/posixt.cpp	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/src/posixt.cpp	2012-12-06 01:20:19 UTC (rev 4095)
@@ -1,8 +1,8 @@
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
 //
-// posixt.h: Rcpp R/C++ interface class library -- Date type
+// posixt.cpp: Rcpp R/C++ interface class library -- Date type
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -19,8 +19,11 @@
 // You should have received a copy of the GNU General Public License
 // along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-#include <RcppCommon.h>
+#define USE_RINTERNALS
+#include <Rinternals.h>
 
+#include <Rcpp/internal/posixt.h>
+
 namespace Rcpp{
 namespace internal{
 	

Modified: pkg/Rcpp/src/r_cast.cpp
===================================================================
--- pkg/Rcpp/src/r_cast.cpp	2012-12-05 22:50:57 UTC (rev 4094)
+++ pkg/Rcpp/src/r_cast.cpp	2012-12-06 01:20:19 UTC (rev 4095)
@@ -2,7 +2,7 @@
 //
 // rcast.h: Rcpp R/C++ interface class library -- cast from one SEXP type to another
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -19,9 +19,12 @@
 // You should have received a copy of the GNU General Public License
 // along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-#include <RcppCommon.h>
-#include <Rcpp/RObject.h>
+#define R_NO_REMAP
+#include <Rinternals.h>
 
+#include <Rcpp/r_cast.h>
+#include <Rcpp/exceptions.h>
+
 namespace Rcpp{
     namespace internal{
 
@@ -143,24 +146,7 @@
         template<> SEXP r_true_cast<LANGSXP>(SEXP x) {
             return convert_using_rfunction(x, "as.call" ) ;
         }
-
-        // this was in Language.cpp before it became generated by DottedPair template class
-        //
-        //     int n = Rf_length(lang) ;
-        //     if( n == 0 ) throw not_compatible("cannot convert to call (LANGSXP)") ;
-        //     SEXP names = RCPP_GET_NAMES(lang) ; 
-        //     SEXP res, ap;
-        //     PROTECT( ap = res = Rf_allocList( n ) ) ;
-        //     for( int i=0; i<n; i++){
-        //             SETCAR(ap, VECTOR_ELT(lang, i));
-        //             if (names != R_NilValue && !Rf_StringBlank(STRING_ELT(names, i))){
-        //                     SET_TAG(ap, Rf_install(Rf_translateChar(STRING_ELT(names, i))));
-        //             }
-        //             ap = CDR( ap) ;
-        //     }
-        //     UNPROTECT(1) ;
-        //     setSEXP(res) ; 
-
+   
     } // namespace internal
 } // namespace Rcpp
 



More information about the Rcpp-commits mailing list