[Rcpp-commits] r1349 - in pkg: Rcpp/R Rcpp/inst/doc/snippets RcppArmadillo/R RcppArmadillo/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 28 17:55:59 CEST 2010


Author: romain
Date: 2010-05-28 17:55:58 +0200 (Fri, 28 May 2010)
New Revision: 1349

Added:
   pkg/Rcpp/R/inline.R
   pkg/RcppArmadillo/R/inline.R
Modified:
   pkg/Rcpp/inst/doc/snippets/highlight.R
   pkg/RcppArmadillo/man/RcppArmadillo-package.Rd
Log:
implementing the inline implicit plugin stuff

Added: pkg/Rcpp/R/inline.R
===================================================================
--- pkg/Rcpp/R/inline.R	                        (rev 0)
+++ pkg/Rcpp/R/inline.R	2010-05-28 15:55:58 UTC (rev 1349)
@@ -0,0 +1,64 @@
+# Copyright (C) 2009- 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/>.
+
+Makevars.Rcpp <- '
+## Use the R_HOME indirection to support installations of multiple R version
+PKG_LIBS = $(shell $(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()" )
+'
+
+Makevars.win.Rcpp <- '
+## Use the R_HOME indirection to support installations of multiple R version
+PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()")
+'
+
+Rcpp.plugin.maker <- function( include.before = "", include.after = "", 
+	LinkingTo = "Rcpp", Depends = "Rcpp", libs = "", 
+	Makevars = Makevars.Rcpp, 
+	Makevars.win = Makevars.win.Rcpp
+){
+	function( ... ){
+includes <- sprintf( "%s
+#include <Rcpp.h>
+%s
+
+#ifndef BEGIN_RCPP
+#define BEGIN_RCPP
+#endif
+
+#ifndef END_RCPP
+#define END_RCPP
+#endif
+
+using namespace Rcpp;
+", include.before, include.after )
+
+	list( 
+		env = list( PKG_LIBS = paste( Rcpp:::RcppLdFlags(), libs ) ), 
+		includes = includes, 
+		LinkingTo = LinkingTo , 
+		body = function( x ){
+			sprintf( "BEGIN_RCPP\n%s\nEND_RCPP", x )	
+		}, 
+		Depends = Depends, 
+		Makevars = Makevars, 
+		Makevars.win = Makevars.win
+	)
+}
+}
+
+inline_cxx_plugin <- Rcpp.plugin.maker() 
+

Modified: pkg/Rcpp/inst/doc/snippets/highlight.R
===================================================================
--- pkg/Rcpp/inst/doc/snippets/highlight.R	2010-05-28 11:51:09 UTC (rev 1348)
+++ pkg/Rcpp/inst/doc/snippets/highlight.R	2010-05-28 15:55:58 UTC (rev 1349)
@@ -17,13 +17,11 @@
 }
 
 require( highlight )
-r <- renderer_latex( doc = FALSE )
-r$header <- function(){
-	"\\vspace{1em}\\noindent\\fbox{\\begin{minipage}{0.9\\textwidth}\n\\ttfamily\\noindent\n\\hlstd{}"
+if( compareVersion( "0.1-9", packageDescription( "highlight" )[["Version"]] ) ){
+	stop( "version 0.1-9 of highlight is required for the minipage argument" )
 }
-r$footer <- function(){
-	"\\mbox{}\n\\normalfont\n\\end{minipage}}\\vspace{1em}"
-}
+
+r <- renderer_latex( doc = FALSE, minipage = TRUE )
 rfiles <- setdiff( list.files( pattern = "[.]R$" ), "highlight.R" )
 for( f in rfiles ){
 	base <- sub( "[.]R$", "", f )

Added: pkg/RcppArmadillo/R/inline.R
===================================================================
--- pkg/RcppArmadillo/R/inline.R	                        (rev 0)
+++ pkg/RcppArmadillo/R/inline.R	2010-05-28 15:55:58 UTC (rev 1349)
@@ -0,0 +1,32 @@
+## Copyright (C)       2010 Dirk Eddelbuettel, Romain Francois and Douglas Bates
+##
+## This file is part of RcppArmadillo.
+##
+## RcppArmadillo 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.
+##
+## RcppArmadillo 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 RcppArmadillo.  If not, see <http://www.gnu.org/licenses/>.
+
+Makevars.RcppArmadillo <- '
+PKG_LIBS = $(shell $(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()" ) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
+'
+Makevars.win.RcppArmadillo <- '
+PKG_LIBS = $(shell $(R_HOME)/bin${R_ARCH_BIN}/Rscript.exe -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
+'
+
+inline_cxx_plugin <- Rcpp:::Rcpp.plugin.maker(
+	include.before = "#include <RcppArmadillo.h>", 
+	LinkingTo = c("Rcpp", "RcppArmadillo"), 
+	Depends = c("Rcpp", "RcppArmadillo"),
+	libs = "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)", 
+	Makevars = Makevars.RcppArmadillo, 
+	Makevars.win = Makevars.win.RcppArmadillo
+)

Modified: pkg/RcppArmadillo/man/RcppArmadillo-package.Rd
===================================================================
--- pkg/RcppArmadillo/man/RcppArmadillo-package.Rd	2010-05-28 11:51:09 UTC (rev 1348)
+++ pkg/RcppArmadillo/man/RcppArmadillo-package.Rd	2010-05-28 15:55:58 UTC (rev 1349)
@@ -68,7 +68,7 @@
 \preformatted{PKG_LIBS = $(shell $(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()" ) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) }
 
 and this line to the Makevars.win: 
-\preformatted{PKG_LIBS = $(shell $(R_HOME)/bin/Rscript.exe -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) }
+\preformatted{PKG_LIBS = $(shell $(R_HOME)/bin${R_ARCH_BIN}/Rscript.exe -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) }
 }
 }
 



More information about the Rcpp-commits mailing list