PSI sics-cvs-psi-2006

This commit is contained in:
2006-05-08 02:00:00 +00:00
committed by Douglas Clowes
parent ae77364de2
commit 6e926b813f
388 changed files with 445529 additions and 14109 deletions

View File

@@ -7,6 +7,9 @@
added callback facilities and interst command.
Mark Koennecke, August 1997
Updated in order to prevent status floods
Mark Koennecke, July 2004
Copyright:
Labor fuer Neutronenstreuung
@@ -39,6 +42,7 @@
-----------------------------------------------------------------------------*/
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include "fortify.h"
#include <string.h>
#include "sics.h"
@@ -48,7 +52,6 @@
#undef VALUECHANGE
#define VALUECHANGE 2
static Status eCode = eEager;
static char *pText[] = {
"Eager to execute commands",
@@ -65,6 +68,7 @@
"Dead",
"Waiting for User Input",
"Counting/Driving",
"Working",
NULL };
static char *iText[] = {
@@ -82,10 +86,12 @@
"dead",
"input",
"count/drive",
"working",
NULL };
static pICallBack pCall = NULL;
static int fixed = 0;
static Status eCode = eEager;
/*-------------------------------------------------------------------------*/
void KillStatus(void *pData)
{
@@ -175,7 +181,8 @@
return 1;
}
/*------------------- The CallBack function for interest ------------------*/
static int StatusCallback(int iEvent, void *pEvent, void *pUser)
static int StatusCallback(int iEvent, void *pEvent, void *pUser,
commandContext cc)
{
SConnection *pCon;
char pBueffel[80];
@@ -185,7 +192,9 @@
pCon = (SConnection *)pUser;
sprintf(pBueffel,"status = %s", pText[(int)eCode]);
SCPushContext2(pCon,cc);
SCWrite(pCon,pBueffel,eWarning);
SCPopContext(pCon);
return 1;
}
@@ -211,7 +220,8 @@
strtolower(argv[1]);
if(strcmp(argv[1],"interest") == 0)
{
lID = RegisterCallback(pCall, VALUECHANGE, StatusCallback,
lID = RegisterCallback(pCall, SCGetContext(pCon),
VALUECHANGE, StatusCallback,
pCon, NULL);
SCRegister(pCon,pSics, pCall,lID);
SCSendOK(pCon);