Skip to content

Commit 67e83be

Browse files
authored
Update kit.h
1 parent d9903a8 commit 67e83be

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/kit.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,35 @@
1515
#include <R.h>
1616
#include <R_ext/Rdynload.h>
1717
#include <Rversion.h>
18+
1819
#if !defined(R_VERSION) || R_VERSION < R_Version(3, 5, 0)
1920
#define USE_RINTERNALS
2021
#define DATAPTR_RO(x) ((const void *)DATAPTR(x))
2122
#endif
23+
24+
#if R_VERSION < R_Version(4, 5, 0)
25+
# define isDataFrame(x) Rf_isFrame(x)
26+
# define R_ClosureFormals(x) FORMALS(x)
27+
# define R_ClosureEnv(x) CLOENV(x)
28+
# define R_ParentEnv(x) ENCLOS(x)
29+
30+
SEXP R_mkClosure(SEXP formals, SEXP body, SEXP env)
31+
{
32+
SEXP fun = Rf_allocSExp(CLOSXP);
33+
SET_FORMALS(fun, formals);
34+
SET_BODY(fun, body);
35+
SET_CLOENV(fun, env);
36+
return fun;
37+
}
38+
39+
void CLEAR_ATTRIB(SEXP x)
40+
{
41+
SET_ATTRIB(x, R_NilValue);
42+
SET_OBJECT(x, 0);
43+
UNSET_S4_OBJECT(x);
44+
}
45+
#endif
46+
2247
#include <Rinternals.h>
2348
#include <stdlib.h>
2449
#include <stdint.h>

0 commit comments

Comments
 (0)