[Rcpp-commits] r4526 - in pkg/Rcpp: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 20 21:12:57 CEST 2013
Author: edd
Date: 2013-09-20 21:12:57 +0200 (Fri, 20 Sep 2013)
New Revision: 4526
Added:
pkg/Rcpp/man/Rcpp-internal.Rd
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/NAMESPACE
pkg/Rcpp/R/Module.R
pkg/Rcpp/R/RcppClass.R
pkg/Rcpp/man/setRcppClass.Rd
Log:
a number of smaller cosmetic changes (incl NAMESPACE additions and a new
internal manual page) to make (R-devel's) R CMD check happy
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2013-09-20 12:40:57 UTC (rev 4525)
+++ pkg/Rcpp/ChangeLog 2013-09-20 19:12:57 UTC (rev 4526)
@@ -1,3 +1,14 @@
+2013-09-20 Dirk Eddelbuettel <edd at debian.org>
+
+ * R/Module.R: More ':::' cleanups to make R CMD check happy
+ * R/RcppClass.R: Ditto
+
+ * NAMESPACE: Some new exports related to this
+
+ * man/setRcppClass.Rd: Document loadRcppClass()
+ * man/Rcpp-internal.Rd: Added in order to document
+ cpp_object_initializer() and cpp_object_dummy()
+
2013-09-19 Dirk Eddelbuettel <edd at debian.org>
* inst/include/Rcpp/longlong.h: Unbreak long long by making it (as
Modified: pkg/Rcpp/NAMESPACE
===================================================================
--- pkg/Rcpp/NAMESPACE 2013-09-20 12:40:57 UTC (rev 4525)
+++ pkg/Rcpp/NAMESPACE 2013-09-20 19:12:57 UTC (rev 4526)
@@ -18,14 +18,18 @@
populate,
loadRcppModules,
setRcppClass,
+ loadRcppClass,
loadModule,
cppFunction,
evalCpp,
sourceCpp,
compileAttributes,
registerPlugin,
- RcppLdFlags,
- demangle, sizeof
+ RcppLdFlags,
+ demangle,
+ sizeof,
+ cpp_object_initializer,
+ cpp_object_dummy
)
S3method( print, bytes )
exportClass(RcppClass)
Modified: pkg/Rcpp/R/Module.R
===================================================================
--- pkg/Rcpp/R/Module.R 2013-09-20 12:40:57 UTC (rev 4525)
+++ pkg/Rcpp/R/Module.R 2013-09-20 19:12:57 UTC (rev 4526)
@@ -155,7 +155,7 @@
}
cpp_object_maker <- function(typeid, pointer){
- Class <- Rcpp:::.classes_map[[ typeid ]]
+ Class <- .classes_map[[ typeid ]]
new( Class, .object_pointer = pointer )
}
@@ -230,11 +230,11 @@
.self <- .refClassDef <- NULL
generator$methods(initialize =
if(cpp_hasDefaultConstructor(CLASS))
- function(...) Rcpp:::cpp_object_initializer(.self,.refClassDef, ...)
+ function(...) cpp_object_initializer(.self,.refClassDef, ...)
else
function(...) {
- if(nargs()) Rcpp:::cpp_object_initializer(.self,.refClassDef, ...)
- else Rcpp:::cpp_object_dummy(.self, .refClassDef)
+ if(nargs()) cpp_object_initializer(.self,.refClassDef, ...)
+ else cpp_object_dummy(.self, .refClassDef)
}
)
rm( .self, .refClassDef )
@@ -264,12 +264,12 @@
} , where = where )
}
}
-
+
# promoting show to S4
if( any( grepl( "show", names(CLASS at methods) ) ) ){
setMethod( "show", clname, function(object) object$show(), where = where )
}
-
+
}
if(length(classes)) {
module$refClassGenerators <- generators
@@ -280,24 +280,24 @@
clname <- as.character(CLASS)
demangled_name <- sub( "^Rcpp_", "", clname )
.classes_map[[ CLASS at typeid ]] <- storage[[ demangled_name ]] <- .get_Module_Class( module, demangled_name, xp )
-
- # exposing enums values as CLASS.VALUE
+
+ # exposing enums values as CLASS.VALUE
# (should really be CLASS$value but I don't know how to do it)
if( length( CLASS at enums ) ){
for( enum in CLASS at enums ){
for( i in 1:length(enum) ){
- storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i]
+ storage[[ paste( demangled_name, ".", names(enum)[i], sep = "" ) ]] <- enum[i]
}
}
}
-
+
}
# functions
functions <- .Call( Module__functions_names, xp )
for( fun in functions ){
storage[[ fun ]] <- .get_Module_function( module, fun, xp )
-
+
# register as(FROM, TO) methods
converter_rx <- "^[.]___converter___(.*)___(.*)$"
if( length( matches <- grep( converter_rx, functions ) ) ){
@@ -306,13 +306,13 @@
from <- sub( converter_rx, "\\1", fun )
to <- sub( converter_rx, "\\2", fun )
converter <- function( from ){}
- body( converter ) <- substitute( { CONVERT(from) },
+ body( converter ) <- substitute( { CONVERT(from) },
list( CONVERT = storage[[fun]] )
)
setAs( from, to, converter, where = where )
}
}
-
+
}
assign( "storage", storage, envir = as.environment(module) )
@@ -322,7 +322,7 @@
dealWith <- function( x ) if(isTRUE(x[[1]])) invisible(NULL) else x[[2]]
method_wrapper <- function( METHOD, where ){
- noargs <- all( METHOD$nargs == 0 )
+ noargs <- all( METHOD$nargs == 0 )
stuff <- list(
class_pointer = METHOD$class_pointer,
pointer = METHOD$pointer,
@@ -335,9 +335,9 @@
f <- function(...) NULL
if( noargs ){
formals(f) <- NULL
- }
-
- extCall <- if( noargs ) {
+ }
+
+ extCall <- if( noargs ) {
if( all( METHOD$void ) ){
# all methods are void, so we know we want to return invisible(NULL)
substitute(
Modified: pkg/Rcpp/R/RcppClass.R
===================================================================
--- pkg/Rcpp/R/RcppClass.R 2013-09-20 12:40:57 UTC (rev 4525)
+++ pkg/Rcpp/R/RcppClass.R 2013-09-20 19:12:57 UTC (rev 4526)
@@ -25,7 +25,7 @@
where = topenv(parent.frame()),
...) {
myCall <- match.call()
- myCall[[1]] <- quote(Rcpp:::loadRcppClass)
+ myCall[[1]] <- quote(Rcpp::loadRcppClass)
if(!missing(module) && moduleIsLoaded(module, where)) # eval now
eval.parent(myCall)
else {
Added: pkg/Rcpp/man/Rcpp-internal.Rd
===================================================================
--- pkg/Rcpp/man/Rcpp-internal.Rd (rev 0)
+++ pkg/Rcpp/man/Rcpp-internal.Rd 2013-09-20 19:12:57 UTC (rev 4526)
@@ -0,0 +1,22 @@
+\name{Rcpp-internal}
+\alias{Rcpp-internal}
+\alias{cpp_object_initializer}
+\alias{cpp_object_dummy}
+\title{Rcpp internal functions}
+\description{The \pkg{Rcpp} utilizes several internal functions which
+ need to visible within its namespace, yet are not user-facing. This
+ page provides basic documentation for them.
+}
+\usage{
+ cpp_object_initializer(.self, .refClassDef, ..., .object_pointer)
+ cpp_object_dummy(.self, .refClassDef)
+}
+\arguments{
+ \item{.self}{A reference to the object being modified}
+ \item{.refClassDef}{The definition of a reference class}
+ \item{...}{Further arguments}
+ \item{.object_pointer}{Optional external pointer}
+}
+\keyword{programming}
+\keyword{interface}
+\keyword{internal}
Modified: pkg/Rcpp/man/setRcppClass.Rd
===================================================================
--- pkg/Rcpp/man/setRcppClass.Rd 2013-09-20 12:40:57 UTC (rev 4525)
+++ pkg/Rcpp/man/setRcppClass.Rd 2013-09-20 19:12:57 UTC (rev 4526)
@@ -1,5 +1,6 @@
\name{setRcppClass}
\alias{setRcppClass}
+\alias{loadRcppClass}
\alias{RcppClass-class}
\title{
Create a Class Extending a C++ Class
@@ -13,6 +14,9 @@
\usage{
setRcppClass(Class, CppClass, module, fields = list(), contains = ,
methods = , saveAs = Class, where = , ...)
+loadRcppClass(Class, CppClass, module, fields = character(),
+ contains = character(),
+ methods = , saveAs = Class, where = , ...)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
@@ -50,7 +54,7 @@
}
}
\details{
-The call to this function normally appears in the source code for a
+The call to these functions normally appears in the source code for a
package.
It generates a load action that loads the specified module and
extracts the C++ class definition specified.
More information about the Rcpp-commits
mailing list