[Rcpp-commits] r1459 - in pkg/Rcpp/inst/doc: . Rcpp-extending
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jun 7 13:23:14 CEST 2010
Author: romain
Date: 2010-06-07 13:23:13 +0200 (Mon, 07 Jun 2010)
New Revision: 1459
Added:
pkg/Rcpp/inst/doc/Rcpp-extending.Rnw
pkg/Rcpp/inst/doc/Rcpp-extending/
pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw
pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending.Rnw
Modified:
pkg/Rcpp/inst/doc/Makefile
Log:
in progress mini vignette about wrap and as
Modified: pkg/Rcpp/inst/doc/Makefile
===================================================================
--- pkg/Rcpp/inst/doc/Makefile 2010-06-07 06:40:23 UTC (rev 1458)
+++ pkg/Rcpp/inst/doc/Makefile 2010-06-07 11:23:13 UTC (rev 1459)
@@ -105,3 +105,24 @@
rm Rcpp-FAQ.Rnw
cp Rcpp-FAQ/Rcpp-FAQ-fake.Rnw Rcpp-FAQ.Rnw
+Rcpp-extending.pdf : Rcpp-extending/Rcpp-extending.Rnw
+ rm Rcpp-extending.Rnw
+ cp -f Rcpp-extending/Rcpp-extending.Rnw .
+ Rscript -e "require(highlight); driver <- HighlightWeaveLatex(boxes = TRUE, bg = 'white' ); Sweave( 'Rcpp-extending.Rnw', driver = driver ); "
+ Rscript -e "tools::texi2dvi( 'Rcpp-extending.tex', pdf = TRUE, clean = FALSE )"
+ bibtex Rcpp-extending
+ifeq ($(whoami),edd)
+ pdflatex Rcpp-extending
+ pdflatex Rcpp-extending
+else
+ Rscript -e "tools::texi2dvi( 'Rcpp-extending.tex', pdf = TRUE, clean = TRUE )"
+endif
+ rm -fr Rcpp-extending.tex
+ rm -fr Rcpp-extending.bbl
+ rm -fr Rcpp-extending.blg
+ rm -fr Rcpp-extending.aux
+ rm -fr Rcpp-extending.out
+ rm -fr Rcpp-extending.log
+ rm Rcpp-extending.Rnw
+ cp Rcpp-extending/Rcpp-extending-fake.Rnw Rcpp-extending.Rnw
+
Added: pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw (rev 0)
+++ pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending-fake.Rnw 2010-06-07 11:23:13 UTC (rev 1459)
@@ -0,0 +1,4 @@
+\documentclass[10pt]{article}
+%\VignetteIndexEntry{Rcpp-extending}
+\begin{document}
+\end{document}
Added: pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending.Rnw (rev 0)
+++ pkg/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending.Rnw 2010-06-07 11:23:13 UTC (rev 1459)
@@ -0,0 +1,88 @@
+\documentclass[10pt]{article}
+%\VignetteIndexEntry{Rcpp-extending}
+\usepackage{vmargin}
+\setmargrb{0.75in}{0.75in}{0.75in}{0.75in}
+
+\usepackage{color, alltt}
+\usepackage[authoryear,round,longnamesfirst]{natbib}
+\usepackage[colorlinks]{hyperref}
+\definecolor{link}{rgb}{0,0,0.3} %% next few lines courtesy of RJournal.sty
+\hypersetup{
+ colorlinks,%
+ citecolor=link,%
+ filecolor=link,%
+ linkcolor=link,%
+ urlcolor=link
+}
+
+\newcommand{\proglang}[1]{\textsf{#1}}
+\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}}
+
+\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois}
+\title{Extending \pkg{Rcpp}}
+
+<<echo=FALSE>>=
+link <- function( f, package, text = f, root = "http://finzi.psych.upenn.edu/R/library/" ){
+ h <- if( missing(package) ) {
+ as.character( help( f ) )
+ } else {
+ as.character( help( f, package = paste( package, sep = "" ) ) )
+ }
+ if( ! length(h) ){
+ sprintf( "\\\\textbf{%s}", f )
+ } else {
+ rx <- "^.*/([^/]*?)/help/(.*?)$"
+ package <- sub( rx, "\\1", h, perl = TRUE )
+ page <- sub( rx, "\\2", h, perl = TRUE )
+ sprintf( "\\\\href{%s%s/html/%s.html}{\\\\texttt{%s}}", root, package, page, text )
+ }
+}
+linkS4class <- function( cl, package, text = cl, root = "http://finzi.psych.upenn.edu/R/library/" ){
+ link( sprintf("%s-class", cl), package, text, root )
+}
+@
+
+\begin{document}
+\maketitle
+
+\abstract{
+ \noindent
+ This note gives an overview of the mechanics programmers should follow to
+ extend \pkg{Rcpp} \citep{CRAN:Rcpp} with their own classes. This document
+ is based on our experience to extending \pkg{Rcpp} to work with
+ Armadillo \citep{Armadillo} classes, available in the separate package
+ \pkg{RcppArmadillo} \citep{CRAN:RcppArmadillo}. This document assumes
+ knowledge of \pkg{Rcpp} as well as some knowledge of \proglang{C++}
+ templates.
+ }
+
+
+\section{Introduction}
+
+\pkg{Rcpp} pilots data interchange between \proglang{R} and \proglang{C++}
+through the templates \texttt{Rcpp::wrap} and \texttt{Rcpp::as} whose
+declarations are :
+
+<<lang=cpp>>=
+// conversion from C++ to R
+template <typename T> SEXP wrap(const T& object) ;
+
+// conversion from R to C++
+template <typename T> T as( SEXP m_sexp) throw(not_compatible) ;
+@
+
+These converters are often used implicitely, as in the following code chunk:
+
+<<lang=cpp>>=
+
+@
+
+
+
+
+
+\bibliographystyle{abbrvnat}
+\bibliography{Rcpp-modules}
+
+\end{document}
+
Added: pkg/Rcpp/inst/doc/Rcpp-extending.Rnw
===================================================================
--- pkg/Rcpp/inst/doc/Rcpp-extending.Rnw (rev 0)
+++ pkg/Rcpp/inst/doc/Rcpp-extending.Rnw 2010-06-07 11:23:13 UTC (rev 1459)
@@ -0,0 +1,4 @@
+\documentclass[10pt]{article}
+%\VignetteIndexEntry{Rcpp-extending}
+\begin{document}
+\end{document}
More information about the Rcpp-commits
mailing list