- Many fixes to the new scriptcontext to make it work
This commit is contained in:
9
conman.c
9
conman.c
@ -366,6 +366,7 @@ extern pServer pServ;
|
||||
}
|
||||
assert( (iMode == 0) || (iMode == 1));
|
||||
self->iMacro = iMode;
|
||||
/* SCPrintf(self,eError, "SCsetMacro = %lx, %d\n", (long int)self, iMode); */
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -2272,7 +2273,7 @@ SConnection *SCStorePush(SCStore *conStore) {
|
||||
/* push macro flag on stack */
|
||||
conStore->macroStack <<= 1;
|
||||
conStore->macroStack |= (pCon->iMacro != 0);
|
||||
pCon->iMacro = conStore->inMacro;
|
||||
SCsetMacro(pCon, conStore->inMacro);
|
||||
SCPushContext2(pCon, conStore->cc);
|
||||
return pCon;
|
||||
}
|
||||
@ -2282,8 +2283,10 @@ void SCStorePop(SCStore *conStore) {
|
||||
|
||||
pCon = SCLoad(conStore);
|
||||
SCPopContext(pCon);
|
||||
/* pop macro flag from stack */
|
||||
pCon->iMacro = (conStore->macroStack | 1);
|
||||
/* pop macro flag from stack
|
||||
SCsetMacro(pCon,conStore->macroStack);
|
||||
*/
|
||||
SCsetMacro(pCon, (conStore->macroStack & 1));
|
||||
conStore->macroStack >>= 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
12
event.h
12
event.h
@ -1,5 +1,5 @@
|
||||
|
||||
#line 98 "event.w"
|
||||
#line 100 "event.w"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
E V E N T
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
int Text2Event(char *pText);
|
||||
|
||||
#line 111 "event.w"
|
||||
#line 113 "event.w"
|
||||
|
||||
|
||||
|
||||
@ -45,13 +45,15 @@
|
||||
#define STATUS 18
|
||||
#define POSITION 19
|
||||
#define HDBVAL 20
|
||||
#define STSTART 21
|
||||
#define STEND 22
|
||||
|
||||
#line 113 "event.w"
|
||||
#line 115 "event.w"
|
||||
|
||||
|
||||
/*--------------- Signals for the Signalfunction of each task ------------*/
|
||||
|
||||
#line 80 "event.w"
|
||||
#line 82 "event.w"
|
||||
|
||||
#define SICSINT 300
|
||||
#define SICSBROADCAST 301
|
||||
@ -60,6 +62,6 @@
|
||||
#define COMLOG 304
|
||||
#define CRONLIST 305
|
||||
|
||||
#line 116 "event.w"
|
||||
#line 118 "event.w"
|
||||
|
||||
#endif
|
||||
|
@ -56,6 +56,8 @@ $\langle$VE {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@#define STATUS 18@\\
|
||||
\mbox{}\verb@#define POSITION 19@\\
|
||||
\mbox{}\verb@#define HDBVAL 20@\\
|
||||
\mbox{}\verb@#define STSTART 21@\\
|
||||
\mbox{}\verb@#define STEND 22@\\
|
||||
\mbox{}\verb@@$\Diamond$
|
||||
\end{list}
|
||||
\vspace{-1ex}
|
||||
|
2
event.w
2
event.w
@ -39,6 +39,8 @@ if the event code is not known, else the apropriate event code.
|
||||
#define STATUS 18
|
||||
#define POSITION 19
|
||||
#define HDBVAL 20
|
||||
#define STSTART 21
|
||||
#define STEND 22
|
||||
@}
|
||||
\begin{description}
|
||||
\item[VALUECHANGE] This is a variable changing its value. As event data a pointer to the
|
||||
|
2
make_gen
2
make_gen
@ -60,7 +60,7 @@ full: purge all
|
||||
SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \
|
||||
$(VELOOBJ) $(DIFIL) $(EXTRA) \
|
||||
$(SUBLIBS)
|
||||
$(CC) -g -o SICServer \
|
||||
$(CC) -g -o SICServer \
|
||||
$(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \
|
||||
$(VELOOBJ) $(DIFOBJ) $(EXTRA) $(LIBS)
|
||||
|
||||
|
4
proxy.c
4
proxy.c
@ -290,6 +290,10 @@ static hdbCallbackReturn MapParCallback(pHdb node, void *userData,
|
||||
char command[1024];
|
||||
pDynString data = NULL;
|
||||
|
||||
if(GetHdbKillNodeMessage(message) != NULL ){
|
||||
return hdbContinue;
|
||||
}
|
||||
|
||||
GetHdbProperty(node->mama, "proxy", proxyDev,80);
|
||||
pCom = FindCommand(pServ->pSics, proxyDev);
|
||||
if(pCom == NULL){
|
||||
|
@ -268,6 +268,7 @@ static char *SctActionHandler(void *actionData, char *lastReply) {
|
||||
char *send = NULL;
|
||||
int i;
|
||||
SConnection *con;
|
||||
char timeKey[50], timeVal[50];
|
||||
|
||||
if (currentCon) {
|
||||
con = SCStorePush(currentCon);
|
||||
@ -297,6 +298,12 @@ static char *SctActionHandler(void *actionData, char *lastReply) {
|
||||
if (currentCon && ! data->answered) {
|
||||
SCWrite(con, "o.k.", eValue);
|
||||
}
|
||||
if(strcmp(data->name,"write") == 0){
|
||||
SetHdbProperty(data->node,"writestatus","commandsent");
|
||||
}
|
||||
snprintf(timeKey,50,"%s_time",data->name);
|
||||
snprintf(timeVal,50,"%.3f", DoubleTime());
|
||||
SetHdbProperty(data->node,timeKey,timeVal);
|
||||
goto finish;
|
||||
}
|
||||
SetProp(node, controller->node, "state", state);
|
||||
@ -1022,3 +1029,7 @@ void SctInit(void) {
|
||||
AddCommand(pServ->pSics, "sct", SctCommand, SctKill, sct);
|
||||
AddCmd("makesctcontroller", SctMakeController);
|
||||
}
|
||||
|
||||
int SctVerbose(SctController *c){
|
||||
return c->verbose;
|
||||
}
|
||||
|
@ -29,5 +29,10 @@ void SctQueueNode(SctController *controller, Hdb *node,
|
||||
*/
|
||||
int SctCallInContext(SConnection *con, char *script, Hdb *node,
|
||||
SctController *controller, char **resPtr);
|
||||
|
||||
/**
|
||||
* test the controller verbose flag
|
||||
* \param c The SctController to test
|
||||
* \return 1 for verbose, 0 for silent
|
||||
*/
|
||||
int SctVerbose(SctController *c);
|
||||
#endif
|
||||
|
@ -78,6 +78,10 @@ static int SCTDRIVCheckLimits(void *data, float val,
|
||||
if(GetHdbProperty(self->node,"checklimits",script,1024)){
|
||||
status = SctCallInContext(pServ->dummyCon, script,
|
||||
self->node, self->c, &result);
|
||||
if(SctVerbose(self->c)){
|
||||
SCPrintf(pServ->dummyCon, eWarning, "script %s called with result %s\n ",
|
||||
script, result);
|
||||
}
|
||||
if(status == 0){
|
||||
strncpy(error,result,errlen);
|
||||
return 0;
|
||||
@ -102,6 +106,7 @@ static long SCTDRIVSetValue(void *data, SConnection *pCon, float val){
|
||||
self = (pSctDrive)data;
|
||||
v.dataType = HIPFLOAT;
|
||||
v.v.doubleValue = (double)val;
|
||||
SetHdbProperty(self->node,"writestatus", "start");
|
||||
status = SetHipadabaPar(self->node, v, pCon);
|
||||
if(status == 1){
|
||||
return OKOK;
|
||||
@ -125,9 +130,22 @@ static int SCTDRIVCheckStatus(void *data, SConnection *pCon){
|
||||
int status;
|
||||
Tcl_Interp *pTcl = NULL;
|
||||
char *result;
|
||||
SConnection *con;
|
||||
|
||||
self = (pSctDrive)data;
|
||||
|
||||
/*
|
||||
* check if the write command has gone through
|
||||
*/
|
||||
if(GetHdbProperty(self->node,"writestatus", script,1024)){
|
||||
if(strcmp(script,"start") == 0){
|
||||
return HWBusy;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* run the checkstatus script
|
||||
*/
|
||||
if(!GetHdbProperty(self->node,"checkstatus",script,1024)){
|
||||
if (!GetHdbProperty(self->node,"status",script,1024)){
|
||||
SCWrite(pCon,
|
||||
@ -139,11 +157,16 @@ static int SCTDRIVCheckStatus(void *data, SConnection *pCon){
|
||||
status = SctCallInContext(pCon,script, self->node,
|
||||
self->c, &result);
|
||||
if (status == 0) {
|
||||
SCWrite(pCon,result, eError);
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
return HWFault;
|
||||
}
|
||||
if(SctVerbose(self->c)){
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
}
|
||||
}
|
||||
if(strstr(result,"busy") != NULL){
|
||||
if(strstr(result,"busy") != NULL){
|
||||
return HWBusy;
|
||||
} else if(strstr(result,"posfault") != NULL){
|
||||
return HWPosFault;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "statusfile.h"
|
||||
#include <splitter.h>
|
||||
#include "sicsobj.h"
|
||||
#include <macro.h>
|
||||
|
||||
#define MAX_HDB_PATH 1024
|
||||
|
||||
@ -691,8 +692,14 @@ static hdbCallbackReturn SICSScriptReadCallback(pHdb node, void *userData,
|
||||
/*
|
||||
* evaluate
|
||||
*/
|
||||
if(pCon != NULL){
|
||||
MacroPush(pCon);
|
||||
}
|
||||
status = Tcl_Eval(InterpGetTcl(pServ->pSics),command);
|
||||
if(status != TCL_OK){
|
||||
if(pCon != NULL){
|
||||
MacroPop();
|
||||
}
|
||||
if(status != TCL_OK){
|
||||
snprintf(error,1023,"ERROR: Tcl returned error: %s",
|
||||
Tcl_GetStringResult(InterpGetTcl(pServ->pSics)));
|
||||
if(pCon != NULL){
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#DFORTIFY= -DFORTIFY
|
||||
#FORTIFYOBJ= fortify.o strdup.o
|
||||
#DFORTIFY= -p
|
||||
|
||||
MFLAGS=-f makefile_linux$(DUMMY)
|
||||
|
||||
|
Reference in New Issue
Block a user