- Fixes to make SL6 work

- New NeXus libraries
- Added new raw binary transfer mode for mass data
- Added a check script option to configurable virtual motor


SKIPPED:
	psi/dumprot.c
	psi/make_gen
	psi/psi.c
	psi/rebin.c
	psi/sanslirebin.c
This commit is contained in:
koennecke
2012-03-29 08:41:05 +00:00
parent 14f257c2ab
commit 9eca96b064
56 changed files with 8881 additions and 6327 deletions

156
conman.c
View File

@ -1066,6 +1066,162 @@ int SCWriteUUencoded(SConnection * pCon, char *pName, void *pData,
#define ZIPBUF 8192
int SCWriteZipped(SConnection * self, char *pName, void *pData,
int iDataLen)
{
char outBuf[65536], *pBuf = NULL, noutBuf[ZIPBUF], *pHeader = NULL;
int compressedLength, iRet, iRet2, iCount, protocolID;
z_stream compStream;
commandContext cc;
/* check for a valid connection */
if (!VerifyConnection(self)) {
return 0;
}
/* a telnet connection will corrupt the compressed stream, so
stop it!
*/
if (self->iTelnet) {
SCWrite(self,
"ERROR: the telnet protocol will corrupt compressed data!",
eError);
return 0;
}
/*
do nothing if no data
*/
if (pName == NULL || pData == NULL) {
SCWrite(self, "ERROR: no data to write in SCWriteZiped", eError);
return 0;
}
pBuf = malloc(iDataLen*sizeof(char));
memset(pBuf,0,iDataLen*sizeof(char));
compStream.zalloc = (alloc_func) NULL;
compStream.zfree = (free_func) NULL;
compStream.opaque = (voidpf) NULL;
/* iRet = deflateInit(&compStream, Z_DEFAULT_COMPRESSION); */
iRet = deflateInit(&compStream, 2);
if (iRet != Z_OK) {
sprintf(outBuf, "ERROR: zlib error: %d", iRet);
SCWrite(self, outBuf, eError);
return 0;
}
compStream.next_in = (Bytef *) pData;
compStream.next_out = (Bytef *) pBuf;
compStream.avail_in = iDataLen;
compStream.avail_out = iDataLen;
iRet = deflate(&compStream, Z_FINISH);
if (iRet != Z_STREAM_END) {
sprintf(outBuf, "ERROR: zlib error: %d", iRet);
SCWrite(self, outBuf, eError);
return 0;
}
compressedLength = compStream.total_out;
/* write header line */
memset(outBuf, 0, 65536);
protocolID = GetProtocolID(self);
if (protocolID == 5) {
cc = SCGetContext(self);
sprintf(outBuf, "SICSBIN ZIP %s %d %d\r\n", pName,
compressedLength, cc.transID);
} else {
sprintf(outBuf, "SICSBIN ZIP %s %d \r\n", pName, compressedLength);
}
pHeader = strdup(outBuf);
if (pHeader == NULL) {
SCWrite(self, "ERROR: out of memory in SCWriteZipped", eError);
return 0;
}
traceCommand(ConID(self),"out:SICSBIN ZIP %s %d", pName, compressedLength);
iRet = ANETwrite(self->sockHandle, pHeader, strlen(pHeader));
iRet = ANETwrite(self->sockHandle, pBuf, compStream.total_out);
if (iRet != 1) {
sprintf(outBuf, "ERROR: network error %d on zipped send", iRet);
SCWrite(self, outBuf, eError);
return 0;
}
/* printf("Sent zipped data: %s with %d\n", pHeader, iRet); */
deflateEnd(&compStream);
free(pHeader);
free(pBuf);
return 1;
}
/*------------------------------------------------------------------*/
int SCWriteBinary(SConnection * self, char *pName, void *pData,
int iDataLen)
{
char outBuf[65536], *pHeader = NULL;
int iRet, iRet2, iCount, protocolID;
commandContext cc;
/* check for a valid connection */
if (!VerifyConnection(self)) {
return 0;
}
/* a telnet connection will corrupt the compressed stream, so
stop it!
*/
if (self->iTelnet) {
SCWrite(self,
"ERROR: the telnet protocol will corrupt compressed data!",
eError);
return 0;
}
/*
do nothing if no data
*/
if (pName == NULL || pData == NULL) {
SCWrite(self, "ERROR: no data to write in SCWriteZiped", eError);
return 0;
}
/* write header line */
memset(outBuf, 0, 65536);
protocolID = GetProtocolID(self);
if (protocolID == 5) {
cc = SCGetContext(self);
sprintf(outBuf, "SICSBIN BIN %s %d %d\r\n", pName,
iDataLen, cc.transID);
} else {
sprintf(outBuf, "SICSBIN BIN %s %d \r\n", pName, iDataLen);
}
pHeader = strdup(outBuf);
if (pHeader == NULL) {
SCWrite(self, "ERROR: out of memory in SCWriteBinary", eError);
return 0;
}
traceCommand(ConID(self),"out:SICSBIN BIN %s %d", pName, iDataLen);
iRet = ANETwrite(self->sockHandle, pHeader, strlen(pHeader));
iRet = ANETwrite(self->sockHandle, pData, iDataLen);
if (iRet != 1) {
sprintf(outBuf, "ERROR: network error %d on zipped send", iRet);
SCWrite(self, outBuf, eError);
return 0;
}
/* printf("Sent zipped data: %s with %d\n", pHeader, iRet); */
free(pHeader);
return 1;
}
/*--------------------------------------------------------------
* left in for documentation............
*/
int SCWriteZippedOld(SConnection * self, char *pName, void *pData,
int iDataLen)
{
char outBuf[65546], *pBuf = NULL, noutBuf[ZIPBUF], *pHeader = NULL;
int compressedLength, iRet, iRet2, iCount, protocolID;