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