Skip to content
Snippets Groups Projects
Commit b5be4b6c authored by Mick Jordan's avatar Mick Jordan
Browse files

add a (fake) value for R_GlobalContext

parent d5afbeab
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment