Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Fix Makefile for include directory names with embedded spaces

- Eliminate warnings that started with R-2.6.0 related to lack of
  const declarations
- Add --no-restore to startup options
- Fix old bug related to Rversion.h appearing after user of R_VERSION
  in precompiler tests. Led to Rembedded.h not getting included
- Added explicit define for KillAllDevices as it has been removed
  from Rdevices.h as of R-2.7.0
  • Loading branch information...
commit 192fbe0246ef2366f07c65c5a76914266c652306 1 parent e4b70f2
jconway authored
View
2  Makefile
@@ -65,7 +65,7 @@ endif
# to work without, we have to skip it.
ifneq (,$(findstring yes, $(shared_libr)$(allow_nonpic_in_shlib)))
-override CPPFLAGS := -I$(srcdir) -I$(r_includespec) $(CPPFLAGS)
+override CPPFLAGS := -I"$(srcdir)" -I"$(r_includespec)" $(CPPFLAGS)
override CPPFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\" -DDLSUFFIX=\"$(DLSUFFIX)\"
override CPPFLAGS += -DR_HOME_DEFAULT=\"$(rhomedef)\"
View
4 expected/plr.out
@@ -96,8 +96,8 @@ select reval('a <- sd(c(1,2,3)); b <- mean(c(1,2,3)); a + b');
create or replace function "commandArgs"() returns text[] as '' language 'plr';
select "commandArgs"();
commandArgs
----------------------------
- {PL/R,--silent,--no-save}
+----------------------------------------
+ {PL/R,--silent,--no-save,--no-restore}
(1 row)
create or replace function vec(float) returns text as 'c(arg1)' language 'plr';
View
16 pg_conversion.c
@@ -722,7 +722,7 @@ get_scalar_datum(SEXP rval, FmgrInfo result_in_func, Oid result_elem, bool *isnu
{
Datum dvalue;
SEXP obj;
- char *value;
+ const char *value;
/*
* if the element type is zero, we don't have an array,
@@ -792,7 +792,7 @@ get_frame_array_datum(SEXP rval, plr_function *function, int col, bool *isnull)
{
Datum dvalue;
SEXP obj;
- char *value;
+ const char *value;
Oid result_elem;
FmgrInfo in_func;
int typlen;
@@ -903,7 +903,7 @@ get_md_array_datum(SEXP rval, int ndims, plr_function *function, int col, bool *
Datum dvalue;
SEXP obj;
SEXP rdims;
- char *value;
+ const char *value;
Oid result_elem;
FmgrInfo in_func;
int typlen;
@@ -1020,7 +1020,7 @@ get_generic_array_datum(SEXP rval, plr_function *function, int col, bool *isnull
int objlen = length(rval);
Datum dvalue;
SEXP obj;
- char *value;
+ const char *value;
Oid result_elem;
FmgrInfo in_func;
int typlen;
@@ -1314,9 +1314,9 @@ get_matrix_tuplestore(SEXP rval,
for (j = 0; j < nc; j++)
{
if (STRING_ELT(obj, (j * nr) + i) != NA_STRING)
- values[j] = CHAR(STRING_ELT(obj, (j * nr) + i));
+ values[j] = (char *) CHAR(STRING_ELT(obj, (j * nr) + i));
else
- values[j] = NULL;
+ values[j] = (char *) NULL;
}
/* construct the tuple */
@@ -1380,9 +1380,9 @@ get_generic_tuplestore(SEXP rval,
for(i = 0; i < nr; i++)
{
if (STRING_ELT(obj, i) != NA_STRING)
- values[0] = CHAR(STRING_ELT(obj, i));
+ values[0] = (char *) CHAR(STRING_ELT(obj, i));
else
- values[0] = NULL;
+ values[0] = (char *) NULL;
/* construct the tuple */
tuple = BuildTupleFromCStrings(attinmeta, values);
View
8 pg_rsupport.c
@@ -73,7 +73,7 @@ throw_pg_notice(const char **msg)
SEXP
plr_quote_literal(SEXP rval)
{
- char *value;
+ const char *value;
text *value_text;
text *result_text;
SEXP result;
@@ -101,7 +101,7 @@ plr_quote_literal(SEXP rval)
SEXP
plr_quote_ident(SEXP rval)
{
- char *value;
+ const char *value;
text *value_text;
text *result_text;
SEXP result;
@@ -130,7 +130,7 @@ plr_SPI_exec(SEXP rsql)
{
int spi_rc = 0;
char buf[64];
- char *sql;
+ const char *sql;
int count = 0;
int ntuples;
SEXP result = NULL;
@@ -261,7 +261,7 @@ rpgsql_get_results(int ntuples, SPITupleTable *tuptable)
SEXP
plr_SPI_prepare(SEXP rsql, SEXP rargtypes)
{
- char *sql;
+ const char *sql;
int nargs;
int i;
Oid *typeids = NULL;
View
4 plr.c
@@ -305,7 +305,7 @@ plr_init(void)
{
char *r_home;
int rargc;
- char *rargv[] = {"PL/R", "--silent", "--no-save"};
+ char *rargv[] = {"PL/R", "--silent", "--no-save", "--no-restore"};
/* refuse to init more than once */
if (plr_pm_init_done)
@@ -361,6 +361,7 @@ plr_init(void)
/* arrange for automatic cleanup at proc_exit */
on_proc_exit(plr_cleanup, 0);
+#ifndef WIN32
/*
* Force non-interactive mode since R may not do so.
* See comment in Rembedded.c just after R_Interactive = TRUE:
@@ -368,6 +369,7 @@ plr_init(void)
* If Postgres still has the tty attached, R_Interactive remains TRUE
*/
R_Interactive = false;
+#endif
plr_pm_init_done = true;
}
View
28 plr.h
@@ -40,15 +40,30 @@
#include <sys/stat.h>
#include "R.h"
-/* R version is calculated as shown below */
+#include "Rversion.h"
+/*
+ * R version is calculated thus:
+ * Maj * 65536 + Minor * 256 + Build * 1
+ * So:
+ * version 1.8.0 results in:
+ * (1 * 65536) + (8 * 256) + (0 * 1) == 67584
+ * version 1.9.0 results in:
+ * (1 * 65536) + (9 * 256) + (0 * 1) == 67840
+ */
#if (R_VERSION >= 132096) /* R_VERSION >= 2.4.0 */
#include "Rembedded.h"
#endif
+#ifndef WIN32
#include "Rinterface.h"
+#endif
#include "Rinternals.h"
#include "Rdefines.h"
#include "Rdevices.h"
-#include "Rversion.h"
+
+/* starting in R-2.7.0 this defn was removed from Rdevices.h */
+#ifndef KillAllDevices
+#define KillAllDevices Rf_KillAllDevices
+#endif
/*
* The R headers define various symbols that are also defined by the
@@ -122,15 +137,6 @@ extern void pg_unprotect(int n, char *fn, int ln);
#define NEXT_STR_ELEMENT " %s"
-/*
- * R version is calculated thus:
- * Maj * 65536 + Minor * 256 + Build * 1
- * So:
- * version 1.8.0 results in:
- * (1 * 65536) + (8 * 256) + (0 * 1) == 67584
- * version 1.9.0 results in:
- * (1 * 65536) + (9 * 256) + (0 * 1) == 67840
- */
#if (R_VERSION < 67840) /* R_VERSION < 1.9.0 */
#define SET_COLUMN_NAMES \
do { \
Please sign in to comment.
Something went wrong with that request. Please try again.