- Fixed a couple of compiler found bugs generated by the new C compiler

- Added support to tasinit for status display part of tas-application
This commit is contained in:
cvs
2001-01-15 10:05:43 +00:00
parent d3b8f38ced
commit e64773949d
26 changed files with 155 additions and 55 deletions

View File

@ -173,6 +173,7 @@
int iRet, iCode, iFix;
char pBueffel[256], pError[132];
static int iCount;
static int callCount;
self = (pEVControl)pData;
assert(self);
@ -228,6 +229,15 @@
{
fDelta = - fDelta;
}
/* handle callback */
callCount++;
if(callCount >= 10)
{
sprintf(pBueffel,"%s = %f", self->pName, fPos);
InvokeCallBack(self->pCall, VALUECHANGE,pBueffel);
callCount = 0;
}
/* based on this: logic ! */
if(fDelta <= ObVal(self->pParam, TOLERANCE)) /* done */
@ -548,6 +558,14 @@
{
return 0;
}
/* deal with callbacks */
self->callCount++;
if(self->callCount >= 20)
{
sprintf(pBueffel,"%s = %F", self->pName, fPos);
InvokeCallBack(self->pCall,VALUECHANGE, pBueffel);
self->callCount = 0;
}
}
else if(iRet == -1) /* pending */
{
@ -643,7 +661,17 @@
pRes->pEnvir->GetMode = EVIGetMode;
pRes->pEnvir->IsInTolerance = EVIIsInTolerance;
pRes->pEnvir->HandleError = EVIErrHandler;
/* callback interface */
pRes->pCall = CreateCallBackInterface();
if(!pRes->pCall)
{
free(pRes->pDrivInt);
DeleteDescriptor(pRes->pDes);
free(pRes);
return NULL;
}
/* new parameter space */
pRes->pParam = ObParCreate(7);
if(!pRes->pParam)
@ -711,6 +739,10 @@
{
free(self->pEnvir);
}
if(self->pCall)
{
DeleteCallBackInterface(self->pCall);
}
if(self->KillPrivate)
{
self->KillPrivate(self->pPrivate);
@ -894,6 +926,20 @@
return 1;
}
/*-------------------------------------------------------------------------*/
static int EVCallBack(int iEvent, void *pEventData, void *pUserData)
{
char *pBuf = (char *)pEventData;
SConnection *pCon = (SConnection *)pUserData;
char pBueffel[132];
if(iEvent == VALUECHANGE)
{
SCWrite(pCon,pBuf,eValue);
return 1;
}
return 1;
}
/*---------------------------------------------------------------------------
The wrapper understands the following syntax:
EVControl : print current value
@ -913,6 +959,7 @@
double dVal;
float fPos;
int iRet;
long lID;
self = (pEVControl)pData;
assert(self);
@ -943,6 +990,21 @@
SCWrite(pCon,pReply,eValue);
return iRet;
}
/* install automatic notification */
else if(strcmp(argv[1],"interest") == 0)
{
lID = RegisterCallback(self->pCall, VALUECHANGE, EVCallBack,
pCon, NULL);
SCRegister(pCon,pSics, self->pCall,lID);
SCSendOK(pCon);
return 1;
}
else if(strcmp(argv[1],"uninterest") == 0)
{
RemoveCallback2(self->pCall,pCon);
SCSendOK(pCon);
return 1;
}
else if(strcmp(argv[1],"log") == 0) /* log commands */
{
if(argc < 3)