large array modifications

This commit is contained in:
Jeff Hill
2002-05-29 00:19:31 +00:00
parent 565a372df1
commit a08fc2c551
8 changed files with 86 additions and 49 deletions

View File

@@ -47,6 +47,7 @@ LIBSRCS += outBuf.cc
LIBSRCS += casCtx.cc
LIBSRCS += casEventMask.cc
LIBSRCS += ioBlocked.cc
LIBSRCS += casBufferFactory.cc
LIBSRCS += caServerOS.cc
LIBSRCS += casIntfOS.cc

View File

@@ -101,7 +101,7 @@ epicsTimerNotify::expireStatus
exPV::expire ( const epicsTime & /*currentTime*/ ) // X aCC 361
{
this->scan();
if ( this->scanOn ) {
if ( this->scanOn && this->getScanPeriod() > 0.0 ) {
return expireStatus ( restart, this->getScanPeriod() );
}
else {
@@ -130,7 +130,8 @@ caStatus exPV::interestRegister()
this->interest = true;
if ( this->scanOn && this->getScanPeriod() < this->timer.getExpireDelay() ) {
if ( this->scanOn && this->getScanPeriod() > 0.0 &&
this->getScanPeriod() < this->timer.getExpireDelay() ) {
this->timer.start ( *this, this->getScanPeriod() );
}

View File

@@ -190,7 +190,7 @@ caStatus exVectorPV::updateValue(smartConstGDDPointer pValueIn)
return S_casApp_outOfBounds;
}
aitFloat32 *pF;
aitFloat64 *pF;
int gddStatus;
//
@@ -214,7 +214,7 @@ caStatus exVectorPV::updateValue(smartConstGDDPointer pValueIn)
//
// allocate array buffer
//
pF = new aitFloat32 [this->info.getElementCount()];
pF = new aitFloat64 [this->info.getElementCount()];
if (!pF) {
return S_casApp_noMemory;
}

View File

@@ -1,4 +1,6 @@
#include "envDefs.h"
#include "exServer.h"
#include "fdManager.h"
@@ -15,12 +17,13 @@ extern int main (int argc, const char **argv)
char pvPrefix[128] = "";
unsigned aliasCount = 1u;
unsigned scanOnAsUnsignedInt = true;
char arraySize[64] = "";
bool scanOn;
bool forever = true;
int i;
for (i=1; i<argc; i++) {
if (sscanf(argv[i], "-d\t%u", &debugLevel)==1) {
for ( i = 1; i < argc; i++ ) {
if (sscanf(argv[i], "-d %u", &debugLevel)==1) {
continue;
}
if (sscanf(argv[i],"-t %lf", &executionTime)==1) {
@@ -36,14 +39,23 @@ extern int main (int argc, const char **argv)
if (sscanf(argv[i],"-s %u", &scanOnAsUnsignedInt)==1) {
continue;
}
if (sscanf(argv[i],"-a %63s", arraySize)==1) {
continue;
}
printf ("\"%s\"?\n", argv[i]);
printf (
"usage: %s [-d<debug level> -t<execution time> -p<PV name prefix> -c<numbered alias count>] -s<1=scan on (default), 0=scan off]>\n",
"usage: %s [-d<debug level> -t<execution time> -p<PV name prefix> "
"-c<numbered alias count> -s<1=scan on (default), 0=scan off]> "
"-a<max array size>]\n",
argv[0]);
return (1);
}
if ( arraySize[0] != '\0' ) {
epicsEnvSet ( "EPICS_CA_MAX_ARRAY_BYTES", arraySize );
}
if (scanOnAsUnsignedInt) {
scanOn = true;
}

View File

@@ -125,11 +125,19 @@ casDGIntfIO::casDGIntfIO (caServerI &serverIn, const caNetAddr &addr,
serverBCastAddr.ia = pAddr->addr.ia;
serverBCastAddr.ia.sin_port = htons (this->dgPort);
if (autoBeaconAddr) {
forcePort (&BCastAddrList,beaconPort);
if ( autoBeaconAddr ) {
forcePort ( &BCastAddrList, beaconPort );
}
else {
ellFree (&BCastAddrList);
// avoid use of ellFree because problems on windows occur if the
// free is in a different DLL than the malloc
ELLNODE * nnode = BCastAddrList.node.next;
while ( nnode )
{
ELLNODE * pnode = nnode;
nnode = nnode->next;
free ( pnode );
}
}
}
@@ -236,7 +244,15 @@ casDGIntfIO::~casDGIntfIO()
socket_close ( this->beaconSock );
}
ellFree ( &this->beaconAddrList );
// avoid use of ellFree because problems on windows occur if the
// free is in a different DLL than the malloc
ELLNODE * nnode = this->beaconAddrList.node.next;
while ( nnode )
{
ELLNODE * pnode = nnode;
nnode = nnode->next;
free ( pnode );
}
osiSockRelease ();
}
@@ -270,9 +286,9 @@ void casDGIntfIO::xSetNonBlocking()
//
// casDGIntfIO::osdRecv()
//
inBuf::fillCondition
casDGIntfIO::osdRecv(char *pBufIn, bufSizeT size, // X aCC 361
fillParameter parm, bufSizeT &actualSize, caNetAddr &fromOut)
inBufClient::fillCondition
casDGIntfIO::osdRecv ( char * pBufIn, bufSizeT size, // X aCC 361
fillParameter parm, bufSizeT & actualSize, caNetAddr & fromOut )
{
int status;
osiSocklen_t addrSize;
@@ -309,9 +325,9 @@ casDGIntfIO::osdRecv(char *pBufIn, bufSizeT size, // X aCC 361
//
// casDGIntfIO::osdSend()
//
outBuf::flushCondition
casDGIntfIO::osdSend (const char *pBufIn, bufSizeT size, // X aCC 361
const caNetAddr &to)
outBufClient::flushCondition
casDGIntfIO::osdSend ( const char * pBufIn, bufSizeT size, // X aCC 361
const caNetAddr & to )
{
int status;
@@ -323,7 +339,7 @@ casDGIntfIO::osdSend (const char *pBufIn, bufSizeT size, // X aCC 361
&dest, sizeof(dest));
if (status>=0) {
assert ( size == (unsigned) status );
return outBuf::flushProgress;
return outBufClient::flushProgress;
}
else {
int errnoCpy = SOCKERRNO;
@@ -334,7 +350,7 @@ casDGIntfIO::osdSend (const char *pBufIn, bufSizeT size, // X aCC 361
"CAS: UDP socket send to \"%s\" failed because \"%s\"\n",
buf, SOCKERRSTR(errnoCpy));
}
return outBuf::flushNone;
return outBufClient::flushNone;
}
}
@@ -366,8 +382,8 @@ bufSizeT casDGIntfIO::incomingBytesPresent () const // X aCC 361
//
// casDGIntfIO::sendBeaconIO()
//
void casDGIntfIO::sendBeaconIO (char &msg, unsigned length,
aitUint16 &portField, aitUint32 &addrField)
void casDGIntfIO::sendBeaconIO ( char &msg, unsigned length,
aitUint16 & portField, aitUint32 & addrField )
{
caNetAddr addr = this->serverAddress ();
struct sockaddr_in inetAddr = addr.getSockIP();

View File

@@ -36,11 +36,11 @@ public:
aitUint16 &portField, aitUint32 &addrField);
casIOState state () const;
outBuf::flushCondition osdSend (const char *pBuf, bufSizeT nBytesReq,
const caNetAddr &addr);
inBuf::fillCondition osdRecv (char *pBuf, bufSizeT nBytesReq,
fillParameter parm, bufSizeT &nBytesActual, caNetAddr &addr);
virtual void show (unsigned level) const;
outBufClient::flushCondition osdSend ( const char * pBuf, bufSizeT nBytesReq,
const caNetAddr & addr);
inBufClient::fillCondition osdRecv ( char * pBuf, bufSizeT nBytesReq,
inBufClient::fillParameter parm, bufSizeT & nBytesActual, caNetAddr & addr );
virtual void show ( unsigned level ) const;
static bufSizeT optimumOutBufferSize ();
static bufSizeT optimumInBufferSize ();
@@ -76,12 +76,12 @@ public:
void xSetNonBlocking();
casIOState state() const;
void clientHostName (char *pBuf, unsigned bufSize) const;
void hostName (char *pBuf, unsigned bufSize) const;
outBuf::flushCondition osdSend (const char *pBuf, bufSizeT nBytesReq,
bufSizeT &nBytesActual);
inBuf::fillCondition osdRecv (char *pBuf, bufSizeT nBytesReq,
bufSizeT &nBytesActual);
outBufClient::flushCondition osdSend ( const char *pBuf, bufSizeT nBytesReq,
bufSizeT & nBytesActual );
inBufClient::fillCondition osdRecv ( char *pBuf, bufSizeT nBytesReq,
bufSizeT & nBytesActual );
xBlockingStatus blockingState() const;

View File

@@ -179,7 +179,7 @@ casStreamOS *casIntfIO::newStreamClient(caServerI &cas) const
if ( cas.getDebugLevel()>0u) {
char pName[64u];
pOS->clientHostName (pName, sizeof (pName));
pOS->hostName (pName, sizeof (pName));
errlogPrintf("CAS: allocated client object for \"%s\"\n", pName);
}
}

View File

@@ -5,6 +5,9 @@
//
//
// $Log$
// Revision 1.23 2002/02/25 15:19:51 lange
// All HPUX warnings fixed.
//
// Revision 1.22 2001/07/11 23:31:45 jhill
// adapt to new timer API
//
@@ -175,14 +178,14 @@ casStreamIO::~casStreamIO()
//
// casStreamIO::osdSend()
//
outBuf::flushCondition casStreamIO::osdSend (const char *pInBuf, bufSizeT nBytesReq,
bufSizeT &nBytesActual)
outBufClient::flushCondition casStreamIO::osdSend ( const char *pInBuf, bufSizeT nBytesReq,
bufSizeT &nBytesActual )
{
int status;
status = send (this->sock, (char *) pInBuf, nBytesReq, 0);
if (status == 0) {
return outBuf::flushDisconnect;
return outBufClient::flushDisconnect;
}
else if (status<0) {
int anerrno = SOCKERRNO;
@@ -192,25 +195,27 @@ outBuf::flushCondition casStreamIO::osdSend (const char *pInBuf, bufSizeT nBytes
int errnoCpy = SOCKERRNO;
ipAddrToA (&this->addr, buf, sizeof(buf));
errlogPrintf(
if ( errnoCpy != SOCK_ECONNRESET ) {
errlogPrintf(
"CAS: TCP socket send to \"%s\" failed because \"%s\"\n",
buf, SOCKERRSTR(errnoCpy));
return outBuf::flushDisconnect;
buf, SOCKERRSTR(errnoCpy));
}
return outBufClient::flushDisconnect;
}
else {
return outBuf::flushNone;
return outBufClient::flushNone;
}
}
nBytesActual = (bufSizeT) status;
return outBuf::flushProgress;
return outBufClient::flushProgress;
}
//
// casStreamIO::osdRecv()
//
inBuf::fillCondition
casStreamIO::osdRecv (char *pInBuf, bufSizeT nBytes, // X aCC 361
bufSizeT &nBytesActual)
inBufClient::fillCondition
casStreamIO::osdRecv ( char * pInBuf, bufSizeT nBytes, // X aCC 361
bufSizeT & nBytesActual )
{
int nchars;
@@ -226,10 +231,12 @@ casStreamIO::osdRecv (char *pInBuf, bufSizeT nBytes, // X aCC 361
return casFillNone;
}
else {
ipAddrToA (&this->addr, buf, sizeof(buf));
errlogPrintf(
"CAS: client %s disconnected because \"%s\"\n",
buf, SOCKERRSTR(myerrno));
if ( myerrno != SOCK_ECONNRESET ) {
ipAddrToA (&this->addr, buf, sizeof(buf));
errlogPrintf(
"CAS: client %s disconnected because \"%s\"\n",
buf, SOCKERRSTR(myerrno));
}
return casFillDisconnect;
}
}
@@ -309,9 +316,9 @@ bufSizeT casStreamIO::incomingBytesPresent() const // X aCC 361
}
//
// casStreamIO::clientHostName()
// casStreamIO::hostName()
//
void casStreamIO::clientHostName (char *pInBuf, unsigned bufSizeIn) const
void casStreamIO::hostName (char *pInBuf, unsigned bufSizeIn) const
{
ipAddrToA (&this->addr, pInBuf, bufSizeIn);
}