drop support for buggy cygnus-2.7.2 compiler
This commit is contained in:
@ -637,11 +637,9 @@ bool AsynDriverInterface::
|
|||||||
writeRequest(const void* output, size_t size,
|
writeRequest(const void* output, size_t size,
|
||||||
unsigned long writeTimeout_ms)
|
unsigned long writeTimeout_ms)
|
||||||
{
|
{
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::writeRequest(%s, \"%s\", %ld msec)\n",
|
debug("AsynDriverInterface::writeRequest(%s, \"%s\", %ld msec)\n",
|
||||||
clientName(), StreamBuffer(output, size).expand()(),
|
clientName(), StreamBuffer(output, size).expand()(),
|
||||||
writeTimeout_ms);
|
writeTimeout_ms);
|
||||||
#endif
|
|
||||||
|
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
outputBuffer = (char*)output;
|
outputBuffer = (char*)output;
|
||||||
@ -684,11 +682,9 @@ writeHandler()
|
|||||||
status = pasynOctet->read(pvtOctet, pasynUser,
|
status = pasynOctet->read(pvtOctet, pasynUser,
|
||||||
buffer, sizeof(buffer), &received, &eomReason);
|
buffer, sizeof(buffer), &received, &eomReason);
|
||||||
if (status == asynError || received == 0) break;
|
if (status == asynError || received == 0) break;
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
if (received) debug("AsynDriverInterface::writeHandler(%s): "
|
if (received) debug("AsynDriverInterface::writeHandler(%s): "
|
||||||
"flushing %" Z "u bytes: \"%s\"\n",
|
"flushing %" Z "u bytes: \"%s\"\n",
|
||||||
clientName(), received, StreamBuffer(buffer, received).expand()());
|
clientName(), received, StreamBuffer(buffer, received).expand()());
|
||||||
#endif
|
|
||||||
} while (status == asynSuccess);
|
} while (status == asynSuccess);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -726,7 +722,6 @@ writeHandler()
|
|||||||
pasynUser->errorMessage[0] = 0;
|
pasynUser->errorMessage[0] = 0;
|
||||||
status = pasynOctet->write(pvtOctet, pasynUser,
|
status = pasynOctet->write(pvtOctet, pasynUser,
|
||||||
outputBuffer, outputSize, &written);
|
outputBuffer, outputSize, &written);
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::writeHandler(%s): "
|
debug("AsynDriverInterface::writeHandler(%s): "
|
||||||
"write(..., \"%s\", outputSize=%" Z "u, written=%" Z "u) "
|
"write(..., \"%s\", outputSize=%" Z "u, written=%" Z "u) "
|
||||||
"[timeout=%g sec] = %s (%s)\n",
|
"[timeout=%g sec] = %s (%s)\n",
|
||||||
@ -735,7 +730,6 @@ writeHandler()
|
|||||||
outputSize, written,
|
outputSize, written,
|
||||||
pasynUser->timeout, asynStatusStr[status],
|
pasynUser->timeout, asynStatusStr[status],
|
||||||
pasynUser->errorMessage);
|
pasynUser->errorMessage);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (oldeoslen >= 0) // restore asyn terminator
|
if (oldeoslen >= 0) // restore asyn terminator
|
||||||
{
|
{
|
||||||
@ -906,7 +900,6 @@ readHandler()
|
|||||||
if (pasynOctet->setInputEos(pvtOctet, pasynUser,
|
if (pasynOctet->setInputEos(pvtOctet, pasynUser,
|
||||||
deveos, (int)deveoslen) == asynSuccess)
|
deveos, (int)deveoslen) == asynSuccess)
|
||||||
{
|
{
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
if (ioAction != AsyncRead)
|
if (ioAction != AsyncRead)
|
||||||
{
|
{
|
||||||
debug("AsynDriverInterface::readHandler(%s) "
|
debug("AsynDriverInterface::readHandler(%s) "
|
||||||
@ -915,7 +908,6 @@ readHandler()
|
|||||||
StreamBuffer(oldeos, oldeoslen).expand()(),
|
StreamBuffer(oldeos, oldeoslen).expand()(),
|
||||||
StreamBuffer(deveos, deveoslen).expand()());
|
StreamBuffer(deveos, deveoslen).expand()());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
deveos++; deveoslen--;
|
deveos++; deveoslen--;
|
||||||
@ -978,14 +970,13 @@ readHandler()
|
|||||||
status = pasynOctet->read(pvtOctet, pasynUser,
|
status = pasynOctet->read(pvtOctet, pasynUser,
|
||||||
buffer, bytesToRead, &received, &eomReason);
|
buffer, bytesToRead, &received, &eomReason);
|
||||||
// Even though received is size_t I have seen (size_t)-1 here!
|
// Even though received is size_t I have seen (size_t)-1 here!
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::readHandler(%s): "
|
debug("AsynDriverInterface::readHandler(%s): "
|
||||||
"read returned %s: ioAction=%s received=%" Z "d, "
|
"read returned %s: ioAction=%s received=%" Z "d, "
|
||||||
"eomReason=%s, buffer=\"%s\"\n",
|
"eomReason=%s, buffer=\"%s\"\n",
|
||||||
clientName(), asynStatusStr[status], ioActionStr[ioAction],
|
clientName(), asynStatusStr[status], ioActionStr[ioAction],
|
||||||
received,eomReasonStr[eomReason&0x7],
|
received,eomReasonStr[eomReason&0x7],
|
||||||
StreamBuffer(buffer, received).expand()());
|
StreamBuffer(buffer, received).expand()());
|
||||||
#endif
|
|
||||||
pasynManager->isConnected(pasynUser, &connected);
|
pasynManager->isConnected(pasynUser, &connected);
|
||||||
debug("AsynDriverInterface::readHandler(%s): "
|
debug("AsynDriverInterface::readHandler(%s): "
|
||||||
"device is now %sconnected\n",
|
"device is now %sconnected\n",
|
||||||
@ -1009,14 +1000,12 @@ readHandler()
|
|||||||
case asynSuccess:
|
case asynSuccess:
|
||||||
if (ioAction != Read)
|
if (ioAction != Read)
|
||||||
{
|
{
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::readHandler(%s): "
|
debug("AsynDriverInterface::readHandler(%s): "
|
||||||
"AsyncRead poll: received %" Z "d of %" Z "u bytes \"%s\" "
|
"AsyncRead poll: received %" Z "d of %" Z "u bytes \"%s\" "
|
||||||
"eomReason=%s [data ignored]\n",
|
"eomReason=%s [data ignored]\n",
|
||||||
clientName(), received, bytesToRead,
|
clientName(), received, bytesToRead,
|
||||||
StreamBuffer(buffer, received).expand()(),
|
StreamBuffer(buffer, received).expand()(),
|
||||||
eomReasonStr[eomReason&0x7]);
|
eomReasonStr[eomReason&0x7]);
|
||||||
#endif
|
|
||||||
// ignore what we got from here.
|
// ignore what we got from here.
|
||||||
// input was already handeled by asynReadHandler()
|
// input was already handeled by asynReadHandler()
|
||||||
|
|
||||||
@ -1024,14 +1013,12 @@ readHandler()
|
|||||||
readMore = -1;
|
readMore = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::readHandler(%s): "
|
debug("AsynDriverInterface::readHandler(%s): "
|
||||||
"received %" Z "d of %" Z "u bytes \"%s\" "
|
"received %" Z "d of %" Z "u bytes \"%s\" "
|
||||||
"eomReason=%s\n",
|
"eomReason=%s\n",
|
||||||
clientName(), received, bytesToRead,
|
clientName(), received, bytesToRead,
|
||||||
StreamBuffer(buffer, received).expand()(),
|
StreamBuffer(buffer, received).expand()(),
|
||||||
eomReasonStr[eomReason&0x7]);
|
eomReasonStr[eomReason&0x7]);
|
||||||
#endif
|
|
||||||
// asynOctet->read() cuts off terminator, but:
|
// asynOctet->read() cuts off terminator, but:
|
||||||
// If stream has set a terminator which is longer
|
// If stream has set a terminator which is longer
|
||||||
// than what the device (e.g. GPIB) can handle,
|
// than what the device (e.g. GPIB) can handle,
|
||||||
@ -1087,14 +1074,12 @@ readHandler()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// read timeout
|
// read timeout
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::readHandler(%s): "
|
debug("AsynDriverInterface::readHandler(%s): "
|
||||||
"ioAction=%s, timeout [%g sec] "
|
"ioAction=%s, timeout [%g sec] "
|
||||||
"after %" Z "d of %" Z "u bytes \"%s\"\n",
|
"after %" Z "d of %" Z "u bytes \"%s\"\n",
|
||||||
clientName(), ioActionStr[ioAction], pasynUser->timeout,
|
clientName(), ioActionStr[ioAction], pasynUser->timeout,
|
||||||
received, bytesToRead,
|
received, bytesToRead,
|
||||||
StreamBuffer(buffer, received).expand()());
|
StreamBuffer(buffer, received).expand()());
|
||||||
#endif
|
|
||||||
if (ioAction == AsyncRead || ioAction == AsyncReadMore)
|
if (ioAction == AsyncRead || ioAction == AsyncReadMore)
|
||||||
{
|
{
|
||||||
// we already got the data from asynReadHandler()
|
// we already got the data from asynReadHandler()
|
||||||
@ -1165,12 +1150,10 @@ readHandler()
|
|||||||
{
|
{
|
||||||
pasynOctet->setInputEos(pvtOctet, pasynUser,
|
pasynOctet->setInputEos(pvtOctet, pasynUser,
|
||||||
oldeos, oldeoslen);
|
oldeos, oldeoslen);
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::readHandler(%s) "
|
debug("AsynDriverInterface::readHandler(%s) "
|
||||||
"input EOS restored to \"%s\"\n",
|
"input EOS restored to \"%s\"\n",
|
||||||
clientName(),
|
clientName(),
|
||||||
StreamBuffer(oldeos, oldeoslen).expand()());
|
StreamBuffer(oldeos, oldeoslen).expand()());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1206,12 +1189,10 @@ asynReadHandler(const char *buffer, size_t received, int eomReason)
|
|||||||
// Thus, it is sufficient to mark the request as obsolete by
|
// Thus, it is sufficient to mark the request as obsolete by
|
||||||
// setting ioAction=None. See handleRequest().
|
// setting ioAction=None. See handleRequest().
|
||||||
|
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("AsynDriverInterface::asynReadHandler(%s, buffer=\"%s\", "
|
debug("AsynDriverInterface::asynReadHandler(%s, buffer=\"%s\", "
|
||||||
"received=%ld eomReason=%s) ioAction=%s\n",
|
"received=%ld eomReason=%s) ioAction=%s\n",
|
||||||
clientName(), StreamBuffer(buffer, received).expand()(),
|
clientName(), StreamBuffer(buffer, received).expand()(),
|
||||||
(long)received, eomReasonStr[eomReason&0x7], ioActionStr[ioAction]);
|
(long)received, eomReasonStr[eomReason&0x7], ioActionStr[ioAction]);
|
||||||
#endif
|
|
||||||
|
|
||||||
ioAction = None;
|
ioAction = None;
|
||||||
ssize_t readMore = 1;
|
ssize_t readMore = 1;
|
||||||
|
@ -674,10 +674,8 @@ normal_format:
|
|||||||
StreamFormat fmt = extract<StreamFormat>(commandIndex);
|
StreamFormat fmt = extract<StreamFormat>(commandIndex);
|
||||||
fmt.info = commandIndex; // point to info string
|
fmt.info = commandIndex; // point to info string
|
||||||
commandIndex += fmt.infolen;
|
commandIndex += fmt.infolen;
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("StreamCore::formatOutput(%s): format = %%%s\n",
|
debug("StreamCore::formatOutput(%s): format = %%%s\n",
|
||||||
name(), StreamBuffer(formatstring, formatstringlen).expand()());
|
name(), StreamBuffer(formatstring, formatstringlen).expand()());
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fmt.type == pseudo_format)
|
if (fmt.type == pseudo_format)
|
||||||
{
|
{
|
||||||
@ -950,22 +948,15 @@ readCallback(StreamIoStatus status,
|
|||||||
MutexLock lock(this);
|
MutexLock lock(this);
|
||||||
lastInputStatus = status;
|
lastInputStatus = status;
|
||||||
|
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("StreamCore::readCallback(%s, status=%s input=\"%s\", size=%" Z "u)\n",
|
debug("StreamCore::readCallback(%s, status=%s input=\"%s\", size=%" Z "u)\n",
|
||||||
name(), StreamIoStatusStr[status],
|
name(), StreamIoStatusStr[status],
|
||||||
StreamBuffer(input, size).expand()(), size);
|
StreamBuffer(input, size).expand()(), size);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(flags & AcceptInput))
|
if (!(flags & AcceptInput))
|
||||||
{
|
{
|
||||||
#ifdef NO_TEMPORARY
|
|
||||||
error("StreamCore::readCallback(%s, %s) called unexpectedly\n",
|
|
||||||
name(), StreamIoStatusStr[status]);
|
|
||||||
#else
|
|
||||||
error("StreamCore::readCallback(%s, %s, \"%s\") called unexpectedly\n",
|
error("StreamCore::readCallback(%s, %s, \"%s\") called unexpectedly\n",
|
||||||
name(), StreamIoStatusStr[status],
|
name(), StreamIoStatusStr[status],
|
||||||
StreamBuffer(input, size).expand()());
|
StreamBuffer(input, size).expand()());
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//// flags &= ~AcceptInput;
|
//// flags &= ~AcceptInput;
|
||||||
@ -1206,10 +1197,8 @@ normal_format:
|
|||||||
StreamFormat fmt = extract<StreamFormat>(commandIndex);
|
StreamFormat fmt = extract<StreamFormat>(commandIndex);
|
||||||
fmt.info = commandIndex; // point to info string
|
fmt.info = commandIndex; // point to info string
|
||||||
commandIndex += fmt.infolen;
|
commandIndex += fmt.infolen;
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("StreamCore::matchInput(%s): format = \"%%%s\"\n",
|
debug("StreamCore::matchInput(%s): format = \"%%%s\"\n",
|
||||||
name(), formatstring());
|
name(), formatstring());
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fmt.flags & skip_flag || fmt.type == pseudo_format)
|
if (fmt.flags & skip_flag || fmt.type == pseudo_format)
|
||||||
{
|
{
|
||||||
@ -1277,11 +1266,9 @@ normal_format:
|
|||||||
name(), formatstring());
|
name(), formatstring());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("StreamCore::matchInput(%s): compare \"%s\" with \"%s\"\n",
|
debug("StreamCore::matchInput(%s): compare \"%s\" with \"%s\"\n",
|
||||||
name(), inputLine.expand(consumedInput,
|
name(), inputLine.expand(consumedInput,
|
||||||
outputLine.length())(), outputLine.expand()());
|
outputLine.length())(), outputLine.expand()());
|
||||||
#endif
|
|
||||||
if (inputLine.length() - consumedInput < outputLine.length())
|
if (inputLine.length() - consumedInput < outputLine.length())
|
||||||
{
|
{
|
||||||
if (!(flags & AsyncMode) && onMismatch[0] != in_cmd)
|
if (!(flags & AsyncMode) && onMismatch[0] != in_cmd)
|
||||||
@ -1353,10 +1340,8 @@ normal_format:
|
|||||||
name(),
|
name(),
|
||||||
inputLine.length() > 20 ? "..." : "",
|
inputLine.length() > 20 ? "..." : "",
|
||||||
inputLine.expand(-20)());
|
inputLine.expand(-20)());
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
error("No match for \"%s\"\n",
|
error("No match for \"%s\"\n",
|
||||||
StreamBuffer(commandIndex-1,i+1).expand()());
|
StreamBuffer(commandIndex-1,i+1).expand()());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1376,12 +1361,10 @@ normal_format:
|
|||||||
command,
|
command,
|
||||||
inputLine[consumedInput]);
|
inputLine[consumedInput]);
|
||||||
|
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
error("%s: got \"%s\" where \"%s\" was expected\n",
|
error("%s: got \"%s\" where \"%s\" was expected\n",
|
||||||
name(),
|
name(),
|
||||||
inputLine.expand(consumedInput, 20)(),
|
inputLine.expand(consumedInput, 20)(),
|
||||||
StreamBuffer(commandIndex-1,i+1).expand()());
|
StreamBuffer(commandIndex-1,i+1).expand()());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1553,11 +1536,7 @@ scanValue(const StreamFormat& fmt, char* value, size_t& size)
|
|||||||
}
|
}
|
||||||
debug("StreamCore::scanValue(%s, format=%%%c, char*, size=%" Z "d) input=\"%s\" value=\"%s\"\n",
|
debug("StreamCore::scanValue(%s, format=%%%c, char*, size=%" Z "d) input=\"%s\" value=\"%s\"\n",
|
||||||
name(), fmt.conv, size, inputLine.expand(consumedInput)(),
|
name(), fmt.conv, size, inputLine.expand(consumedInput)(),
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
StreamBuffer(value, size).expand()());
|
StreamBuffer(value, size).expand()());
|
||||||
#else
|
|
||||||
value);
|
|
||||||
#endif
|
|
||||||
if (fmt.flags & fix_width_flag && consumed != (ssize_t)fmt.width) return -1;
|
if (fmt.flags & fix_width_flag && consumed != (ssize_t)fmt.width) return -1;
|
||||||
if ((size_t)consumed > inputLine.length()-consumedInput) return -1;
|
if ((size_t)consumed > inputLine.length()-consumedInput) return -1;
|
||||||
flags |= GotValue;
|
flags |= GotValue;
|
||||||
|
@ -63,9 +63,4 @@ StreamDebugObject(const char* file, int line)
|
|||||||
#define error StreamError
|
#define error StreamError
|
||||||
#define debug (!streamDebug)?0:StreamDebugObject(__FILE__,__LINE__).print
|
#define debug (!streamDebug)?0:StreamDebugObject(__FILE__,__LINE__).print
|
||||||
|
|
||||||
#if (__GNUC__ == 2 && __GNUC_MINOR__ == 7)
|
|
||||||
/* Bug in cygnus-2.7.2 compiler: temporary objects crash the compiler */
|
|
||||||
#define NO_TEMPORARY
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1486,10 +1486,8 @@ compileFormat(StreamBuffer& buffer, const char*& formatstr,
|
|||||||
// add formatstr for debug purpose
|
// add formatstr for debug purpose
|
||||||
buffer.append(formatstart, source-formatstart).append(eos);
|
buffer.append(formatstart, source-formatstart).append(eos);
|
||||||
|
|
||||||
#ifndef NO_TEMPORARY
|
|
||||||
debug("StreamProtocolParser::Protocol::compileFormat: formatstring=\"%s\"\n",
|
debug("StreamProtocolParser::Protocol::compileFormat: formatstring=\"%s\"\n",
|
||||||
StreamBuffer(formatstart, source-formatstart).expand()());
|
StreamBuffer(formatstart, source-formatstart).expand()());
|
||||||
#endif
|
|
||||||
|
|
||||||
// add streamFormat structure and info
|
// add streamFormat structure and info
|
||||||
buffer.append(&streamFormat, sizeof(streamFormat));
|
buffer.append(&streamFormat, sizeof(streamFormat));
|
||||||
|
Reference in New Issue
Block a user