Skip to content

Feature/update modules example #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
2017-04-11 Dirk Eddelbuettel <edd@debian.org>

* inst/inst/unitTests/testRcppClass/src/init.c (R_init_testRcppClass): Call
R_registerRoutines() and R_useDynamicSymbols(); also ensure
_rcpp_module_boot_* is registered for each module
* inst/unitTests/testRcppClass/NAMESPACE: Added registration

* inst/unitTests/testRcppClass/DESCRIPTION (Title): Title case

* inst/unitTests/testRcppClass/R/rcpp_hello_world.R (rcpp_hello_world):
Call the renamed C++ function
* inst/unitTests/testRcppClass/src/rcpp_hello_world.cpp (rcpp_hello_world_cpp):
Renamed C++ function to be distinct from R function calling it
* inst/unitTests/testRcppClass/src/rcpp_hello_world.h: Ditto
* inst/unitTests/testRcppClass/man/rcpp_hello_world.Rd: Alias renamed
C++ function

2017-04-09 Dirk Eddelbuettel <edd@debian.org>

* inst/unitTests/testRcppModule/src/init.c (R_init_testRcppModule): Call
R_registerRoutines() and R_useDynamicSymbols(); also ensure
_rcpp_module_boot_* is registered for each module
* inst/unitTests/testRcppModule/NAMESPACE: Added registration

* inst/unitTests/testRcppModule/DESCRIPTION (Title): Title case

* inst/unitTests/testRcppModule/R/rcpp_hello_world.R (rcpp_hello_world):
Call the renamed C++ function
* inst/unitTests/testRcppModule/src/rcpp_hello_world.cpp (rcpp_hello_world_cpp):
Renamed C++ function to be distinct from R function calling it
* inst/unitTests/testRcppModule/src/rcpp_hello_world.h: Ditto
* inst/unitTests/testRcppModule/man/rcpp_hello_world.Rd: Alias renamed
C++ function

* inst/unitTests/testRcppModule/man/Rcpp_modules_examples.Rd: Alias
renamed modules
* inst/unitTests/testRcppModule/tests/modules.R: Call renamed module

2017-04-03 Jim Hester <james.f.hester@gmail.com>

* inst/include/Rcpp/exceptions.h: Added support for throwing
Expand All @@ -10,6 +48,11 @@

* inst/vignettes/Rcpp-FAQ.Rnw: Added "Known Issues" section to FAQ

2017-03-25 Dirk Eddelbuettel <edd@debian.org>

* LICENSE: Added
* .Rbuildignore: Do not include LICENSE in package

2017-03-17 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION: Release 0.12.10
Expand Down
4 changes: 2 additions & 2 deletions inst/unitTests/testRcppClass/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: testRcppClass
Type: Package
Title: Some examples using Rcpp classes and loadModule()
Title: Some Examples using Rcpp Classes and loadModule()
Version: 0.1
Date: 2012-04-06
Author: John Chambers
Expand All @@ -14,4 +14,4 @@ Depends: R (>= 2.15.0)
Imports: Rcpp (>= 0.8.5), methods
LinkingTo: Rcpp
Packaged: 2012-04-14 18:42:28 UTC; jmc

NeedsCompilation: yes
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppClass/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
useDynLib(testRcppClass)
useDynLib(testRcppClass, .registration=TRUE)
import(Rcpp,methods)

export(genWorld, stdNumeric, rcpp_hello_world,
Expand Down
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppClass/R/rcpp_hello_world.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

rcpp_hello_world <- function(){
.Call("rcpp_hello_world", PACKAGE = "testRcppClass")
.Call("rcpp_hello_world_cpp", PACKAGE = "testRcppClass")
}

27 changes: 27 additions & 0 deletions inst/unitTests/testRcppClass/src/init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>

/* FIXME:
Check these declarations against the C/Fortran source code.
*/

/* .Call calls */
extern SEXP rcpp_hello_world_cpp();
extern SEXP _rcpp_module_boot_NumEx();
extern SEXP _rcpp_module_boot_RcppClassModule();
extern SEXP _rcpp_module_boot_stdVector();

static const R_CallMethodDef CallEntries[] = {
{"rcpp_hello_world_cpp", (DL_FUNC) &rcpp_hello_world_cpp, 0},
{"_rcpp_module_boot_NumEx", (DL_FUNC) &_rcpp_module_boot_NumEx, 0},
{"_rcpp_module_boot_RcppClassModule", (DL_FUNC) &_rcpp_module_boot_RcppClassModule, 0},
{"_rcpp_module_boot_stdVector", (DL_FUNC) &_rcpp_module_boot_stdVector, 0},
{NULL, NULL, 0}
};

void R_init_testRcppModule(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppClass/src/rcpp_hello_world.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "rcpp_hello_world.h"

SEXP rcpp_hello_world(){
SEXP rcpp_hello_world_cpp(){
using namespace Rcpp ;

CharacterVector x = CharacterVector::create( "foo", "bar" ) ;
Expand Down
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppClass/src/rcpp_hello_world.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include <Rcpp.h>

RcppExport SEXP rcpp_hello_world() ;
RcppExport SEXP rcpp_hello_world_cpp() ;

#endif
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppModule/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: testRcppModule
Type: Package
Title: Some test examples using Rcpp with the Module feature
Title: Some Test Examples using Rcpp with the Module Feature
Version: 0.1
Date: 2010-09-06
Author: John Chambers
Expand Down
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppModule/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
useDynLib(testRcppModule)
useDynLib(testRcppModule, .registration=TRUE)
exportPattern("^[[:alpha:]]+")
import(Rcpp,methods)

2 changes: 1 addition & 1 deletion inst/unitTests/testRcppModule/R/rcpp_hello_world.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

rcpp_hello_world <- function(){
.Call( "rcpp_hello_world", PACKAGE = "testRcppModule" )
.Call( "rcpp_hello_world_cpp", PACKAGE = "testRcppModule" )
}

8 changes: 4 additions & 4 deletions inst/unitTests/testRcppModule/man/Rcpp_modules_examples.Rd
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
\name{Rcpp Modules Examples}
\alias{Num}
\alias{World}
\alias{RcppModuleNum}
\alias{RcppModuleWorld}
\alias{bar}
\alias{bla}
\alias{bla1}
\alias{bla2}
\alias{foo}
\alias{vec}
\alias{hello}
\alias{Rcpp_Num-class}
\alias{Rcpp_World-class}
\alias{Rcpp_RcppModuleNum-class}
\alias{Rcpp_RcppModuleWorld-class}
\alias{Rcpp_vec-class}
\alias{C++Object-class}
\title{
Expand Down
1 change: 1 addition & 0 deletions inst/unitTests/testRcppModule/man/rcpp_hello_world.Rd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
\name{rcpp_hello_world}
\alias{rcpp_hello_world}
\alias{rcpp_hello_world_cpp}
\docType{package}
\title{
Simple function using Rcpp
Expand Down
27 changes: 27 additions & 0 deletions inst/unitTests/testRcppModule/src/init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>

/* FIXME:
Check these declarations against the C/Fortran source code.
*/

/* .Call calls */
extern SEXP rcpp_hello_world_cpp();
extern SEXP _rcpp_module_boot_RcppModuleNumEx();
extern SEXP _rcpp_module_boot_RcppModuleWorld();
extern SEXP _rcpp_module_boot_stdVector();

static const R_CallMethodDef CallEntries[] = {
{"rcpp_hello_world_cpp", (DL_FUNC) &rcpp_hello_world_cpp, 0},
{"_rcpp_module_boot_RcppModuleNumEx", (DL_FUNC) &_rcpp_module_boot_RcppModuleNumEx, 0},
{"_rcpp_module_boot_RcppModuleWorld", (DL_FUNC) &_rcpp_module_boot_RcppModuleWorld, 0},
{"_rcpp_module_boot_stdVector", (DL_FUNC) &_rcpp_module_boot_stdVector, 0},
{NULL, NULL, 0}
};

void R_init_testRcppModule(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppModule/src/rcpp_hello_world.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "rcpp_hello_world.h"

SEXP rcpp_hello_world(){
SEXP rcpp_hello_world_cpp(){
using namespace Rcpp ;

CharacterVector x = CharacterVector::create( "foo", "bar" ) ;
Expand Down
2 changes: 1 addition & 1 deletion inst/unitTests/testRcppModule/src/rcpp_hello_world.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include <Rcpp.h>

RcppExport SEXP rcpp_hello_world() ;
RcppExport SEXP rcpp_hello_world_cpp() ;

#endif
5 changes: 1 addition & 4 deletions inst/unitTests/testRcppModule/tests/modules.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ stopifnot(all.equal(bar(2), 4))
stopifnot(all.equal(foo(2,3), 6))

## properties (at one stage this seqfaulted, so beware)
nn <- new(Num)
nn <- new(RcppModuleNum)
nn$x <- pi
stopifnot(all.equal(nn$x, pi))