- Fixed sicsprompt bug. Sicsprompt caused a core dump

- Removed generation of incommenurate reflections for 0,0,0 in fourmess.c
- Implemented a Poch command for heartbeats
- Fixed 64 bit dimension issues in nxdict
- Fixed different calling conventions for NXReportError deep stack in nxdict
- Stopped ei motor driving when not necessary
- Added yet another monitor for POLDI
- Added a protocoll driver for the JVL motor RS-485 binary protocoll
- Fixed some reporting issues


SKIPPED:
	psi/jvlprot.c
	psi/make_gen
	psi/polterwrite.c
	psi/psi.c
	psi/spss7.c
This commit is contained in:
koennecke
2012-06-05 09:09:20 +00:00
parent ecd96f9ab0
commit bd50b19178
21 changed files with 238 additions and 51 deletions

View File

@ -248,6 +248,9 @@ SConnection *SCCreateDummyConnection(SicsInterp * pSics)
SConnection *pRes = NULL;
pRes = CreateConnection(pSics);
if(pRes == NULL){
return pServ->dummyCon;
}
pRes->sockHandle = -1;
pRes->iUserRights = usInternal;
@ -958,12 +961,61 @@ int SCOnlySockWrite(SConnection * self, char *buffer, int iOut)
/*--------------------------------------------------------------------------*/
int SCPureSockWrite(SConnection * self, char *buffer, int iOut)
{
char pBueffel[1024];
char *pPtr;
/* for commandlog tail */
if (!VerifyConnection(self)) {
return 0;
}
testAndWriteSocket(self, buffer, iOut);
if(self->iProtocolID == 5) {
if (strlen(buffer) + 30 > 1024) {
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
memset(pPtr, 0, strlen(buffer) + 20);
} else {
pPtr = pBueffel;
}
sprintf(pPtr, "%d::>%s<::", self->transID, buffer);
testAndWriteSocket(self, pPtr, iOut);
if(pPtr != pBueffel){
free(pPtr);
}
} else {
testAndWriteSocket(self, buffer, iOut);
}
return 1;
}
/*--------------------------------------------------------------------------
special for ClientLog. Do not use elsewhere without check
----------------------------------------------------------------------------*/
int SCLogWrite(SConnection * self, char *buffer, int iOut)
{
char pBueffel[1024];
char *pPtr;
if (!VerifyConnection(self)) {
return 0;
}
WriteToCommandLogId(NULL, self->sockHandle, buffer);
if(self->iProtocolID == 5) {
if (strlen(buffer) + 30 > 1024) {
pPtr = (char *) malloc((strlen(buffer) + 30) * sizeof(char));
memset(pPtr, 0, strlen(buffer) + 20);
} else {
pPtr = pBueffel;
}
sprintf(pPtr, "%d::>%s<::", self->transID, buffer);
testAndWriteSocket(self, pPtr, iOut);
if(pPtr != pBueffel){
free(pPtr);
}
} else {
testAndWriteSocket(self, buffer, iOut);
}
return 1;
}
@ -978,10 +1030,11 @@ int SCNotWrite(SConnection * self, char *buffer, int iOut)
return 0;
}
/* log it for any case */
/* log it for any case
sprintf(pBueffel, "Next line intended for socket: %d", self->sockHandle);
SICSLogWrite(pBueffel, eInternal);
SICSLogWrite(buffer, iOut);
*/
testAndStoreInTcl(self, buffer, iOut);
return 1;
@ -1130,7 +1183,7 @@ int SCWriteZipped(SConnection * self, char *pName, void *pData,
sprintf(outBuf, "SICSBIN ZIP %s %d %d\r\n", pName,
compressedLength, cc.transID);
} else {
sprintf(outBuf, "SICSBIN ZIP %s %d \r\n", pName, compressedLength);
sprintf(outBuf, "SICSBIN ZIP %s %d\r\n", pName, compressedLength);
}
pHeader = strdup(outBuf);
if (pHeader == NULL) {
@ -1195,7 +1248,7 @@ int SCWriteBinary(SConnection * self, char *pName, void *pData,
sprintf(outBuf, "SICSBIN BIN %s %d %d\r\n", pName,
iDataLen, cc.transID);
} else {
sprintf(outBuf, "SICSBIN BIN %s %d \r\n", pName, iDataLen);
sprintf(outBuf, "SICSBIN BIN %s %d\r\n", pName, iDataLen);
}
pHeader = strdup(outBuf);
if (pHeader == NULL) {
@ -1429,15 +1482,17 @@ int SCPrompt(SConnection * pCon, char *pPrompt, char *pResult, int iLen)
char pFrom[50];
Status eOld;
int oldMode;
SConnection *master = NULL;
if (!VerifyConnection(pCon)) {
return 0;
}
SCWrite(pCon, pPrompt, eWarning);
master = SCfindMaster(pCon);
eOld = GetStatus();
SetStatus(eInput);
CostaUnlock(pCon->pStack);
CostaUnlock(master->pStack);
while (1) {
/*
wait a second. We want to wait even in a simulation, otherwise
@ -1454,17 +1509,17 @@ int SCPrompt(SConnection * pCon, char *pPrompt, char *pResult, int iLen)
break;
}
/* do we have data ? */
iRet = CostaPop(pCon->pStack, &pPtr);
iRet = CostaPop(master->pStack, &pPtr);
if (iRet == 1) {
SetStatus(eOld);
CostaLock(pCon->pStack);
CostaLock(master->pStack);
strlcpy(pResult, pPtr, iLen);
WriteToCommandLogId(" prompted>", pCon->sockHandle, pPtr);
return 1;
}
}
SetStatus(eOld);
CostaLock(pCon->pStack);
CostaLock(master->pStack);
return 0;
}
@ -1560,7 +1615,9 @@ int SCInvoke(SConnection * self, SicsInterp * pInter, char *pCommand)
if (SCGetWriteFunc(self) != SCNotWrite) {
sendingConnection = self->sockHandle;
if (self->sockHandle >= 0) {
WriteToCommandLogCmd(self->sockHandle, pCommand);
if(strstr(pCommand,"Poch") == NULL){
WriteToCommandLogCmd(self->sockHandle, pCommand);
}
} else {
WriteToCommandLog("CRON>>", pCommand);
}