Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
b5be4b6c
Commit
b5be4b6c
authored
8 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
add a (fake) value for R_GlobalContext
parent
d5afbeab
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.native/fficall/src/jni/Rembedded.c
+41
-0
41 additions, 0 deletions
com.oracle.truffle.r.native/fficall/src/jni/Rembedded.c
with
41 additions
and
0 deletions
com.oracle.truffle.r.native/fficall/src/jni/Rembedded.c
+
41
−
0
View file @
b5be4b6c
...
...
@@ -67,6 +67,38 @@ static char **update_environ_with_java_home(void);
static
void
print_environ
(
char
**
env
);
static
char
*
get_classpath
(
char
*
r_home
);
# define JMP_BUF sigjmp_buf
/* Evaluation Context Structure */
typedef
struct
RCNTXT
{
struct
RCNTXT
*
nextcontext
;
/* The next context up the chain */
int
callflag
;
/* The context "type" */
JMP_BUF
cjmpbuf
;
/* C stack and register information */
int
cstacktop
;
/* Top of the pointer protection stack */
int
evaldepth
;
/* evaluation depth at inception */
SEXP
promargs
;
/* Promises supplied to closure */
SEXP
callfun
;
/* The closure called */
SEXP
sysparent
;
/* environment the closure was called from */
SEXP
call
;
/* The call that effected this context*/
SEXP
cloenv
;
/* The environment */
SEXP
conexit
;
/* Interpreted "on.exit" code */
void
(
*
cend
)(
void
*
);
/* C "on.exit" thunk */
void
*
cenddata
;
/* data for C "on.exit" thunk */
void
*
vmax
;
/* top of R_alloc stack */
int
intsusp
;
/* interrupts are suspended */
SEXP
handlerstack
;
/* condition handler stack */
SEXP
restartstack
;
/* stack of available restarts */
void
*
prstack
;
/* stack of pending promises */
void
*
nodestack
;
#ifdef BC_INT_STACK
IStackval
*
intstack
;
#endif
SEXP
srcref
;
/* The source line in effect */
int
browserfinish
;
/* should browser finish this context without stopping */
SEXP
returnValue
;
/* only set during on.exit calls */
}
RCNTXT
,
*
context
;
int
Rf_initialize_R
(
int
argc
,
char
*
argv
[])
{
if
(
initialized
)
{
fprintf
(
stderr
,
"%s"
,
"R is already initialized
\n
"
);
...
...
@@ -89,6 +121,14 @@ int Rf_initialize_R(int argc, char *argv[]) {
if
(
stat
(
jvmdir
,
&
statbuf
)
==
0
)
{
java_home
=
jvmdir
;
}
}
else
if
(
strcmp
(
utsname
.
sysname
,
"Darwin"
)
==
0
)
{
char
*
jvmdir
=
"/Library/Java/JavaVirtualMachines/jdk.latest"
;
struct
stat
statbuf
;
if
(
stat
(
jvmdir
,
&
statbuf
)
==
0
)
{
java_home
=
(
char
*
)
malloc
(
strlen
(
jvmdir
)
+
32
);
strcpy
(
java_home
,
jvmdir
);
strcat
(
java_home
,
"/Contents/Home"
);
}
}
if
(
java_home
==
NULL
)
{
printf
(
"Rf_initialize_R: can't find a JAVA_HOME
\n
"
);
...
...
@@ -159,6 +199,7 @@ int Rf_initialize_R(int argc, char *argv[]) {
(
*
jniEnv
)
->
SetObjectArrayElement
(
jniEnv
,
argsArray
,
i
,
arg
);
}
R_GlobalContext
=
malloc
(
sizeof
(
struct
RCNTXT
));
engine
=
checkRef
(
jniEnv
,
(
*
jniEnv
)
->
CallStaticObjectMethod
(
jniEnv
,
rembeddedClass
,
initializeMethod
,
argsArray
));
initialized
++
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment