[rkward-cvs] rkward/rkward/rbackend rembedinternal.cpp,1.17,1.18 rembedinternal.h,1.10,1.11 rinterface.cpp,1.24,1.25 rthread.cpp,1.15,1.16

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Sep 14 12:06:04 UTC 2005


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

Modified Files:
	rembedinternal.cpp rembedinternal.h rinterface.cpp rthread.cpp 
Log Message:
Implemented R_EditFile and R_ShowFile. Not pretty yet, but working. Some more code cleanups

Index: rembedinternal.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rembedinternal.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rembedinternal.h	12 Sep 2005 17:09:59 -0000	1.10
--- rembedinternal.h	14 Sep 2005 12:06:02 -0000	1.11
***************
*** 33,37 ****
  /** This enum specifies, what sort of callback this is */
  	enum RCallbackType { RSuicide, RShowMessage, RReadConsole, RWriteConsole, RResetConsole, RFlushConsole, RClearerrConsole,
! 											RBusy, RCleanUp, RShowFiles, RChooseFile, REditFile, REditFiles
  	} type;
  
--- 33,37 ----
  /** This enum specifies, what sort of callback this is */
  	enum RCallbackType { RSuicide, RShowMessage, RReadConsole, RWriteConsole, RResetConsole, RFlushConsole, RClearerrConsole,
! 											RBusy, RCleanUp, RShowFiles, RChooseFile, /*REditFile,*/ REditFiles
  	} type;
  

Index: rinterface.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rinterface.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** rinterface.cpp	12 Sep 2005 17:09:59 -0000	1.24
--- rinterface.cpp	14 Sep 2005 12:06:02 -0000	1.25
***************
*** 28,31 ****
--- 28,32 ----
  #include "../core/rkmodificationtracker.h"
  #include "../dialogs/rkloadlibsdialog.h"
+ #include "../agents/showedittextfileagent.h"
  
  #include "rkwindowcatcher.h"
***************
*** 296,299 ****
--- 297,304 ----
  		res = res.left (args->int_a - 2) + "\n";
  		qstrcpy (*(args->chars_b), res.latin1 ());
+ 	} else if ((type == RCallbackArgs::RShowFiles) || (type == RCallbackArgs::REditFiles)) {
+ 		ShowEditTextFileAgent::showEditFiles (args);
+ 		MUTEX_UNLOCK;
+ 		return;
  	}
  

Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** rthread.cpp	12 Sep 2005 17:09:59 -0000	1.15
--- rthread.cpp	14 Sep 2005 12:06:02 -0000	1.16
***************
*** 158,161 ****
--- 158,163 ----
  	RK_TRACE (RBACKEND);
  
+ 	args->done = false;
+ 
  	QCustomEvent *event = new QCustomEvent (R_CALLBACK_REQUEST_EVENT);
  	event->setData (args);

Index: rembedinternal.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rembedinternal.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rembedinternal.cpp	13 Sep 2005 16:08:34 -0000	1.17
--- rembedinternal.cpp	14 Sep 2005 12:06:02 -0000	1.18
***************
*** 93,98 ****
  }
  
! int RShowFiles (int nfile, char **file, char **headers, char *wtitle, Rboolean del, char *pager) {
! // TODO
  // default implementation seems to returns 1 on success, 0 on failure. see unix/std-sys.c
  	return 1;
--- 93,108 ----
  }
  
! int RShowFiles (int nfile, char **file, char **headers, char *wtitle, Rboolean del, char */*pager*/) {
! 	RCallbackArgs args;
! 	args.type = RCallbackArgs::RShowFiles;
! 	args.int_a = nfile;
! 	args.chars_a = file;
! 	args.chars_b = headers;		// what exactly are the "headers"?!?
! 	args.chars_c = &wtitle;
! 	args.int_b = del;
! 	// we ingnore the pager-parameter for now.
! 
! 	REmbedInternal::this_pointer->handleStandardCallback (&args);
! 
  // default implementation seems to returns 1 on success, 0 on failure. see unix/std-sys.c
  	return 1;
***************
*** 105,119 ****
  }
  
- int REditFile (char *buf) {
- // TODO
- // does not exist in standard R 2.1.0, so no idea what to return.
- 	return 0;
- }
- 
  int REditFiles (int nfile, char **file, char **title, char *editor) {
! //TODO
  // default impelementation seems to return 1 if nfile <= 0, else 1. No idea, what for. see unix/std-sys.c
  	return (nfile <= 0);
  }
  /// ############## R Standard callback overrides END ####################
  
--- 115,140 ----
  }
  
  int REditFiles (int nfile, char **file, char **title, char *editor) {
! 	RCallbackArgs args;
! 	args.type = RCallbackArgs::REditFiles;
! 	args.int_a = nfile;
! 	args.chars_a = file;
! 	args.chars_b = title;
! 	args.chars_c = &editor;
! 
! 	REmbedInternal::this_pointer->handleStandardCallback (&args);
! 
  // default impelementation seems to return 1 if nfile <= 0, else 1. No idea, what for. see unix/std-sys.c
  	return (nfile <= 0);
  }
+ 
+ int REditFile (char *buf) {
+ 	char *editor = "none";
+ 	char *title = "";
+ 
+ // does not exist in standard R 2.1.0, so no idea what to return.
+ 	return REditFiles (1, &buf, &title, editor);
+ }
+ 
  /// ############## R Standard callback overrides END ####################
  
***************
*** 128,133 ****
  // R standard callback pointers.
  // Rinterface.h thinks this can only ever be done on aqua, apparently. Here, we define it the other way around, i.e. #ifndef instead of #ifdef
  #ifndef HAVE_AQUA
! 	extern int  (*ptr_R_EditFiles)(int, char **, char **, char *);
  #endif
  
--- 149,155 ----
  // R standard callback pointers.
  // Rinterface.h thinks this can only ever be done on aqua, apparently. Here, we define it the other way around, i.e. #ifndef instead of #ifdef
+ // No, does not work -> undefined reference! -> TODO: nag R-devels
  #ifndef HAVE_AQUA
! 	//extern int  (*ptr_R_EditFiles)(int, char **, char **, char *);
  #endif
  
***************
*** 142,148 ****
  //	ptr_R_Busy = RBusy;				// probably we don't have any use for this
  //	ptr_R_CleanUp = RCleanUp;
! //	ptr_R_ShowFiles = RShowFiles;
  //	ptr_R_ChooseFile = RChooseFile;
! //	ptr_R_EditFile = REditFile;
  //	ptr_R_EditFiles = REditFiles;
  
--- 164,170 ----
  //	ptr_R_Busy = RBusy;				// probably we don't have any use for this
  //	ptr_R_CleanUp = RCleanUp;
! 	ptr_R_ShowFiles = RShowFiles;
  //	ptr_R_ChooseFile = RChooseFile;
! 	ptr_R_EditFile = REditFile;
  //	ptr_R_EditFiles = REditFiles;
  





More information about the rkward-tracker mailing list