[Rcpp-commits] r1045 - pkg/Rcpp/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 15 10:33:17 CEST 2010
Author: romain
Date: 2010-04-15 10:33:17 +0200 (Thu, 15 Apr 2010)
New Revision: 1045
Added:
pkg/Rcpp/R/cppfunction.R
Removed:
pkg/Rcpp/R/cpp_function.R
Log:
change also the file name
Deleted: pkg/Rcpp/R/cpp_function.R
===================================================================
--- pkg/Rcpp/R/cpp_function.R 2010-04-15 08:32:41 UTC (rev 1044)
+++ pkg/Rcpp/R/cpp_function.R 2010-04-15 08:33:17 UTC (rev 1045)
@@ -1,53 +0,0 @@
-# Copyright (C) 2010 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/>.
-
-HAVEINLINE <- FALSE
-cfunction <- function(...) stop( "inline not available" )
-
-cppfunction <- function (sig = character(), body = character(), includes = character(),
- otherdefs = character(), verbose = FALSE,
- cppargs = character(), cxxargs = character(), libargs = character(),
- .Cpp = TRUE){
-
- ok <- HAVEINLINE
- if( !ok){
- if( "package:inline" %in% search() ){
- ok <- TRUE
- } else{
- ok <- tryCatch( {
- require( "inline" )
- TRUE
- } , error = function(e) FALSE )
- }
- if( ! ok ){
- stop( "package inline is not available" )
- }
- HAVEINLINE <<- TRUE
- cfunction <<- get( "cfunction", asNamespace( "inline" ) )
- }
- fx <- cfunction( sig = sig, body = body, includes = includes,
- otherdefs = otherdefs, language = "C++", convention = ".Call",
- Rcpp = TRUE, cppargs = cppargs, cxxargs = cxxargs, libargs = libargs,
- verbose = verbose )
- if( isTRUE( .Cpp ) ){
- # replace .Call by Rcpp::.Cpp
- # this is somewhat heuristic, maybe we should search for .Call as opposed
- # to assume it is in this position
- body( fx at .Data )[[4]][[1]] <- call( "::", as.name("Rcpp"), as.name(".Cpp") )
- }
- fx
-}
Copied: pkg/Rcpp/R/cppfunction.R (from rev 1044, pkg/Rcpp/R/cpp_function.R)
===================================================================
--- pkg/Rcpp/R/cppfunction.R (rev 0)
+++ pkg/Rcpp/R/cppfunction.R 2010-04-15 08:33:17 UTC (rev 1045)
@@ -0,0 +1,53 @@
+# Copyright (C) 2010 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/>.
+
+HAVEINLINE <- FALSE
+cfunction <- function(...) stop( "inline not available" )
+
+cppfunction <- function (sig = character(), body = character(), includes = character(),
+ otherdefs = character(), verbose = FALSE,
+ cppargs = character(), cxxargs = character(), libargs = character(),
+ .Cpp = TRUE){
+
+ ok <- HAVEINLINE
+ if( !ok){
+ if( "package:inline" %in% search() ){
+ ok <- TRUE
+ } else{
+ ok <- tryCatch( {
+ require( "inline" )
+ TRUE
+ } , error = function(e) FALSE )
+ }
+ if( ! ok ){
+ stop( "package inline is not available" )
+ }
+ HAVEINLINE <<- TRUE
+ cfunction <<- get( "cfunction", asNamespace( "inline" ) )
+ }
+ fx <- cfunction( sig = sig, body = body, includes = includes,
+ otherdefs = otherdefs, language = "C++", convention = ".Call",
+ Rcpp = TRUE, cppargs = cppargs, cxxargs = cxxargs, libargs = libargs,
+ verbose = verbose )
+ if( isTRUE( .Cpp ) ){
+ # replace .Call by Rcpp::.Cpp
+ # this is somewhat heuristic, maybe we should search for .Call as opposed
+ # to assume it is in this position
+ body( fx at .Data )[[4]][[1]] <- call( "::", as.name("Rcpp"), as.name(".Cpp") )
+ }
+ fx
+}
More information about the Rcpp-commits
mailing list