[rkward-cvs] rkward/rkward/rbackend rcommand.h,1.19,1.20 rthread.cpp,1.23,1.24

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Oct 16 14:06:52 UTC 2005


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

Modified Files:
	rcommand.h rthread.cpp 
Log Message:
RControlWindow not pretty but working. Modify rkward.desktop to always start in a konsole

Index: rthread.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rthread.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rthread.cpp	14 Oct 2005 15:57:43 -0000	1.23
--- rthread.cpp	16 Oct 2005 14:06:50 -0000	1.24
***************
*** 116,172 ****
  
  	// step 2: actual handling
! 	if (command->type () & RCommand::EmptyCommand) return;
! 	if (command->status & RCommand::Canceled) return;
  	
! 	RKWardRError error;
  	
! 	int ctype = command->type ();
! 	const char *ccommand = command->command ().latin1 ();
  	
! 	RK_DO (qDebug ("running command: %s", ccommand), RBACKEND, DL_DEBUG);
! 
! 	if (command->type () & RCommand::DirectToOutput) {
! 		runCommandInternal ("sink (\"" + RKSettingsModuleLogfiles::filesPath () + "/rk_out.html\", append=TRUE, split=TRUE)\n", &error);
! 	}
! 
! 	MUTEX_UNLOCK;
! 
! 	if (ctype & RCommand::GetStringVector) {
! 		command->string_data = getCommandAsStringVector (ccommand, &(command->string_count), &error);
! 	} else if (ctype & RCommand::GetRealVector) {
! 		command->real_data = getCommandAsRealVector (ccommand, &(command->real_count), &error);
! 	} else if (ctype & RCommand::GetIntVector) {
! 		command->integer_data = getCommandAsIntVector (ccommand, &(command->integer_count), &error);
! 	} else {
! 		runCommandInternal (ccommand, &error, ctype & RCommand::User);
! 	}
! 
! 	MUTEX_LOCK;
  	
! 	if (error != NoError) {
! 		command->status |= RCommand::WasTried | RCommand::Failed;
! 		if (error == Incomplete) {
! 			command->status |= RCommand::ErrorIncomplete;
! 			RK_DO (qDebug ("Command failed (incomplete)"), RBACKEND, DL_WARNING);
! 		} else if (error == SyntaxError) {
! 			command->status |= RCommand::ErrorSyntax;
! 			RK_DO (qDebug ("Command failed (syntax)"), RBACKEND, DL_WARNING);
  		} else {
! 			command->status |= RCommand::ErrorOther;
! 			RK_DO (qDebug ("Command failed (other)"), RBACKEND, DL_WARNING);
  		}
- 		RK_DO (qDebug ("failed command was: '%s'", command->command ().latin1 ()), RBACKEND, DL_INFO);
- 	} else {
- 		command->status |= RCommand::WasTried;
- 	}
- 
- 	RKWardRError dummy;
- 	if (command->type () & RCommand::DirectToOutput) {
- 		runCommandInternal ("sink ()\n", &dummy);
- 	}
- 
- 	if (error) {
- 		RK_DO (qDebug ("- error message was: '%s'", command->error ().latin1 ()), RBACKEND, DL_WARNING);
- //		runCommandInternal (".rk.init.handlers ()\n", &dummy);
  	}
  
--- 116,171 ----
  
  	// step 2: actual handling
! 	if (!((command->type () & RCommand::EmptyCommand) || (command->status & RCommand::Canceled))) {
! 		RKWardRError error;
! 		
! 		int ctype = command->type ();
! 		const char *ccommand = command->command ().latin1 ();
! 		
! 		RK_DO (qDebug ("running command: %s", ccommand), RBACKEND, DL_DEBUG);
  	
! 		if (command->type () & RCommand::DirectToOutput) {
! 			runCommandInternal ("sink (\"" + RKSettingsModuleLogfiles::filesPath () + "/rk_out.html\", append=TRUE, split=TRUE)\n", &error);
! 		}
  	
! 		MUTEX_UNLOCK;
  	
! 		if (ctype & RCommand::GetStringVector) {
! 			command->string_data = getCommandAsStringVector (ccommand, &(command->string_count), &error);
! 		} else if (ctype & RCommand::GetRealVector) {
! 			command->real_data = getCommandAsRealVector (ccommand, &(command->real_count), &error);
! 		} else if (ctype & RCommand::GetIntVector) {
! 			command->integer_data = getCommandAsIntVector (ccommand, &(command->integer_count), &error);
! 		} else {
! 			runCommandInternal (ccommand, &error, ctype & RCommand::User);
! 		}
  	
! 		MUTEX_LOCK;
! 		
! 		if (error != NoError) {
! 			command->status |= RCommand::WasTried | RCommand::Failed;
! 			if (error == Incomplete) {
! 				command->status |= RCommand::ErrorIncomplete;
! 				RK_DO (qDebug ("Command failed (incomplete)"), RBACKEND, DL_WARNING);
! 			} else if (error == SyntaxError) {
! 				command->status |= RCommand::ErrorSyntax;
! 				RK_DO (qDebug ("Command failed (syntax)"), RBACKEND, DL_WARNING);
! 			} else {
! 				command->status |= RCommand::ErrorOther;
! 				RK_DO (qDebug ("Command failed (other)"), RBACKEND, DL_WARNING);
! 			}
! 			RK_DO (qDebug ("failed command was: '%s'", command->command ().latin1 ()), RBACKEND, DL_INFO);
  		} else {
! 			command->status |= RCommand::WasTried;
! 		}
! 	
! 		RKWardRError dummy;
! 		if (command->type () & RCommand::DirectToOutput) {
! 			runCommandInternal ("sink ()\n", &dummy);
! 		}
! 	
! 		if (error) {
! 			RK_DO (qDebug ("- error message was: '%s'", command->error ().latin1 ()), RBACKEND, DL_WARNING);
! 	//		runCommandInternal (".rk.init.handlers ()\n", &dummy);
  		}
  	}
  

Index: rcommand.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rbackend/rcommand.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rcommand.h	14 Oct 2005 15:57:43 -0000	1.19
--- rcommand.h	16 Oct 2005 14:06:50 -0000	1.20
***************
*** 129,132 ****
--- 129,134 ----
  /** @returns the type as specified in RCommand::RCommand */
  	int type () { return _type; };
+ /** @returns the raw command status. @see CommandStatus */
+ 	int getStatus () { return status; };
  /** @returns the rk_equiv as specified in RCommand::RCommand */
  	QString rkEquivalent () { return _rk_equiv; };
***************
*** 157,162 ****
  		GetStringVector=1024,	/**< Try to fetch result as an array of chars */
  		GetRealVector=2048,		/**< Try to fetch result as an array of doubles */
! 		DirectToOutput=4096,		/**< Append command output to the HTML-output file */
! 		Canceled=8192				/**< Command was cancelled. Do not use in RCommand::RCommand */
  	};
  	enum CommandStatus {
--- 159,163 ----
  		GetStringVector=1024,	/**< Try to fetch result as an array of chars */
  		GetRealVector=2048,		/**< Try to fetch result as an array of doubles */
! 		DirectToOutput=4096		/**< Append command output to the HTML-output file */
  	};
  	enum CommandStatus {
***************
*** 168,172 ****
  		ErrorIncomplete=512,		/**< backend rejected command as being incomplete */
  		ErrorSyntax=1024,			/**< backend rejected command as having a syntax error */
! 		ErrorOther=2048				/**< another error (not incomplete, not syntax error) has occured while trying to execute the command */
  	};
  /** the command has been passed to the backend. */
--- 169,174 ----
  		ErrorIncomplete=512,		/**< backend rejected command as being incomplete */
  		ErrorSyntax=1024,			/**< backend rejected command as having a syntax error */
! 		ErrorOther=2048,			/**< another error (not incomplete, not syntax error) has occured while trying to execute the command */
! 		Canceled=8192				/**< Command was cancelled. */
  	};
  /** the command has been passed to the backend. */





More information about the rkward-tracker mailing list