Code Search for Developers
 
 
  

FGLnode.C from Magnus at Krugle


Show FGLnode.C syntax highlighted

#include "crossTrainer.h"
#include "FGLnode.h"
#include "FResources.h"
#include <stdio.h>
FGLnode::FGLnode(FObject *aSupervisor){
	super=aSupervisor;
	mailPerson= -1;		// not a legal value
	func=NULL;
	abort=FALSE;
	dirtyAbort=FALSE;
	GLvarIsClean=TRUE;
}

Boolean FGLnode::run(void){
	if(func==ZERO)nodeErr(2);
	
	wakeUp();
	
//Once we wake up we guarentee
//at least one call whether or not
//time has run out. 

	Boolean callAgain=TRUE, mustCall=TRUE;
	
	while((getTime()<FGLink::timeout && callAgain) || mustCall){
		mustCall=FALSE;
		callAgain=func(this);
	}
	if(callAgain)auRevoir();
	else goodbyeKiss();
	return(callAgain);
}
void FGLnode::wakeUp(void){
	// default method does nothing
}
void FGLnode::auRevoir(void){
	// default method sets func to goodbyeFunc in the
	// following situations:
	// 		dirtyAbort is TRUE, or
	//		abort is TRUE and GLvarIsClean is TRUE.  
	// If you override auRevoir, be sure
	// to call this method if your node supports the abort
	// mechanism.
	
	if(dirtyAbort || (abort && GLvarIsClean))func=goodbyeFunc;
}
void FGLnode::goodbyeKiss(void){
	// default method does nothing
}


void FGLnode::nodeErr(int ID){ /*moves memory*/
	// displays nodeErr resource message with index ID.
	Str255 param0,param1,param2,param3;
	int itemno;
	long offset;
	sprintf((char *)param0,"nodeErr %d",ID);  
	CtoPstr((char*)param0);
	sprintf((char*)param1,"");
	CtoPstr((char*)param1);
	sprintf((char*)param2,"");
// convert param2 to Pascal string
		CtoPstr((char*)param2);
//get the message
	
	GetIndString(param3,FResources::xSTRnodeErr,ID);  
	if(param3[0]==0){
		GetIndString(param3,FResources::xSTRnodeErr,1);
	}
//display
	ParamText(param0,param1,param2,param3);
	nodeAlert();
} 


Boolean  FGLnode::goodbyeFunc(FGLnode *node){
	// this is just a trap to terminate processing.
	// this trap is invoked indirectly by setting the
	// abort flag to TRUE.  If your node overrides auRevoir,
	// be sure to call GLnode::auRevoir or the abort flag
	// will have no effect and the goodbye func will not
	// be invoked.
	// In the event the goodbyeFunc is invoked, control passes
	// directly to the goodbyeKiss of the node.

	return FALSE;
}




See more files for this project here

Magnus

Magnus is a special purpose mathematical package for Infinite Group Theory computations

Project homepage: http://sourceforge.net/projects/magnus
Programming language(s): C,C++
License: other

  FBlockManager.C
  FBlockManager.h
  FGLink.C
  FGLink.h
  FGLnode.C
  FGLnode.h
  FGLrecycleStack.C
  FGLrecycleStack.h
  FGLstack.C
  FGLstack.h
  FGLstepper.C
  FGLstepper.h
  FGLwalkNode.C
  FGLwalkNode.h
  FcleanUpNode.C
  FcleanUpNode.h
  FcloneNode.C
  FcloneNode.h
  FdebugNode.C
  FdebugNode.h
  FfoldNode.C
  FfoldNode.h
  FfoldStepper.C
  FfoldStepper.h
  FgrowNode.C
  FgrowNode.h
  FrandomRef.C
  FrandomRef.h
  FreducedFoldNode.C
  FreducedFoldNode.h
  FreducedVertexFolder.C
  FreducedVertexFolder.h
  FvertexFolder.C
  FvertexFolder.h
  GLfunctions.C
  GLfunctions.h
  GLref.h
  _FnameNode.cp_
  _FnameNode.h_
  _FrankNode.cp_
  _FrankNode.h_
  _FstrToGLvarNode.cp_
  _FstrToGLvarNode.h_
  debugGLink.C
  debugGLink.h