Skip to content

Commit 54bfb36

Browse files
committed
use decls from Rinterface.h and Rembedded.h when available
1 parent 6268a75 commit 54bfb36

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/jri/src/Rdecl.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,24 @@
22
#define __RDECL_H__
33

44
/* declarations from R internals or other include files */
5-
/* last update: R 2.4.0 */
5+
/* last update: R 4.6.0 */
66

7+
#include <Rversion.h>
8+
9+
#define R_INTERFACE_PTRS 1
10+
#define CSTACK_DEFNS 1
11+
#include <Rinterface.h> /* R_ReadConsole since 4.6.0 */
12+
13+
/* some have been added to R 4.6.0 */
14+
#if R_VERSION >= R_Version(4,6,0)
15+
#include <Rembedded.h> /* run_Rmainloop (since 4.6.0), Rf_initialize_R (since 2.4.0) */
16+
#else
717
void run_Rmainloop(void); /* main/main.c */
818
int R_ReadConsole(char*, unsigned char*, int, int); /* include/Defn.h */
19+
int Rf_initialize_R(int ac, char **av); /* include/Rembedded.h - exists since 2.4.0 */
20+
#endif /* R < 4.6.0 */
21+
22+
/* this one is still left over */
923
void Rf_checkArity(SEXP, SEXP); /* include/Defn.h */
10-
int Rf_initialize_R(int ac, char **av); /* include/Rembedded.h */
1124

12-
#endif
25+
#endif /* __RDECL_H__ */

src/jri/src/Rinit.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
#include <Rinternals.h>
33
#include "Rinit.h"
44
#include "Rcallbacks.h"
5-
#include "Rdecl.h"
5+
#include "Rdecl.h" /* includes Rinterface.h */
66

77
/*-------------------------------------------------------------------*
88
* UNIX initialization (includes Darwin/Mac OS X) *
99
*-------------------------------------------------------------------*/
1010

1111
#ifndef Win32
1212

13-
#define R_INTERFACE_PTRS 1
14-
#define CSTACK_DEFNS 1
15-
#include <Rinterface.h>
1613
/* and SaveAction is not officially exported */
1714
extern SA_TYPE SaveAction;
1815

0 commit comments

Comments
 (0)