diff -Nru r-cran-inline-0.3.8/DESCRIPTION r-cran-inline-0.3.11/DESCRIPTION --- r-cran-inline-0.3.8/DESCRIPTION 2013-05-06 17:13:03.000000000 +0000 +++ r-cran-inline-0.3.11/DESCRIPTION 2013-05-06 17:13:03.000000000 +0000 @@ -1,14 +1,13 @@ Package: inline -Version: 0.3.8 -Date: 2010-12-07 +Version: 0.3.11 +Date: $Date: 2013-02-26 20:58:36 -0600 (Tue, 26 Feb 2013) $ Title: Inline C, C++, Fortran function calls from R Author: Oleg Sklyar, Duncan Murdoch, Mike Smith, Dirk Eddelbuettel, Romain Francois -Maintainer: Oleg Sklyar +Maintainer: Dirk Eddelbuettel Depends: R (>= 2.4.0), methods Suggests: Rcpp (>= 0.8.0) -Description: Functionality to dynamically define R functions and S4 methods with in-lined C, C++ or Fortran code supporting .C and .Call calling conventions. +Description: Functionality to dynamically define R functions and S4 methods + with in-lined C, C++ or Fortran code supporting .C and .Call calling conventions. License: LGPL -URL: http://www.ebi.ac.uk/~osklyar/inline/ Copyright: Oleg Sklyar, 2005-2010 LazyLoad: yes -Packaged: 2009-12-27 20:12:53 UTC; osklyar diff -Nru r-cran-inline-0.3.8/NAMESPACE r-cran-inline-0.3.11/NAMESPACE --- r-cran-inline-0.3.8/NAMESPACE 2010-05-29 16:58:20.000000000 +0000 +++ r-cran-inline-0.3.11/NAMESPACE 2012-10-02 22:34:10.000000000 +0000 @@ -2,7 +2,7 @@ importFrom( "utils", "package.skeleton" ) export( - "cfunction", "cxxfunction", "getPlugin", "registerPlugin" + "cfunction", "cxxfunction", "getPlugin", "registerPlugin", "rcpp" ) exportMethods( diff -Nru r-cran-inline-0.3.8/NEWS r-cran-inline-0.3.11/NEWS --- r-cran-inline-0.3.8/NEWS 2010-12-08 04:07:48.000000000 +0000 +++ r-cran-inline-0.3.11/NEWS 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -0.3.8 2010-12-07 - - o faster cfunction and cxxfunction by loading and resolving the routine - at "compile" time - -0.3.7 2010-11-02 - - o fix package.skeleton for use with just a single function - -0.3.6 2010-07-29 - - o compileCode now grabs the error message generated by the compiler and - uses it in in the error message - -0.3.5 2010-06-02 - - o new R function "cxxfunction" to generate an R function with inlined - C++ code using the .Call calling convention. The function was introduced - to accomodate the needs of the Rcpp family of packages. - - o new R functions "getPlugin" and "registerPlugin" to manage the - plugin system of cxxfunction. - - o The function package.skeleton (from utils) is made generic and a - method is available to generate a package skeleton from a function - generated by cfunction or cxxfunction diff -Nru r-cran-inline-0.3.8/R/cfunction.R r-cran-inline-0.3.11/R/cfunction.R --- r-cran-inline-0.3.8/R/cfunction.R 2010-11-30 13:17:27.000000000 +0000 +++ r-cran-inline-0.3.11/R/cfunction.R 2013-02-27 01:49:53.000000000 +0000 @@ -177,9 +177,9 @@ fn <- function(arg) { NULL } - + DLL <- dyn.load( libLFile ) - + ## Modify the function formals to give the right argument list args <- formals(fn)[ rep(1, length(sig[[i]])) ] names(args) <- names(sig[[i]]) @@ -193,8 +193,8 @@ else { body <- quote( CONVENTION("EXTERNALNAME", as.logical(ARG), as.integer(ARG), as.double(ARG), as.complex(ARG), as.character(ARG), - as.character(ARG), as.double(ARG)) )[ c(1:2,types+2) ] - names(body) <- c( NA, "name", names(sig[[i]]) ) + as.raw(ARG), as.double(ARG)) )[ c(1:2,types+2) ] + names(body) <- c( NA, "", names(sig[[i]]) ) for ( j in seq(along = sig[[i]]) ) body[[j+2]][[2]] <- as.name(names(sig[[i]])[j]) } body[[1]] <- get(convention) @@ -235,9 +235,9 @@ } else { ## UNIX-alike build - libCFile <- paste(tempdir(), "/", f, ".EXT", sep="") - libLFile <- paste(tempdir(), "/", f, ".so", sep="") - libLFile2 <- paste(tempdir(), "/", f, ".sl", sep="") + libCFile <- paste(tempdir(), "/", f, ".EXT", sep="") + libLFile <- paste(tempdir(), "/", f, .Platform$dynlib.ext, sep="") + libLFile2 <- paste(tempdir(), "/", f, ".sl", sep="") } extension <- switch(language, "C++"=".cpp", C=".c", Fortran=".f", F95=".f95", ObjectiveC=".m", "ObjectiveC++"=".mm") diff -Nru r-cran-inline-0.3.8/R/cxxfunction.R r-cran-inline-0.3.11/R/cxxfunction.R --- r-cran-inline-0.3.8/R/cxxfunction.R 2010-12-08 04:06:21.000000000 +0000 +++ r-cran-inline-0.3.11/R/cxxfunction.R 2013-02-27 11:32:33.000000000 +0000 @@ -6,9 +6,9 @@ #include #include ' - list( - includes = includes, - body = function( x ) paste( x, '\nRf_warning("your C++ program does not return anything"); \n return R_NilValue ; ' ) + list( + includes = includes, + body = function( x ) paste( x, '\nRf_warning("your C++ program does not return anything"); \n return R_NilValue ; ' ) ) } @@ -28,27 +28,27 @@ } else { stop( sprintf( "could not find plugin '%s'", name ) ) } - + } - + paste0 <- function(...) paste(..., sep="") addLineNumbers <- function( code ){ code <- strsplit( paste( code, collapse = "\n" ), "\n" )[[1]] - sprintf( "%4d : %s", 1:length(code), code) + sprintf( "%4d : %s", 1:length(code), code) } cxxfunction <- function ( - sig = character(), body = character(), - plugin = "default", - includes = "", - settings = getPlugin(plugin), - ..., + sig = character(), body = character(), + plugin = "default", + includes = "", + settings = getPlugin(plugin), + ..., verbose = FALSE ){ - - f <- basename( tempfile( ) ) - + + f <- basename( tempfile( ) ) + if( ! is.list( sig ) ){ sig <- list( sig ) names( sig ) <- f @@ -57,17 +57,17 @@ } if( length(sig) != length(body) ) stop("mismatch between the number of functions declared in 'sig' and the number of function bodies provided in 'body'") - + signature <- lapply( sig, function(x) { - if( ! length(x) ){ - "" + if( ! length(x) ){ + "" } else { paste( sprintf( "SEXP %s", names(x) ), collapse = ", " ) - } + } } ) - + decl <- lapply( 1:length(sig) , function(index) { - sprintf( 'SEXP %s( %s) ;', names(signature)[index] , signature[[index]] ) + sprintf( 'SEXP %s( %s) ;', names(signature)[index] , signature[[index]] ) } ) def <- lapply( 1:length(sig), function(index){ @@ -75,11 +75,11 @@ SEXP %s( %s ){ %s } -', names(signature)[index], - signature[[index]], +', names(signature)[index], + signature[[index]], if(is.null(settings$body)) body[[index]] else settings$body(body[[index]]) ) } ) - + settings_includes <- if( is.null( settings$includes ) ) "" else paste( settings$includes, collapse = "\n" ) code <- sprintf( ' @@ -97,12 +97,12 @@ // definition %s -', settings_includes , paste( includes, collapse = "\n" ), - paste( decl, collapse = "\n" ), +', settings_includes , paste( includes, collapse = "\n" ), + paste( decl, collapse = "\n" ), paste( def, collapse = "\n") ) - + if( !is.null( env <- settings$env ) ){ do.call( Sys.setenv, env ) if( isTRUE(verbose) ){ @@ -110,13 +110,13 @@ writeLines( sprintf( "%s = %s", names(env), env ) ) } } - + LinkingTo <- settings$LinkingTo if( !is.null( LinkingTo ) ){ - paths <- .find.package(LinkingTo, quiet=TRUE) + paths <- find.package(LinkingTo, quiet=TRUE) if( length( paths ) ){ - flag <- paste( - paste0( '-I"', paths, '/include"' ), + flag <- paste( + paste0( '-I"', paths, '/include"' ), collapse = " " ) Sys.setenv( CLINK_CPPFLAGS = flag ) if( isTRUE( verbose ) ){ @@ -124,50 +124,50 @@ cat( "CLINK_CPPFLAGS = ", flag, "\n\n" ) } } - + } - + if( isTRUE( verbose ) ){ writeLines( " >> Program source :\n" ) writeLines( addLineNumbers( code ) ) } - + language <- "C++" - + ## WRITE AND COMPILE THE CODE - libLFile <- compileCode( f, code, language = language, verbose = verbose ) - + libLFile <- compileCode( f, code, language = language, verbose = verbose ) + ## SET A FINALIZER TO PERFORM CLEANUP cleanup <- function(env) { if ( f %in% names(getLoadedDLLs()) ) dyn.unload(libLFile) unlink(libLFile) } reg.finalizer(environment(), cleanup, onexit=TRUE) - + ## Create new objects of class CFunc, each containing the code of ALL inline ## functions. This will be used to recompile the whole shared lib when needed res <- vector("list", length(sig)) names(res) <- names(sig) res <- new( "CFuncList", res ) - + DLL <- dyn.load( libLFile ) - + for( i in seq_along(sig) ){ res[[i]] <- new( "CFunc", code = code ) - + fn <- function(arg) { NULL } - + ## Modify the function formals to give the right argument list args <- formals(fn)[ rep(1, length(sig[[i]])) ] names(args) <- names(sig[[i]]) formals(fn) <- args - + ## create .Call function call that will be added to 'fn' body <- quote( .Call( EXTERNALNAME, ARG) )[ c(1:2, rep(3, length(sig[[i]]))) ] for ( j in seq(along = sig[[i]]) ) body[[j+2]] <- as.name(names(sig[[i]])[j]) - + body[[1L]] <- .Call body[[2L]] <- getNativeSymbolInfo( names(sig)[[i]], DLL )$address ## update the body of 'fn' @@ -175,10 +175,11 @@ ## set fn as THE function in CFunc of res[[i]] res[[i]]@.Data <- fn } - + ## clear the environment rm( j ) convention <- ".Call" if( identical( length(sig), 1L ) ) res[[1L]] else res } +rcpp <- function(..., plugin="Rcpp") cxxfunction(..., plugin=plugin) diff -Nru r-cran-inline-0.3.8/R/getDynLib.R r-cran-inline-0.3.11/R/getDynLib.R --- r-cran-inline-0.3.8/R/getDynLib.R 2010-06-02 22:25:14.000000000 +0000 +++ r-cran-inline-0.3.11/R/getDynLib.R 2012-10-02 21:55:43.000000000 +0000 @@ -1,16 +1,16 @@ setGeneric("getDynLib", function(x, ...) standardGeneric("getDynLib") ) -setMethod( "getDynLib", signature( x = "character" ), +setMethod( "getDynLib", signature( x = "character" ), function( x ){ dlls <- getLoadedDLLs() if( x %in% names( dlls ) ){ dlls[[ x ]] } else { - stop( sprintf( "dll %s not loaded" ) ) + stop( sprintf( "dll %s not loaded", x ) ) } } ) -setMethod( "getDynLib", signature( x = "CFunc" ), +setMethod( "getDynLib", signature( x = "CFunc" ), function( x ){ env <- environment( x@.Data ) f <- get( "f", env ) diff -Nru r-cran-inline-0.3.8/debian/changelog r-cran-inline-0.3.11/debian/changelog --- r-cran-inline-0.3.8/debian/changelog 2013-05-06 17:13:03.000000000 +0000 +++ r-cran-inline-0.3.11/debian/changelog 2013-05-06 17:13:03.000000000 +0000 @@ -1,3 +1,39 @@ +r-cran-inline (0.3.11-2precise0) precise; urgency=low + + * Compilation for Ubuntu 12.04.2 LTS + + -- Michael Rutter Mon, 06 May 2013 16:59:24 +0000 + +r-cran-inline (0.3.11-2) unstable; urgency=low + + * debian/control: Set Build-Depends: to current R version + + * (Re-)building with R 3.0.0 + + -- Dirk Eddelbuettel Fri, 05 Apr 2013 07:32:36 -0500 + +r-cran-inline (0.3.11-1) unstable; urgency=low + + * New upstream version + + -- Dirk Eddelbuettel Tue, 26 Feb 2013 21:00:03 -0600 + +r-cran-inline (0.3.10-1) unstable; urgency=low + + * New upstream version + + * debian/control: Set Build-Depends: to current R version + * debian/control: Change Depends to ${R:Depends} + * debian/control: Set Standards-Version: to current version + + -- Dirk Eddelbuettel Wed, 03 Oct 2012 12:53:29 -0500 + +r-cran-inline (0.3.9-1) unstable; urgency=low + + * New upstream version + + -- Dirk Eddelbuettel Tue, 02 Oct 2012 17:17:57 -0500 + r-cran-inline (0.3.8-1) unstable; urgency=low * New upstream version diff -Nru r-cran-inline-0.3.8/debian/control r-cran-inline-0.3.11/debian/control --- r-cran-inline-0.3.8/debian/control 2013-05-06 17:13:03.000000000 +0000 +++ r-cran-inline-0.3.11/debian/control 2013-05-06 17:13:03.000000000 +0000 @@ -2,13 +2,13 @@ Section: gnu-r Priority: optional Maintainer: Dirk Eddelbuettel -Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 2.12.0), cdbs -Standards-Version: 3.9.1 +Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.0.0), cdbs +Standards-Version: 3.9.4 Homepage: http://cran.r-project.org/web/packages/inline/index.html Package: r-cran-inline Architecture: all -Depends: ${shlibs:Depends}, r-base-core (>= 2.12.0) +Depends: ${shlibs:Depends}, ${R:Depends} Description: GNU R package to inline C, C++, Fortran functions from R This package provides functionality to dynamically define R functions and S4 methods with in-lined C, C++ or Fortran code supporting .C and .Call calling diff -Nru r-cran-inline-0.3.8/inst/NEWS.Rd r-cran-inline-0.3.11/inst/NEWS.Rd --- r-cran-inline-0.3.8/inst/NEWS.Rd 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-inline-0.3.11/inst/NEWS.Rd 2013-05-06 17:13:03.000000000 +0000 @@ -0,0 +1,61 @@ +\name{NEWS} +\title{News for Package 'inline'} +\newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} + +\section{Changes in inline version 0.3.11 (2013-02-26)}{ + \itemize{ + \item Fix bug in \code{cfunction} for \code{.C} convention with raw vectors. + \item Correct \code{cfunction} to use \code{.Platform$dynlib.ext} as + the file extension for the library file (unless on Windows). + \item Allow \code{rcpp} wrapper to pass another plugin (as eg RcppArmadillo) + } +} + +\section{Changes in inline version 0.3.10 (2012-10-03)}{ + \itemize{ + \item \code{getDynLib()} error message corrected as suggested by + Yasir Suhail + \item Added \code{rcpp()} wrapper for \code{cxxfunction()} which + sets \code{plugin="Rcpp"} + \item Converted NEWS to NEWS.Rd + \item New maintainer, after having coordinated releases (along with + Romain) since 0.3.5 in June 2010 + } +} +\section{Changes in inline version 0.3.9 (2012-10-02)}{ + \itemize{ + \item Uncoordinating hijacking of package by CRAN maintainers with a + single word change in cfunction.R to prevent an error under an + unreleased version of R + } +} +\section{Changes in inline version 0.3.8 (2010-12-07)}{ + \itemize{ + \item faster \code{cfunction} and \code{cxxfunction} by loading and + resolving the routine at \dQuote{compile} time + } +} +\section{Changes in inline version 0.3.7 (2010-11-02)}{ + \itemize{ + \item fix \code{package.skeleton} for use with just a single function + } +} +\section{Changes in inline version 0.3.6 (2010-07-29)}{ + \itemize{ + \item compileCode now grabs the error message generated by the compiler and + uses it in in the error message + } +} +\section{Changes in inline version 0.3.5 (2010-06-02)}{ + \itemize{ + \item new R function \code{cxxfunction} to generate an R function + with inlined C++ code using the \code{.Call} calling convention. The + function was introduced to accomodate the needs of the Rcpp family + of packages. + \item new R functions \code{getPlugin} and \code{registerPlugin} to + manage the plugin system of \code{cxxfunction}. + \item The function \code{package.skeleton} (from utils) is made + generic and a method is available to generate a package skeleton + from a function generated by \code{cfunction} or \code{cxxfunction} + } +} diff -Nru r-cran-inline-0.3.8/man/cxxfunction.Rd r-cran-inline-0.3.11/man/cxxfunction.Rd --- r-cran-inline-0.3.8/man/cxxfunction.Rd 2010-05-29 16:58:20.000000000 +0000 +++ r-cran-inline-0.3.11/man/cxxfunction.Rd 2013-02-09 17:04:35.000000000 +0000 @@ -1,16 +1,21 @@ \name{cxxfunction} \alias{cxxfunction} +\alias{rcpp} \title{ inline C++ function } \description{ Functionality to dynamically define an R function with inlined C++ code -using the \code{\link{.Call}} calling convention +using the \code{\link{.Call}} calling convention. + +The \code{rcpp()} wrapper sets the plugin to the \dQuote{Rcpp} value +suitable for using \pkg{Rcpp}. } \usage{ cxxfunction(sig = character(), body = character(), plugin = "default", includes = "", settings = getPlugin(plugin), ..., verbose = FALSE) +rcpp(..., plugin="Rcpp") } \arguments{ \item{sig}{Signature of the function. A named character vector} @@ -44,6 +49,10 @@ ', plugin = "Rcpp" ) fx( 2L, 5 ) + ## equivalent shorter form using rcpp() + fx <- rcpp(signature(x = "integer", y = "numeric"), + ' return wrap( as(x) * as(y) ) ; ') + } # RcppArmadillo plugin