[Rcpp-commits] r2662 - in pkg/RcppClassic/inst: . examples examples/RcppClassicExample examples/RcppClassicExample/R examples/RcppClassicExample/man examples/RcppClassicExample/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 2 12:19:51 CET 2010


Author: romain
Date: 2010-12-02 12:19:51 +0100 (Thu, 02 Dec 2010)
New Revision: 2662

Added:
   pkg/RcppClassic/inst/examples/
   pkg/RcppClassic/inst/examples/RcppClassicExample/
   pkg/RcppClassic/inst/examples/RcppClassicExample/DESCRIPTION
   pkg/RcppClassic/inst/examples/RcppClassicExample/NAMESPACE
   pkg/RcppClassic/inst/examples/RcppClassicExample/R/
   pkg/RcppClassic/inst/examples/RcppClassicExample/R/foo.R
   pkg/RcppClassic/inst/examples/RcppClassicExample/man/
   pkg/RcppClassic/inst/examples/RcppClassicExample/man/RcppClassicExample-package.Rd
   pkg/RcppClassic/inst/examples/RcppClassicExample/src/
   pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars
   pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars.win
   pkg/RcppClassic/inst/examples/RcppClassicExample/src/foo.cpp
Log:
added example package using classic api

Added: pkg/RcppClassic/inst/examples/RcppClassicExample/DESCRIPTION
===================================================================
--- pkg/RcppClassic/inst/examples/RcppClassicExample/DESCRIPTION	                        (rev 0)
+++ pkg/RcppClassic/inst/examples/RcppClassicExample/DESCRIPTION	2010-12-02 11:19:51 UTC (rev 2662)
@@ -0,0 +1,12 @@
+Package: RcppClassicExample
+Type: Package
+Title: Example package using RcppClassic
+Version: 1.0
+Date: 2010-12-02
+Author: Who wrote it
+Maintainer: Who to complain to <yourfault at somewhere.net>
+Description: More about what it does (maybe more than one line)
+License: What license is it under?
+LazyLoad: yes
+Depends: Rcpp (>= 0.8.9.2), RcppClassic
+LinkingTo: RcppClassic, Rcpp

Added: pkg/RcppClassic/inst/examples/RcppClassicExample/NAMESPACE
===================================================================
--- pkg/RcppClassic/inst/examples/RcppClassicExample/NAMESPACE	                        (rev 0)
+++ pkg/RcppClassic/inst/examples/RcppClassicExample/NAMESPACE	2010-12-02 11:19:51 UTC (rev 2662)
@@ -0,0 +1,3 @@
+useDynLib(RcppClassicExample)
+export(foo)
+

Added: pkg/RcppClassic/inst/examples/RcppClassicExample/R/foo.R
===================================================================
--- pkg/RcppClassic/inst/examples/RcppClassicExample/R/foo.R	                        (rev 0)
+++ pkg/RcppClassic/inst/examples/RcppClassicExample/R/foo.R	2010-12-02 11:19:51 UTC (rev 2662)
@@ -0,0 +1,5 @@
+
+foo <- function(x){
+	.Call( "foo", x, PACKAGE = "blabla" )
+}
+

Added: pkg/RcppClassic/inst/examples/RcppClassicExample/man/RcppClassicExample-package.Rd
===================================================================
--- pkg/RcppClassic/inst/examples/RcppClassicExample/man/RcppClassicExample-package.Rd	                        (rev 0)
+++ pkg/RcppClassic/inst/examples/RcppClassicExample/man/RcppClassicExample-package.Rd	2010-12-02 11:19:51 UTC (rev 2662)
@@ -0,0 +1,12 @@
+\name{RcppClassicExample-package}
+\alias{RcppClassicExample-package}
+\alias{RcppClassicExample}
+\docType{package}
+\title{
+Example package using RcppClassic
+}
+\description{
+Example package using RcppClassic
+}
+\keyword{ package }
+

Added: pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars
===================================================================
--- pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars	                        (rev 0)
+++ pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars	2010-12-02 11:19:51 UTC (rev 2662)
@@ -0,0 +1,2 @@
+PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` `$(R_HOME)/bin/Rscript -e "RcppClassic:::LdFlags()"` 
+

Added: pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars.win
===================================================================
--- pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars.win	                        (rev 0)
+++ pkg/RcppClassic/inst/examples/RcppClassicExample/src/Makevars.win	2010-12-02 11:19:51 UTC (rev 2662)
@@ -0,0 +1,2 @@
+PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()")
+PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "RcppClassic:::LdFlags()")

Added: pkg/RcppClassic/inst/examples/RcppClassicExample/src/foo.cpp
===================================================================
--- pkg/RcppClassic/inst/examples/RcppClassicExample/src/foo.cpp	                        (rev 0)
+++ pkg/RcppClassic/inst/examples/RcppClassicExample/src/foo.cpp	2010-12-02 11:19:51 UTC (rev 2662)
@@ -0,0 +1,12 @@
+
+#include <RcppClassic.h>
+
+RcppExport SEXP foo(SEXP x){
+    std::vector<int> iv = Rcpp::as<std::vector<int> >( x );
+	for (size_t i=0; i<iv.size(); i++) {
+        iv[i] = 2*iv[i];
+    }
+    RcppResultSet rs;
+    rs.add("", iv);
+    return(rs.getSEXP());
+}



More information about the Rcpp-commits mailing list