int main (int argc, char **argv) { structRstart rp; Rstart Rp = &rp; char Rversion[25], *RHome; sprintf(Rversion, "%s.%s", R_MAJOR, R_MINOR); if(strcmp(getDLLVersion(), Rversion) != 0) { fprintf(stderr, "Error: R.DLL version does not match\n"); exit(1); } R_setStartTime(); R_DefParams(Rp); if((RHome = get_R_HOME()) == NULL) { fprintf(stderr, "R_HOME must be set in the environment or Registry\n"); exit(1); } Rp->rhome = RHome; Rp->home = getRUser(); Rp->CharacterMode = LinkDLL; Rp->ReadConsole = myReadConsole; Rp->WriteConsole = myWriteConsole; Rp->CallBack = myCallBack; Rp->ShowMessage = askok; Rp->YesNoCancel = askyesnocancel; Rp->Busy = myBusy; Rp->R_Quiet = TRUE; Rp->R_Interactive = FALSE; Rp->RestoreAction = SA_RESTORE; Rp->SaveAction = SA_NOSAVE; R_SetParams(Rp); /* so R_ShowMessage is set */ R_SizeFromEnv(Rp); R_SetParams(Rp); R_set_command_line_arguments(argc, argv); FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); signal(SIGBREAK, my_onintr); setup_term_ui(); /* initialize graphapp, eventloop, read Rconsole */ setup_Rmainloop(); #ifdef SIMPLE_CASE run_Rmainloop(); end_Rmainloop(); #else R_ReplDLLinit(); while(R_ReplDLLdo1() > 0) { /* add user actions here if desired */ } /* only get here on EOF (not q()) */ R_CleanUp(SA_DEFAULT, 0, 1); #endif end_Rmainloop(); return 0; }
int main (int argc, char **argv) { structRstart rp; Rstart Rp = &rp; char Rversion[25], *RHome; snprintf(Rversion, 25, "%s.%s", R_MAJOR, R_MINOR); if(strcmp(getDLLVersion(), Rversion) != 0) { fprintf(stderr, "Error: R.DLL version does not match\n"); exit(1); } R_setStartTime(); R_DefParams(Rp); if((RHome = get_R_HOME()) == NULL) { fprintf(stderr, "R_HOME must be set in the environment or Registry\n"); exit(1); } Rp->rhome = RHome; Rp->home = getRUser(); Rp->CharacterMode = LinkDLL; Rp->ReadConsole = myReadConsole; Rp->WriteConsole = NULL; /* for illustration purposes we use more flexible WriteConsoleEx */ Rp->WriteConsoleEx = myWriteConsoleEx; Rp->CallBack = myCallBack; Rp->ShowMessage = askok; Rp->YesNoCancel = askyesnocancel; Rp->Busy = myBusy; Rp->R_Quiet = TRUE; Rp->R_Interactive = FALSE; Rp->RestoreAction = SA_RESTORE; Rp->SaveAction = SA_NOSAVE; R_SetParams(Rp); R_set_command_line_arguments(argc, argv); FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); signal(SIGBREAK, my_onintr); GA_initapp(0, 0); readconsolecfg(); setup_Rmainloop(); #ifdef SIMPLE_CASE run_Rmainloop(); #else R_ReplDLLinit(); while(R_ReplDLLdo1() > 0) { /* add user actions here if desired */ } /* only get here on EOF (not q()) */ #endif Rf_endEmbeddedR(0); return 0; }
void RInside::repl(){ R_ReplDLLinit(); while( R_ReplDLLdo1() > 0 ) {} }