[rkward-cvs] rkward/rkward/rbackend rembedinternal.cpp,1.23,1.24 rembedinternal.h,1.13,1.14 rinterface.cpp,1.34,1.35

Thomas Friedrichsmeier tfry at users.sourceforge.net
Tue Oct 18 15:53:28 UTC 2005


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

Modified Files:
	rembedinternal.cpp rembedinternal.h rinterface.cpp 
Log Message:
Make internal going ons for interrupting commands slightly more sane.

Index: rembedinternal.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rembedinternal.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** rembedinternal.h	23 Sep 2005 14:29:47 -0000	1.13
--- rembedinternal.h	18 Oct 2005 15:53:26 -0000	1.14
***************
*** 137,140 ****
--- 137,143 ----
  	static REmbedInternal *this_pointer;
  
+ /** interrupt processing of the current command. This is much like the user pressing Ctrl+C in a terminal with R. */
+ 	void interruptProcessing (bool interrupt);
+ 
  /** Flags used to classify output. */
  //	static bool output_is_warning;

Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** rinterface.cpp	14 Oct 2005 15:57:43 -0000	1.34
--- rinterface.cpp	18 Oct 2005 15:53:26 -0000	1.35
***************
*** 50,58 ****
  #include <signal.h>
  
- extern "C" {
- 	/** this is the var in R-space that stores an interrupt */
- 	extern int R_interrupts_pending;
- }
- 
  //static
  QMutex RInterface::mutex;
--- 50,53 ----
***************
*** 112,116 ****
  	if (r_thread->running ()) {
  		MUTEX_LOCK
! 		R_interrupts_pending = 1;
  		MUTEX_UNLOCK
  		r_thread->wait (10000);
--- 107,111 ----
  	if (r_thread->running ()) {
  		MUTEX_LOCK
! 		r_thread->interruptProcessing (true);
  		MUTEX_UNLOCK
  		r_thread->wait (10000);
***************
*** 137,141 ****
  				RK_ASSERT (command == running_command_canceled);
  				running_command_canceled = 0;
! 				R_interrupts_pending = 0;
  				r_thread->unlock (RThread::Cancel);
  			}
--- 132,136 ----
  				RK_ASSERT (command == running_command_canceled);
  				running_command_canceled = 0;
! 				r_thread->interruptProcessing (false);
  				r_thread->unlock (RThread::Cancel);
  			}
***************
*** 210,215 ****
  			r_thread->lock (RThread::Cancel);
  			running_command_canceled = command;
! 			// this is the var in R-space that stores an interrupt
! 			R_interrupts_pending = 1;
  		}
  	} else {
--- 205,209 ----
  			r_thread->lock (RThread::Cancel);
  			running_command_canceled = command;
! 			r_thread->interruptProcessing (true);
  		}
  	} else {

Index: rembedinternal.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rembedinternal.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rembedinternal.cpp	12 Oct 2005 10:20:17 -0000	1.23
--- rembedinternal.cpp	18 Oct 2005 15:53:26 -0000	1.24
***************
*** 193,197 ****
  	ptr_R_ShowMessage = RShowMessage;			// when exactly does this ever get used?
  	ptr_R_ReadConsole = RReadConsole;
! 	ptr_R_WriteConsole = RWriteConsole;				// when exactly does this ever get used? Apparently it does not get called if a sink is in place, but otherwise it is! Probably we can get rid of our sink, then, and provide "real-time" output! More '!'s!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  	ptr_R_ResetConsole = RResetConsole;
  	ptr_R_FlushConsole = RFlushConsole;
--- 193,197 ----
  	ptr_R_ShowMessage = RShowMessage;			// when exactly does this ever get used?
  	ptr_R_ReadConsole = RReadConsole;
! 	ptr_R_WriteConsole = RWriteConsole;
  	ptr_R_ResetConsole = RResetConsole;
  	ptr_R_FlushConsole = RFlushConsole;
***************
*** 521,523 ****
--- 521,532 ----
  }
  
+ void REmbedInternal::interruptProcessing (bool interrupt) {
+ 	extern int R_interrupts_pending;
+ 	if (interrupt) {
+ 		R_interrupts_pending = 1;
+ 	} else {
+ 		R_interrupts_pending = 0;
+ 	}
+ }
+ 
  } // extern "C"





More information about the rkward-tracker mailing list