[rkward-cvs] rkward/rkward/rbackend rembedinternal.cpp,1.38,1.39

Thomas Friedrichsmeier tfry at users.sourceforge.net
Tue Apr 18 01:14:42 UTC 2006


Update of /cvsroot/rkward/rkward/rkward/rbackend
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11699

Modified Files:
	rembedinternal.cpp 
Log Message:
Final (\?) fix for R 2.3.0. Requires R svn revision r37821 or later (or R < 2.2.9)

Index: rembedinternal.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rembedinternal.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** rembedinternal.cpp	17 Apr 2006 12:10:35 -0000	1.38
--- rembedinternal.cpp	18 Apr 2006 01:14:40 -0000	1.39
***************
*** 31,34 ****
--- 31,35 ----
  #include "Rinterface.h"
  #include "Rdevices.h"
+ #include "Rversion.h"
  #include "R_ext/Parse.h"
  
***************
*** 42,45 ****
--- 43,50 ----
  #include <math.h>
  
+ #if (R_VERSION > R_Version(2, 2, 9))
+ #define R_2_3
+ #endif
+ 
  // some functions we need that are not declared
  extern int Rf_initEmbeddedR(int argc, char **argv);
***************
*** 47,50 ****
--- 52,60 ----
  extern void Rf_PrintWarnings (void);
  extern int R_interrupts_pending;
+ #ifdef R_2_3
+ extern int Rf_initialize_R(int ac, char **av);
+ extern void setup_Rmainloop(void); /* in main.c */
+ extern unsigned long R_CStackLimit;
+ #endif
  extern Rboolean R_Visible;
  }
***************
*** 341,361 ****
  
  bool REmbedInternal::startR (int argc, char** argv) {
! 	// TODO: hopefully we don't need the HACK portions below. If R 2.3.0 goes unfixed, however, this should at least work in most cases (if no hard ulimit -s is set)
! 
! 	int teststack;
! 	printf ("startR %lx\n", &teststack);
! 	// HACK to disable Rs method of stack checking
! 	struct rlimit rlimhack;
! 	rlimhack.rlim_cur = rlimhack.rlim_max = (unsigned long)-1;
! 	struct rlimit rlimsave;
! 	getrlimit (RLIMIT_STACK, &rlimsave);
! 	setrlimit (RLIMIT_STACK, &rlimhack);
! 
! 	bool ok = (Rf_initEmbeddedR (argc, argv) >= 0);
! 
! 	// HACK part 2: now reinstantiate standard stack checking
! 	setrlimit (RLIMIT_STACK, &rlimsave);
! 
! 	return ok;
  }
  
--- 351,362 ----
  
  bool REmbedInternal::startR (int argc, char** argv) {
! #ifdef R_2_3
! 	Rf_initialize_R (argc, argv);
! 	R_CStackLimit = (unsigned long) -1;
! 	setup_Rmainloop ();
! 	return true;
! #else
! 	return (Rf_initEmbeddedR (argc, argv) >= 0);
! #endif
  }
  





More information about the rkward-tracker mailing list