- Reworked the connection object and the IO system
- Reworked the support for TRICS - Added a second generation motor
This commit is contained in:
86
macro.c
86
macro.c
@@ -529,7 +529,7 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
if(FindCommand(pInter,pBueffel) != NULL)
|
||||
{
|
||||
sprintf(pBueffel,"%s:%d>> %s",pFile,iLine,pCom);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
SCWrite(pCon,pBueffel,eLog);
|
||||
if(pWhere != NULL)
|
||||
{
|
||||
free(pWhere);
|
||||
@@ -627,21 +627,6 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
}
|
||||
SCnoSock(pIntern);
|
||||
|
||||
/* configure the log file */
|
||||
pFil = strdup(argv[1]);
|
||||
pExt = strrchr(pFil,(int)'.');
|
||||
if(!pExt)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: no extension found in InternalFileEval",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(pExt,".log");
|
||||
SCAddLogFile(pIntern,pFil);
|
||||
free(pFil);
|
||||
}
|
||||
|
||||
/* invoke the fileeval */
|
||||
MacroPush(pIntern);
|
||||
@@ -664,9 +649,8 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
int ClientPut(SConnection *pCon, SicsInterp *pInter, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
OutCode eOut = eWarning;
|
||||
OutCode eOut = eLog;
|
||||
int i = 0, iCode, iLen;
|
||||
int iMacro;
|
||||
char *ppCode;
|
||||
char *pMessage = NULL;
|
||||
|
||||
@@ -701,7 +685,7 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 10;
|
||||
i = eLog;
|
||||
iCode = argc;
|
||||
}
|
||||
|
||||
@@ -740,8 +724,14 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
case 10:
|
||||
eOut = eError;
|
||||
break;
|
||||
case 11:
|
||||
eOut = eLog;
|
||||
break;
|
||||
case 12:
|
||||
eOut = eLogError;
|
||||
break;
|
||||
default:
|
||||
eOut = eWarning;
|
||||
eOut = eLog;
|
||||
iCode = argc;
|
||||
break;
|
||||
}
|
||||
@@ -756,19 +746,13 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
pMessage = (char *)malloc((iLen+100)*sizeof(char));
|
||||
if(!pMessage)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: out of memory in clientput",eError);
|
||||
SCWrite(pCon,"ERROR: out of memory in clientput",eLogError);
|
||||
return 0;
|
||||
}
|
||||
memset(pMessage,0,(iLen+100)*sizeof(char));
|
||||
Arg2Text(iCode-1,&argv[1],pMessage,(iLen+100)*sizeof(char));
|
||||
|
||||
/* now write, thereby tunneling macro flag in order to get proper
|
||||
write to client and not into interpreter
|
||||
*/
|
||||
iMacro = SCinMacro(pCon);
|
||||
SCsetMacro(pCon,0);
|
||||
SCWrite(pCon,pMessage,eOut);
|
||||
SCsetMacro(pCon,iMacro);
|
||||
if(pMessage)
|
||||
{
|
||||
free(pMessage);
|
||||
@@ -784,14 +768,14 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
int iMacro;
|
||||
char *ppCode;
|
||||
char *pMessage = NULL;
|
||||
commandContext cc;
|
||||
SConnection *conCon = NULL;
|
||||
|
||||
assert(pCon);
|
||||
assert(pInter);
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
SCWrite(pCon,"Insufficient arguments to ClientPut",eError);
|
||||
SCWrite(pCon,"Insufficient arguments to ClientPut",eLogError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -856,8 +840,14 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
case 10:
|
||||
eOut = eError;
|
||||
break;
|
||||
case 11:
|
||||
eOut = eLog;
|
||||
break;
|
||||
case 12:
|
||||
eOut = eLogError;
|
||||
break;
|
||||
default:
|
||||
eOut = eWarning;
|
||||
eOut = eLog;
|
||||
iCode = argc;
|
||||
break;
|
||||
}
|
||||
@@ -882,14 +872,13 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
write to client and not into interpreter. We also make sure that the device
|
||||
is gumput
|
||||
*/
|
||||
iMacro = SCinMacro(pCon);
|
||||
SCsetMacro(pCon,0);
|
||||
cc = SCGetContext(pCon);
|
||||
strcpy(cc.deviceID,"gumput");
|
||||
SCPushContext2(pCon,cc);
|
||||
SCWrite(pCon,pMessage,eOut);
|
||||
SCPopContext(pCon);
|
||||
SCsetMacro(pCon,iMacro);
|
||||
conCon = SCCopyConnection(pCon);
|
||||
if(conCon == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory in gumput", eError);
|
||||
}
|
||||
strcpy(conCon->deviceID,"gumput");
|
||||
SCWrite(conCon,pMessage,eOut);
|
||||
SCDeleteConnection(conCon);
|
||||
if(pMessage)
|
||||
{
|
||||
free(pMessage);
|
||||
@@ -908,7 +897,7 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
SCWrite(pCon,"Insufficient arguments to Broadcast",eError);
|
||||
SCWrite(pCon,"Insufficient arguments to Broadcast",eLog);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -917,10 +906,7 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
write to client and not into interpreter
|
||||
*/
|
||||
Arg2Text(argc-1, &argv[1],pBueffel,255);
|
||||
iMacro = SCinMacro(pCon);
|
||||
SCsetMacro(pCon,0);
|
||||
ServerWriteGlobal(pBueffel,eWarning);
|
||||
SCsetMacro(pCon,iMacro);
|
||||
ServerWriteGlobal(pBueffel,eLog);
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------
|
||||
@@ -1013,13 +999,14 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
SCWrite(pCon, "ERROR: no more memory", eError);
|
||||
return 0;
|
||||
}
|
||||
Tcl_ResetResult(pTcl);
|
||||
iRet = Tcl_Eval(pTcl,pCommand);
|
||||
if (pCommand != pBueffel) free(pCommand);
|
||||
if(iRet == TCL_OK)
|
||||
{
|
||||
if(strlen(pTcl->result) > 0){
|
||||
SCPrintf(pCon, eStatus, "%s", pTcl->result);
|
||||
SCPrintf(pCon, eValue, "%s", pTcl->result);
|
||||
}
|
||||
if (pCommand != pBueffel) free(pCommand);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@@ -1028,7 +1015,10 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
{
|
||||
Tcl_UnsetVar(pTcl,SICSERROR,TCL_GLOBAL_ONLY);
|
||||
}
|
||||
SCPrintf(pCon,eError,"%s",pTcl->result);
|
||||
if(strlen(pTcl->result) > 0){
|
||||
SCPrintf(pCon,eError,"ERROR: Tcl reported %s in %s",pTcl->result, pCommand);
|
||||
}
|
||||
if (pCommand != pBueffel) free(pCommand);
|
||||
return 0;
|
||||
}
|
||||
return 1; /* not reached */
|
||||
@@ -1117,11 +1107,11 @@ extern int Nxinter_SafeInit(Tcl_Interp *pTcl); /* from Swig NeXus Tcl interface
|
||||
}
|
||||
strtolower(argv[0]);
|
||||
if(strcmp(argv[0],"fulltransact") == 0){
|
||||
SCPrintf(pCon,eError, "TRANSACTIONSTART %s",pCommand);
|
||||
SCPrintf(pCon,eLog, "TRANSACTIONSTART %s",pCommand);
|
||||
}
|
||||
iRet = InterpExecute(pSics,pCon,pCommand);
|
||||
if (pCommand != pBuffer) free(pCommand);
|
||||
SCWrite(pCon,"TRANSACTIONFINISHED",eError);
|
||||
SCWrite(pCon,"TRANSACTIONFINISHED",eLog);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user