Skip to content

Commit

Permalink
Include call to R_registerRoutines. CRAN NOTE not solved yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
vwmaus committed Mar 20, 2017
1 parent 5bbb19d commit 208f3c8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ importFrom(stats,window)
importFrom(stats,xtabs)
importFrom(xtable,print.xtable)
importFrom(xtable,xtable)
useDynLib(dtwSat, .registration = TRUE)
useDynLib(dtwSat,bestmatches)
useDynLib(dtwSat,computecost)
useDynLib(dtwSat,g)
Expand Down
2 changes: 1 addition & 1 deletion R/twdtw.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ initAlignments = function(...){
#' @useDynLib dtwSat g
.g = function(phi, step.matrix){

if(!is.loaded("computecost", PACKAGE = "dtwSat", type = "Fortran"))
if(!is.loaded("g", PACKAGE = "dtwSat", type = "Fortran"))
stop("Fortran lib is not loaded")

n = nrow(phi)
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#' @importFrom lubridate month month<- day day<- year year<-
#' @importFrom caret createDataPartition
#' @importFrom xtable xtable print.xtable
#' @useDynLib dtwSat, .registration = TRUE
# @useDynLib dtwSat, .registration = TRUE
#'
NULL

Expand Down
26 changes: 26 additions & 0 deletions src/dtwSat-init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// RegisteringDynamic Symbols

#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
#include <R_ext/RS.h>
#include "f.h"

static R_FortranMethodDef fortranMethods[] = {
{"bestmatches", (DL_FUNC) &F77_SUB(bestmatches), 11},
{"computecost", (DL_FUNC) &F77_SUB(computecost), 7},
{"g", (DL_FUNC) &F77_SUB(g), 4},
{"tracepath", (DL_FUNC) &F77_SUB(tracepath), 11},
{NULL, NULL, 0}
};

void
#ifdef HAVE_VISIBILITY_ATTRIBUTE
__attribute__ ((visibility ("default")))
#endif
R_init_dtwSat(DllInfo *dll) {
R_registerRoutines(dll, NULL, NULL, fortranMethods, NULL);
R_useDynamicSymbols(dll, FALSE);
}


13 changes: 13 additions & 0 deletions src/f.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

void F77_SUB(computecost)
(double *CM, int *DM, int *VM, int *SM, int *N, int *M, int *NS);

void F77_SUB(bestmatches)
(int *XM, double *AM, double *DM, int *DP, int *X, int *IM, int *A, int *K, int *P, int *L, double *OV);

void F77_SUB(g)
(double *TM, int *N, int *M, double *PC);

void F77_SUB(tracepath)
(double *DM, double *SM, double *JMIN, double *IND1, double *IND2, double *POS, int *N, int *M, int *NS, int *NJ, int *AL);

0 comments on commit 208f3c8

Please sign in to comment.