[Dplr-commits] r1052 - in pkg/dplR: . R src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 15 14:27:01 CET 2017


Author: mvkorpel
Date: 2017-02-15 14:27:01 +0100 (Wed, 15 Feb 2017)
New Revision: 1052

Added:
   pkg/dplR/src/Makevars
   pkg/dplR/src/dplR-win.def
   pkg/dplR/src/init.c
   pkg/dplR/src/registered.h
Modified:
   pkg/dplR/ChangeLog
   pkg/dplR/DESCRIPTION
   pkg/dplR/NAMESPACE
   pkg/dplR/R/exactmean.R
   pkg/dplR/R/read.tucson.R
   pkg/dplR/src/exactmean.c
   pkg/dplR/src/gini.c
   pkg/dplR/src/rcompact.c
   pkg/dplR/src/readloop.c
   pkg/dplR/src/redfit.c
   pkg/dplR/src/sens.c
   pkg/dplR/src/tbrm.c
Log:
Registering native (C) routines and hiding entry points


Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/ChangeLog	2017-02-15 13:27:01 UTC (rev 1052)
@@ -1,5 +1,14 @@
 * CHANGES IN dplR VERSION 1.6.6
 
+Files: NAMESPACE, src/..., R/...
+----------------
+
+- Technical change: Native routines are registered.
+  <https://stat.ethz.ch/pipermail/r-devel/2017-February/073755.html>
+
+- Technical change: Visibility of native routines has been
+  limited, following 6.15 "Controlling visibility" in R-exts.
+
 File: sfrcs.R
 ----------------
 

Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/DESCRIPTION	2017-02-15 13:27:01 UTC (rev 1052)
@@ -3,7 +3,7 @@
 Type: Package
 Title: Dendrochronology Program Library in R
 Version: 1.6.6
-Date: 2017-02-10
+Date: 2017-02-15
 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph",
         "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko",
         "Korpela", role = c("aut", "trl")), person("Franco", "Biondi",

Modified: pkg/dplR/NAMESPACE
===================================================================
--- pkg/dplR/NAMESPACE	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/NAMESPACE	2017-02-15 13:27:01 UTC (rev 1052)
@@ -1,7 +1,4 @@
-useDynLib(dplR, dplR.gini=gini, dplR.makear1=makear1,
-          dplR.mean=exactmean, dplR.rcompact=rcompact,
-          dplR.seg50=seg50, dplR.sens1=sens1, dplR.sens2=sens2,
-          dplR.spectr=spectr, dplR.tbrm=tbrm, rwl.readloop=readloop)
+useDynLib(dplR, .registration = TRUE, .fixes = "dplR.")
 
 import(graphics, stats)
 

Modified: pkg/dplR/R/exactmean.R
===================================================================
--- pkg/dplR/R/exactmean.R	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/R/exactmean.R	2017-02-15 13:27:01 UTC (rev 1052)
@@ -1,5 +1,5 @@
 `exactmean` <- function(x)
 {
     ## Drops NA and NaN values!
-    .Call(dplR.mean, as.double(x[!is.na(x)]))
+    .Call(dplR.exactmean, as.double(x[!is.na(x)]))
 }

Modified: pkg/dplR/R/read.tucson.R
===================================================================
--- pkg/dplR/R/read.tucson.R	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/R/read.tucson.R	2017-02-15 13:27:01 UTC (rev 1052)
@@ -327,7 +327,7 @@
     }
     extra.col <- dat[[13]]
 
-    res <- .Call(rwl.readloop, series.index, decade.yr, x)
+    res <- .Call(dplR.readloop, series.index, decade.yr, x)
     rw.mat <- res[[1]]
     min.year <- res[[2]]
     prec.rproc <- res[[3]]

Added: pkg/dplR/src/Makevars
===================================================================
--- pkg/dplR/src/Makevars	                        (rev 0)
+++ pkg/dplR/src/Makevars	2017-02-15 13:27:01 UTC (rev 1052)
@@ -0,0 +1 @@
+PKG_CFLAGS = $(C_VISIBILITY)

Added: pkg/dplR/src/dplR-win.def
===================================================================
--- pkg/dplR/src/dplR-win.def	                        (rev 0)
+++ pkg/dplR/src/dplR-win.def	2017-02-15 13:27:01 UTC (rev 1052)
@@ -0,0 +1,3 @@
+LIBRARY dplR.dll
+EXPORTS
+ R_init_dplR

Modified: pkg/dplR/src/exactmean.c
===================================================================
--- pkg/dplR/src/exactmean.c	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/src/exactmean.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -1,6 +1,7 @@
 #include <stddef.h>
 #include "dplR.h"
 #include "exactsum.h"
+#include "registered.h"
 
 SEXP exactmean(SEXP x){
     SEXP ans;

Modified: pkg/dplR/src/gini.c
===================================================================
--- pkg/dplR/src/gini.c	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/src/gini.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -2,6 +2,7 @@
 #include <limits.h>
 #include "dplR.h"
 #include "exactsum.h"
+#include "registered.h"
 
 /* Written by Mikko Korpela */
 SEXP gini(SEXP x){

Added: pkg/dplR/src/init.c
===================================================================
--- pkg/dplR/src/init.c	                        (rev 0)
+++ pkg/dplR/src/init.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+#include <R_ext/Rdynload.h>
+#include <R_ext/Visibility.h>
+
+#include "registered.h"
+
+#define CALLDEF(name, n) {#name, (DL_FUNC) &name, n}
+
+const static R_CallMethodDef R_CallDef[] = {
+    CALLDEF(exactmean,       1),
+    CALLDEF(gini,            1),
+    CALLDEF(makear1,         3),
+    CALLDEF(rcompact,        1),
+    CALLDEF(readloop,        3),
+    CALLDEF(seg50,           4),
+    CALLDEF(sens1,           1),
+    CALLDEF(sens2,           1),
+    CALLDEF(spectr,         14),
+    CALLDEF(tbrm,            2),
+    {NULL, NULL, 0}
+};
+
+void attribute_visible R_init_dplR(DllInfo *dll) {
+    R_registerRoutines(dll, NULL, R_CallDef, NULL, NULL);
+    R_useDynamicSymbols(dll, FALSE);
+    R_forceSymbols(dll, TRUE);
+}


Property changes on: pkg/dplR/src/init.c
___________________________________________________________________
Added: svn:eol-style
   + LF

Modified: pkg/dplR/src/rcompact.c
===================================================================
--- pkg/dplR/src/rcompact.c	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/src/rcompact.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <limits.h>
+#include "registered.h"
 
 #define CONTENT_LENGTH 80
 #define LINE_LENGTH 83 /* 80 + 2 (newline characters) + 1 (null)*/

Modified: pkg/dplR/src/readloop.c
===================================================================
--- pkg/dplR/src/readloop.c	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/src/readloop.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -1,6 +1,7 @@
 #include "dplR.h"
 #include <Rmath.h>
 #include <limits.h>
+#include "registered.h"
 
 /* A function to speed up the heaviest part of read.tucson.R */
 /* Written by Mikko Korpela */

Modified: pkg/dplR/src/redfit.c
===================================================================
--- pkg/dplR/src/redfit.c	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/src/redfit.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -22,18 +22,14 @@
 #include <Rmath.h>
 #include <complex.h>
 #include <string.h>
+#include "registered.h"
 
-SEXP seg50(SEXP k, SEXP nseg, SEXP segskip, SEXP np);
 void rmtrend(SEXP x, SEXP y, SEXP lengthfun, SEXP lmfit);
-SEXP spectr(SEXP t, SEXP x, SEXP np, SEXP ww, SEXP tsin, SEXP tcos, SEXP wtau,
-	    SEXP nseg, SEXP nfreq, SEXP avgdt, SEXP freq, SEXP n50,
-	    SEXP segskip, SEXP lmfit);
 void ftfix(const double *xx, const double *tsamp, const size_t nxx,
 	   const double *freq, const size_t nfreq, const double si,
 	   const size_t lfreq, const double tzero, const double *tcos,
-	   const double *tsin, const double *wtau, const dplr_ldouble sumbysqrt,
-	   double *ftrx, double *ftix);
-SEXP makear1(SEXP t, SEXP np, SEXP tau);
+	   const double *tsin, const double *wtau,
+	   const dplr_ldouble sumbysqrt, double *ftrx, double *ftix);
 
 /* dplR: Find the start of a segment. */
 /* Formula from the original Fortran version:
@@ -288,8 +284,8 @@
 void ftfix(const double *xx, const double *tsamp, const size_t nxx,
 	   const double *freq, const size_t nfreq, const double si,
 	   const size_t lfreq, const double tzero, const double *tcos,
-	   const double *tsin, const double *wtau, const dplr_ldouble sumbysqrt,
-	   double *ftrx, double *ftix) {
+	   const double *tsin, const double *wtau,
+	   const dplr_ldouble sumbysqrt, double *ftrx, double *ftix) {
     const double_t tol1 = 1.0e-4;
     const double tol2 = 1.0e-8;
     const double_t const1 = M_SQRT1_2;

Added: pkg/dplR/src/registered.h
===================================================================
--- pkg/dplR/src/registered.h	                        (rev 0)
+++ pkg/dplR/src/registered.h	2017-02-15 13:27:01 UTC (rev 1052)
@@ -0,0 +1,14 @@
+#include <Rinternals.h>
+
+SEXP exactmean(SEXP x);
+SEXP gini(SEXP x);
+SEXP makear1(SEXP t, SEXP np, SEXP tau);
+SEXP rcompact(SEXP filename);
+SEXP readloop(SEXP series_index, SEXP decade, SEXP x);
+SEXP seg50(SEXP k, SEXP nseg, SEXP segskip, SEXP np);
+SEXP sens1(SEXP x);
+SEXP sens2(SEXP x);
+SEXP spectr(SEXP t, SEXP x, SEXP np, SEXP ww, SEXP tsin, SEXP tcos, SEXP wtau,
+	    SEXP nseg, SEXP nfreq, SEXP avgdt, SEXP freq, SEXP n50,
+	    SEXP segskip, SEXP lmfit);
+SEXP tbrm(SEXP x, SEXP C);


Property changes on: pkg/dplR/src/registered.h
___________________________________________________________________
Added: svn:eol-style
   + LF

Modified: pkg/dplR/src/sens.c
===================================================================
--- pkg/dplR/src/sens.c	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/src/sens.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -1,6 +1,7 @@
 #include <stddef.h>
 #include "dplR.h"
 #include "exactsum.h"
+#include "registered.h"
 
 /* Written by Mikko Korpela */
 SEXP sens2(SEXP x){

Modified: pkg/dplR/src/tbrm.c
===================================================================
--- pkg/dplR/src/tbrm.c	2017-02-10 12:52:34 UTC (rev 1051)
+++ pkg/dplR/src/tbrm.c	2017-02-15 13:27:01 UTC (rev 1052)
@@ -2,6 +2,7 @@
 #include <stddef.h>
 #include "dplR.h"
 #include "exactsum.h"
+#include "registered.h"
 
 /* Tukey's Biweight Robust Mean (tbrm).
    There must be no NAs in 'x'.



More information about the Dplr-commits mailing list