[Rcpp-commits] r4116 - in pkg/Rcpp: . inst/include inst/include/Rcpp src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 9 15:52:30 CET 2012


Author: romain
Date: 2012-12-09 15:52:30 +0100 (Sun, 09 Dec 2012)
New Revision: 4116

Added:
   pkg/Rcpp/src/api.cpp
Removed:
   pkg/Rcpp/src/Dimension.cpp
   pkg/Rcpp/src/DottedPair.cpp
   pkg/Rcpp/src/Environment.cpp
   pkg/Rcpp/src/Evaluator.cpp
   pkg/Rcpp/src/Formula.cpp
   pkg/Rcpp/src/Function.cpp
   pkg/Rcpp/src/Language.cpp
   pkg/Rcpp/src/Pairlist.cpp
   pkg/Rcpp/src/Promise.cpp
   pkg/Rcpp/src/RObject.cpp
   pkg/Rcpp/src/Reference.cpp
   pkg/Rcpp/src/Rostream.cpp
   pkg/Rcpp/src/S4.cpp
   pkg/Rcpp/src/Symbol.cpp
   pkg/Rcpp/src/WeakReference.cpp
   pkg/Rcpp/src/cache.cpp
   pkg/Rcpp/src/complex.cpp
Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp.h
   pkg/Rcpp/inst/include/Rcpp/clone.h
   pkg/Rcpp/src/RcppCommon.cpp
   pkg/Rcpp/src/barrier.cpp
Log:
less c++ files, faster compile time

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/ChangeLog	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,3 +1,8 @@
+2012-12-09 Romain Francois <romain at r-enthusiasts.com>
+
+        * src/api.cpp: merge many .cpp files here to reduce compile time
+        * src/barrier.cpp: merge with cache.cpp to reduce compile time
+        
 2012-12-08 Romain Francois <romain at r-enthusiasts.com>
 
         * src/Timer.cpp: implementation of Timer

Modified: pkg/Rcpp/inst/include/Rcpp/clone.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/clone.h	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/inst/include/Rcpp/clone.h	2012-12-09 14:52:30 UTC (rev 4116)
@@ -2,7 +2,7 @@
 //
 // clone.h: Rcpp R/C++ interface class library -- clone RObject's
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -34,11 +34,6 @@
     SEXP x = const_cast<T&>(object) ;
     return T( Rf_duplicate( x ) ) ; 
 }
-#if 0
-template<> inline SEXP clone(SEXP object){
-    return ::Rf_duplicate( object ) ;
-}
-#endif
 
 } // namespace Rcpp
 

Modified: pkg/Rcpp/inst/include/Rcpp.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp.h	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/inst/include/Rcpp.h	2012-12-09 14:52:30 UTC (rev 4116)
@@ -31,6 +31,7 @@
 
 #include <Rcpp/RObject.h>
 
+#include <Rcpp/Promise.h>
 #include <Rcpp/S4.h>
 #include <Rcpp/Reference.h>
 #include <Rcpp/clone.h>

Deleted: pkg/Rcpp/src/Dimension.cpp
===================================================================
--- pkg/Rcpp/src/Dimension.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Dimension.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,79 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Dimension.h: Rcpp R/C++ interface class library -- dimensions
-//
-// Copyright (C) 2010 - 2011 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/>.
-
-#include <RcppCommon.h>
-#include <Rcpp/Dimension.h>
-
-namespace Rcpp{
-
-    Dimension::Dimension() : dims(){}
-        
-    Dimension::Dimension(SEXP x): dims(){
-        dims = as< std::vector<int> >(x) ;
-    }
-        
-    Dimension::Dimension( const Dimension& other ) : dims(){
-        dims = other.dims ; /* copy */
-    }
-        
-    Dimension& Dimension::operator=(const Dimension& other){
-        dims = other.dims ; /* copy */
-        return *this ;
-    }
-        
-    Dimension::Dimension(const size_t& n1) : dims(1){
-        dims[0] = n1 ;
-    }
-        
-    Dimension::Dimension(const size_t& n1, const size_t& n2) : dims(2){
-        dims[0] = n1 ;
-        dims[1] = n2 ;
-    }
-        
-    Dimension::Dimension(const size_t& n1, const size_t& n2, const size_t& n3) : dims(3){
-        dims[0] = n1 ;
-        dims[1] = n2 ;
-        dims[2] = n3 ;
-    }
-        
-    Dimension::operator SEXP() const {
-        return wrap( dims.begin(), dims.end() ) ;
-    }
-        
-    int Dimension::size() const {
-        return static_cast<int>( dims.size() ) ;
-    }
-        
-    int Dimension::prod() const {
-        return std::accumulate( dims.begin(), dims.end(), 1, std::multiplies<int>() ) ;
-    }
-        
-    Dimension::reference Dimension::operator[](int i) {
-        if( i < 0 || i>=static_cast<int>(dims.size()) ) throw std::range_error("index out of bounds") ;
-        return dims.at(i) ;
-    }
-
-    Dimension::const_reference Dimension::operator[](int i) const {
-        if( i < 0 || i>=static_cast<int>(dims.size()) ) throw std::range_error("index out of bounds") ;
-        return dims.at(i) ;
-    }
-
-} // namespace Rcpp

Deleted: pkg/Rcpp/src/DottedPair.cpp
===================================================================
--- pkg/Rcpp/src/DottedPair.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/DottedPair.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,86 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// DottedPair.cpp: Rcpp R/C++ interface class library -- dotted pair lists
-// base class of Language and Pairlist
-//
-// Copyright (C) 2010 - 2011 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/>.
-
-#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 ;
-    }
-        
-    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) ) ;
-        }
-    }
-        
-    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 ;
-    }
-        
-    DottedPair::Proxy& DottedPair::Proxy::operator=(const Proxy& rhs){
-        return set(rhs) ;
-    }
-        
-    DottedPair::Proxy& DottedPair::Proxy::operator=(SEXP rhs){
-        return set(rhs) ;
-    }
-        
-    const DottedPair::Proxy DottedPair::operator[]( int i ) const {
-        return Proxy( const_cast<DottedPair&>(*this), i) ;
-    }
-    DottedPair::Proxy DottedPair::operator[]( int i ) {
-        return Proxy( *this, i );
-    }
-        
-        
-} // namespace Rcpp

Deleted: pkg/Rcpp/src/Environment.cpp
===================================================================
--- pkg/Rcpp/src/Environment.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Environment.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,283 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Environment.cpp: Rcpp R/C++ interface class library -- Environments
-//
-// Copyright (C) 2009 - 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/>.
-
-#include <Rcpp/RObject.h>
-#include <Rcpp/Environment.h>
-#include <Rcpp/Evaluator.h>
-#include <Rcpp/exceptions.h>
-
-#include <R_ext/Callbacks.h>
-#include <Rcpp/cache.h>
-
-namespace Rcpp {
-
-    Environment::Environment() : RObject(R_GlobalEnv){}
-
-    Environment::Environment(SEXP x) : RObject(x){
-        if( ! Rf_isEnvironment(x) ) {
-            /* not an environment, but maybe convertible to one using as.environment, try that */
-            SEXP res ;
-            try {
-                SEXP asEnvironmentSym = Rf_install("as.environment"); // cannot be gc()'ed  once in symbol table
-                res = Evaluator::run( Rf_lang2(asEnvironmentSym, x ) ) ;
-            } catch( const eval_error& ex){
-                throw not_compatible( "cannot convert to environment"  ) ; 
-            }
-            setSEXP( res ) ;
-        }
-    }
-
-    Environment::Environment( const std::string& name) : RObject(R_EmptyEnv){
-        /* similar to matchEnvir at envir.c */
-        if( name == ".GlobalEnv" ) {
-            setSEXP( R_GlobalEnv ) ;
-        } else if( name == "package:base" ){
-            setSEXP( R_BaseEnv ) ;
-        } else{
-            SEXP res = R_NilValue ;
-            try{
-                SEXP asEnvironmentSym = Rf_install("as.environment"); // cannot be gc()'ed  once in symbol table
-                res = Evaluator::run(Rf_lang2( asEnvironmentSym, Rf_mkString(name.c_str()) ) ) ;
-            } catch( const eval_error& ex){
-                throw no_such_env(name) ;
-            }
-            setSEXP( res ) ;
-        }
-    }
-    
-    Environment::Environment(int pos) : RObject(R_GlobalEnv){
-        SEXP res ;
-        try{
-            SEXP asEnvironmentSym = Rf_install("as.environment"); // cannot be gc()'ed  once in symbol table
-            res =  Evaluator::run( Rf_lang2( asEnvironmentSym, Rf_ScalarInteger(pos) ) ) ;
-        } catch( const eval_error& ex){
-            throw no_such_env(pos) ;
-        }
-        setSEXP( res ) ;
-    }
-    
-    Environment::Environment( const Environment& other ) {
-        setSEXP( other.asSexp() ) ; 
-    }
-    
-    Environment& Environment::operator=(const Environment& other) {
-        setSEXP( other.asSexp() ) ; 
-        return *this ;
-    }
-    
-    Environment::~Environment(){
-        logTxt( "~Environment" ) ;
-    }
-        
-    SEXP Environment::ls( bool all = true) const {
-        if( is_user_database() ){
-            R_ObjectTable *tb = (R_ObjectTable*)
-                R_ExternalPtrAddr(HASHTAB(m_sexp));
-            return tb->objects(tb) ;
-        } else{
-            Rboolean get_all = all ? TRUE : FALSE ;
-            return R_lsInternal( m_sexp, get_all ) ;
-        }
-        return R_NilValue ;
-    }
-    
-    SEXP Environment::get( const std::string& name) const {
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        SEXP res = Rf_findVarInFrame( m_sexp, nameSym ) ;
-        
-        if( res == R_UnboundValue ) return R_NilValue ;
-        
-        /* We need to evaluate if it is a promise */
-        if( TYPEOF(res) == PROMSXP){
-            res = Rf_eval( res, m_sexp ) ;
-        }
-        return res ;
-    }
-    
-    SEXP Environment::find( const std::string& name) const {
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        SEXP res = Rf_findVar( nameSym, m_sexp ) ;
-        
-        if( res == R_UnboundValue ) throw binding_not_found(name) ;
-        
-        /* We need to evaluate if it is a promise */
-        if( TYPEOF(res) == PROMSXP){
-            res = Rf_eval( res, m_sexp ) ;
-        }
-        return res ;
-    }
-    
-    bool Environment::exists( const std::string& name) const{
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        SEXP res = Rf_findVarInFrame( m_sexp, nameSym  ) ;
-        return res != R_UnboundValue ;
-    }
-    
-    bool Environment::assign( const std::string& name, SEXP x = R_NilValue) const {
-        if( exists( name) && bindingIsLocked(name) ) throw binding_is_locked(name) ;
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        Rf_defineVar( nameSym, x, m_sexp );
-        return true ;
-    }
-    
-    bool Environment::remove( const std::string& name) {
-        if( exists(name) ){
-            if( bindingIsLocked(name) ){
-                throw binding_is_locked(name) ;
-            } else{
-                /* unless we want to copy all of do_remove, 
-                   we have to go back to R to do this operation */
-                SEXP internalSym = Rf_install( ".Internal" );
-                SEXP removeSym = Rf_install( "remove" );
-                SEXP call = PROTECT( Rf_lang2(internalSym, Rf_lang4(removeSym, Rf_mkString(name.c_str()), 
-                                                                    m_sexp, Rf_ScalarLogical( FALSE ))) );
-                Rf_eval( call, R_GlobalEnv ) ;
-                UNPROTECT(1) ;
-            }
-        } else{
-            throw no_such_binding(name) ;
-        }
-        return true; // to make g++ -Wall happy
-    }
-    
-    bool Environment::isLocked() const{
-        return R_EnvironmentIsLocked(m_sexp);
-    }
-    
-    bool Environment::bindingIsActive(const std::string& name) const {
-        if( !exists( name) ) throw no_such_binding(name) ;
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        return R_BindingIsActive(nameSym, m_sexp) ;
-    }
-    
-    bool Environment::bindingIsLocked(const std::string& name) const {
-        if( !exists( name) ) throw no_such_binding(name) ;
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        return R_BindingIsLocked(nameSym, m_sexp) ;
-    }
-    
-    void Environment::lock( bool bindings = false ) {
-        R_LockEnvironment( m_sexp, bindings ? TRUE: FALSE ) ;
-    }
-    
-    void Environment::lockBinding(const std::string& name) {
-        if( !exists( name) ) throw no_such_binding(name) ;
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        R_LockBinding( nameSym, m_sexp ); 
-    }
-    
-    void Environment::unlockBinding(const std::string& name) {
-        if( !exists( name) ) throw no_such_binding(name) ;
-        SEXP nameSym = Rf_install(name.c_str());        // cannot be gc()'ed  once in symbol table
-        R_unLockBinding( nameSym, m_sexp );
-    }
-    
-    bool Environment::is_user_database() const {
-        return OBJECT(m_sexp) && Rf_inherits(m_sexp, "UserDefinedDatabase") ;
-    }
-    
-    /* static */
-    
-    Environment Environment::global_env() {
-        return Environment(R_GlobalEnv) ;
-    }
-    
-    Environment Environment::empty_env() {
-        return Environment(R_EmptyEnv) ;
-    }
-    
-    Environment Environment::base_env() {
-        return Environment(R_BaseEnv) ;
-    }
-    
-    Environment Environment::base_namespace() {
-        return Environment(R_BaseNamespace) ;
-    }
-    
-    Environment Environment::namespace_env(const std::string& package) {
-        
-        SEXP env = R_NilValue ;
-        try{
-            SEXP getNamespaceSym = Rf_install("getNamespace");
-            env = Evaluator::run( Rf_lang2(getNamespaceSym, Rf_mkString(package.c_str()) ) ) ;
-        } catch( const eval_error& ex){
-            throw no_such_namespace( package  ) ; 
-        }
-        return Environment( env ) ;
-    }
-    
-    Environment Environment::parent() const {
-        return Environment( ENCLOS(m_sexp) ) ; 
-    }
-    
-    Environment::Binding::Binding( Environment& env_, const std::string& name_): 
-        env(env_), name(name_){}
-    
-    bool Environment::Binding::active() const{
-        return env.bindingIsActive( name ) ; 
-    }
-    
-    bool Environment::Binding::exists() const{
-        return env.exists( name ) ; 
-    }
-    
-    bool Environment::Binding::locked() const{
-        return env.bindingIsLocked( name ) ; 
-    }
-    
-    void Environment::Binding::lock() {
-        env.lockBinding( name ) ;
-    }
-    
-    void Environment::Binding::unlock() {
-        env.unlockBinding( name ) ;
-    }
-    
-    Environment::Binding& Environment::Binding::operator=( SEXP rhs ){
-        env.assign( name, rhs ) ;
-        return *this ;
-    }
-    
-    Environment::Binding& Environment::Binding::operator=( const Binding& rhs){
-        env.assign( name, rhs.env.get(rhs.name) ) ;
-        return *this ;
-    }
-
-    const Environment::Binding Environment::operator[]( const std::string& name) const{
-        return Binding( const_cast<Environment&>(*this), name );
-    }
-    
-    Environment::Binding Environment::operator[]( const std::string& name) {
-        return Binding( *this, name ) ;
-    }
-    
-    Environment Environment::Rcpp_namespace() {
-        return Rcpp::internal::get_Rcpp_namespace() ;
-    }
-    
-    Environment Environment::new_child(bool hashed) {
-        SEXP newEnvSym = Rf_install("new.env");
-        return Environment( Evaluator::run(Rf_lang3( newEnvSym, Rf_ScalarLogical(hashed), m_sexp )) );
-    }
-    
-    
-} // namespace Rcpp
-

Deleted: pkg/Rcpp/src/Evaluator.cpp
===================================================================
--- pkg/Rcpp/src/Evaluator.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Evaluator.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,108 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Evaluator.cpp: Rcpp R/C++ interface class library -- evaluator
-//
-// Copyright (C) 2009 - 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/>.
-
-#include <Rcpp/Vector.h>
-#include <Rcpp/Evaluator.h>
-#include <Rcpp/Environment.h>
-#include <Rcpp/routines.h>
-#include <Rcpp/exceptions.h>
-
-namespace Rcpp {
-
-    SEXP Evaluator::run(SEXP expr, SEXP env) {
-        PROTECT(expr);
-
-        reset_current_error() ; 
-
-        Environment RCPP = Environment::Rcpp_namespace(); 
-        static SEXP tryCatchSym = NULL, evalqSym, getCurrentErrorMessageSym; //, errorOccuredSym;
-        if (!tryCatchSym) {
-            tryCatchSym               = ::Rf_install("tryCatch");
-            evalqSym                  = ::Rf_install("evalq");
-            //errorOccuredSym           = ::Rf_install("errorOccured");
-            getCurrentErrorMessageSym = ::Rf_install("getCurrentErrorMessage");
-        }
-
-        SEXP call = PROTECT( Rf_lang3( 
-            tryCatchSym, 
-            Rf_lang3( evalqSym, expr, env ),
-            Rf_install( ".rcpp_error_recorder" )
-        ) ) ;
-        SET_TAG( CDDR(call), Rf_install( "error" ) ) ;
-        /* call the tryCatch call */
-        SEXP res  = PROTECT(::Rf_eval( call, RCPP ) );
-        
-        /* was there an error ? */
-        int error = INTEGER( rcpp_get_error_occured())[0] ;
-        
-        UNPROTECT(3) ;
-        
-        if( error ) {
-            std::string message(CHAR(::Rf_asChar(PROTECT(::Rf_eval(PROTECT(::Rf_lang1(getCurrentErrorMessageSym)), RCPP)))));
-            UNPROTECT( 2 ) ;
-            throw eval_error(message) ;
-        }
-
-        return res ;
-    }
-
-    
-    SEXP Evaluator::run( SEXP expr) {
-        return run(expr, R_GlobalEnv );
-    }
-    
-    namespace internal{
-        /* this is defined here because we need to be sure that Evaluator is defined */
-        SEXP convert_using_rfunction(SEXP x, const char* const fun) {
-            SEXP res = R_NilValue ;
-            try{
-                SEXP funSym = Rf_install(fun);
-                res = Evaluator::run( Rf_lang2( funSym, x ) ) ;
-            } catch( eval_error& e){
-                throw ::Rcpp::not_compatible( std::string("could not convert using R function : ") + fun  ) ;
-            }
-            return res;
-        }
-    
-        SEXP try_catch( SEXP expr, SEXP env ) {
-            return Evaluator::run(expr, env) ;
-        }
-        SEXP try_catch( SEXP expr ) {
-            return Evaluator::run(expr) ;
-        }
-    
-        SEXP eval_methods<EXPRSXP>::eval(){
-            SEXP xp = ( static_cast<ExpressionVector&>(*this) ).asSexp() ;
-            SEXP evalSym = Rf_install( "eval" );
-            return try_catch( Rf_lang2( evalSym, xp ) ) ;
-        }
-        
-        SEXP eval_methods<EXPRSXP>::eval( SEXP env ){
-            SEXP xp = ( static_cast<ExpressionVector&>(*this) ).asSexp() ;
-            SEXP evalSym = Rf_install( "eval" );
-            return try_catch( Rf_lang3( evalSym, xp, env ) ) ;
-        }
-	
-	
-    } // namespace internal
-    
-    
-} // namespace Rcpp

Deleted: pkg/Rcpp/src/Formula.cpp
===================================================================
--- pkg/Rcpp/src/Formula.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Formula.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,70 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Formula.cpp: Rcpp R/C++ interface class library -- Formulae
-//
-// Copyright (C) 2010 - 2011 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/>.
-
-#include <Rcpp/Formula.h>
-
-namespace Rcpp{
-        
-    Formula::Formula() : Language(){}
-        
-    Formula::Formula(SEXP x) : Language(){
-        switch( TYPEOF( x ) ){
-        case LANGSXP:
-            if( ::Rf_inherits( x, "formula") ){
-                setSEXP( x );
-            } else{
-                SEXP y = internal::convert_using_rfunction( x, "as.formula") ;
-                setSEXP( y ) ;
-            }
-            break;
-        case EXPRSXP:
-        case VECSXP:
-            /* lists or expression, try the first one */
-            if( ::Rf_length(x) > 0 ){
-                SEXP y = VECTOR_ELT( x, 0 ) ;
-                if( ::Rf_inherits( y, "formula" ) ){
-                    setSEXP( y ) ;  
-                } else{
-                    SEXP z = internal::convert_using_rfunction( y, "as.formula") ;
-                    setSEXP( z ) ;
-                }
-            } else{
-                throw not_compatible( "cannot create formula from empty list or expression" ) ; 
-            }
-            break;
-        default:
-            SEXP y = internal::convert_using_rfunction( x, "as.formula") ;
-            setSEXP( y ) ;
-        }
-    }
-        
-    Formula::Formula( const std::string& code) : Language() {
-        setSEXP( internal::convert_using_rfunction( ::Rf_mkString(code.c_str()), "as.formula") );       
-    }
-        
-    Formula::Formula( const Formula& other ) : Language( other.asSexp() ){}
-        
-    Formula& Formula::operator=( const Formula& other ){
-        setSEXP( other.asSexp() );
-        return *this ;
-    }
-        
-} // namespace Rcpp

Deleted: pkg/Rcpp/src/Function.cpp
===================================================================
--- pkg/Rcpp/src/Function.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Function.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,67 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Function.cpp: Rcpp R/C++ interface class library -- functions
-//
-// Copyright (C) 2010 - 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/>.
-
-#include <Rcpp/Function.h>
-
-namespace Rcpp {
-	
-    Function::Function(SEXP x) : RObject( ){
-        switch( TYPEOF(x) ){
-        case CLOSXP:
-        case SPECIALSXP:
-        case BUILTINSXP:
-            setSEXP(x); 
-            break; 
-        default:
-            throw not_compatible("cannot convert to function") ;
-        }
-    }
-	
-    Function::Function(const std::string& name) : RObject() {
-        SEXP nameSym = Rf_install( name.c_str() );	// cannot be gc()'ed  once in symbol table
-        SEXP x = PROTECT( Rf_findFun( nameSym, R_GlobalEnv ) ) ;
-        setSEXP( x ) ;
-        UNPROTECT(1) ;
-    }
-	
-    Function::Function(const Function& other) : RObject(){
-        setSEXP( other.asSexp() );
-    }
-	
-    Function& Function::operator=(const Function& other){
-        setSEXP( other.asSexp() );
-        return *this ;
-    }
-	
-    Function::~Function(){}	
-	
-    SEXP Function::environment() const {
-        if( TYPEOF(m_sexp) != CLOSXP ) {
-            throw not_a_closure() ;
-        }
-        return CLOENV(m_sexp) ;
-    }
-	
-    SEXP Function::body() const {
-        return BODY( m_sexp ) ;
-    }
-	
-} // namespace Rcpp

Deleted: pkg/Rcpp/src/Language.cpp
===================================================================
--- pkg/Rcpp/src/Language.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Language.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,90 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Language.cpp: Rcpp R/C++ interface class library -- Language objects ( calls )
-//
-// Copyright (C) 2010 - 2011 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/>.
-
-#include <Rcpp/Language.h>
-
-namespace Rcpp {
-        
-    Language::Language() : DottedPair() {}
-        
-    Language::Language( SEXP x ) : DottedPair(){
-        setSEXP( r_cast<LANGSXP>(x) ) ;
-    }
-        
-    Language::Language( const Language& other): DottedPair(){
-        setSEXP( other.asSexp() ) ;
-    }
-        
-    Language& Language::operator=(const Language& other){
-        setSEXP( other.asSexp() ) ;
-        return *this ;
-    }
-        
-    Language::Language( const std::string& symbol ): DottedPair() {
-        setSEXP( Rf_lang1( Symbol(symbol) ) );
-    }
-        
-    Language::Language( const Symbol& symbol ): DottedPair() {
-        setSEXP( Rf_lang1( symbol ) ) ;
-    }
-        
-    Language::Language( const Function& function): DottedPair() {
-        setSEXP( Rf_lang1( function ) ) ;               
-    }
-        
-    Language::~Language(){}
-
-    void Language::setSymbol( const std::string& symbol){
-        setSymbol( Symbol( symbol ) ) ;
-    }
-        
-    void Language::setSymbol( const Symbol& symbol){
-        SETCAR( m_sexp, symbol ) ;
-        SET_TAG(m_sexp, R_NilValue);/* probably not necessary */
-    }
-        
-    void Language::setFunction( const Function& function){
-        SETCAR( m_sexp, function );
-        SET_TAG(m_sexp, R_NilValue); /* probably not necessary */
-    }
-        
-    void Language::update(){ 
-        SET_TYPEOF( m_sexp, LANGSXP ) ;
-        SET_TAG( m_sexp, R_NilValue ) ;
-    }
-        
-    SEXP Language::eval() {
-        return eval( R_GlobalEnv ) ;
-    }
-        
-    SEXP Language::eval( SEXP env ) {
-        return internal::try_catch( m_sexp, env );
-    }
-    
-    SEXP Language::fast_eval(){
-        return Rf_eval( m_sexp, R_GlobalEnv ) ;    
-    }
-    SEXP Language::fast_eval(SEXP env ){
-        return Rf_eval( m_sexp, env ) ;
-    }
-        
-        
-} // namespace Rcpp

Deleted: pkg/Rcpp/src/Pairlist.cpp
===================================================================
--- pkg/Rcpp/src/Pairlist.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Pairlist.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,39 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Pairlist.cpp: Rcpp R/C++ interface class library -- Pairlist objects
-//
-// Copyright (C) 2010 - 2011 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/>.
-
-#include <Rcpp/Pairlist.h>
-
-namespace Rcpp {
-        
-    Pairlist::Pairlist() : DottedPair() {}
-    Pairlist::Pairlist( SEXP x ) : DottedPair(){
-        setSEXP( r_cast<LISTSXP>(x) );
-    }
-    Pairlist::~Pairlist(){}
-    Pairlist::Pairlist( const Pairlist& other): DottedPair(){
-        setSEXP( other.asSexp() ) ;
-    }
-    Pairlist& Pairlist::operator=(const Pairlist& other){
-        setSEXP( other.asSexp() ) ;
-        return *this ;
-    }
-        
-} // namespace Rcpp

Deleted: pkg/Rcpp/src/Promise.cpp
===================================================================
--- pkg/Rcpp/src/Promise.cpp	2012-12-08 20:17:44 UTC (rev 4115)
+++ pkg/Rcpp/src/Promise.cpp	2012-12-09 14:52:30 UTC (rev 4116)
@@ -1,66 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
-//
-// Promise.h: Rcpp R/C++ interface class library -- promises (PROMSXP)
-//
-// Copyright (C) 2010 - 2011 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/>.
-
-#include <Rcpp/Promise.h>
-
-namespace Rcpp {
-
-    Promise::Promise(SEXP x) : RObject(){
-        if( TYPEOF(x) == PROMSXP ){
-            setSEXP( x ) ;
-        } else{
-            throw not_compatible("not a promise") ;
-        }
-    }
-
-    Promise::Promise(const Promise& other) : RObject() {
-        setSEXP( other.asSexp() );
-    }
-	
-    Promise& Promise::operator=(const Promise& other){
-        setSEXP( other.asSexp() );
-        return *this ;
-    }
-	
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/rcpp -r 4116


More information about the Rcpp-commits mailing list