merged with github/master
This commit is contained in:
@ -171,6 +171,7 @@ class AsynDriverInterface : StreamBusInterface
|
||||
epicsTimerQueueActive* timerQueue;
|
||||
epicsTimer* timer;
|
||||
#endif
|
||||
asynStatus previousAsynStatus;
|
||||
|
||||
AsynDriverInterface(Client* client);
|
||||
~AsynDriverInterface();
|
||||
@ -229,6 +230,7 @@ class AsynDriverInterface : StreamBusInterface
|
||||
timer->cancel();
|
||||
#endif
|
||||
}
|
||||
void reportAsynStatus(asynStatus status, const char *name);
|
||||
|
||||
// asynUser callback functions
|
||||
friend void handleRequest(asynUser*);
|
||||
@ -262,6 +264,7 @@ AsynDriverInterface(Client* client) : StreamBusInterface(client)
|
||||
eventMask = 0;
|
||||
receivedEvent = 0;
|
||||
peeksize = 1;
|
||||
previousAsynStatus = asynSuccess;
|
||||
debug ("AsynDriverInterface(%s) createAsynUser\n", client->name());
|
||||
pasynUser = pasynManager->createAsynUser(handleRequest,
|
||||
handleTimeout);
|
||||
@ -490,6 +493,19 @@ connectToBus(const char* portname, int addr)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AsynDriverInterface::
|
||||
reportAsynStatus(asynStatus status, const char *name)
|
||||
{
|
||||
if (previousAsynStatus != status) {
|
||||
previousAsynStatus = status;
|
||||
if (status == asynSuccess) {
|
||||
error("%s %s: status returned to normal\n", clientName(), name);
|
||||
} else {
|
||||
error("%s %s: %s\n", clientName(), name, pasynUser->errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// interface function: we want exclusive access to the device
|
||||
// lockTimeout_ms=0 means "block here" (used in @init)
|
||||
bool AsynDriverInterface::
|
||||
@ -503,16 +519,11 @@ lockRequest(unsigned long lockTimeout_ms)
|
||||
ioAction = Lock;
|
||||
status = pasynManager->queueRequest(pasynUser,
|
||||
priority(), lockTimeout);
|
||||
if (status != asynSuccess)
|
||||
{
|
||||
error("%s lockRequest: pasynManager->queueRequest() failed: %s\n",
|
||||
clientName(), pasynUser->errorMessage);
|
||||
return false;
|
||||
}
|
||||
reportAsynStatus(status, "lockRequest: pasynManager->queueRequest");
|
||||
return (status == asynSuccess);
|
||||
// continues with:
|
||||
// handleRequest() -> lockHandler() -> lockCallback()
|
||||
// or handleTimeout() -> lockCallback(StreamIoTimeout)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AsynDriverInterface::
|
||||
@ -562,22 +573,12 @@ connectToAsynPort()
|
||||
clientName(), connected ? "already" : "not yet");
|
||||
if (!connected)
|
||||
{
|
||||
printf ("%s: AsynDriverInterface::connectToAsynPort: "
|
||||
"pasynCommon->connect(%p, %p)\n",
|
||||
clientName(), pvtCommon, pasynUser);
|
||||
status = pasynCommon->connect(pvtCommon, pasynUser);
|
||||
printf ("%s: AsynDriverInterface::connectToAsynPort: "
|
||||
"pasynCommon->connect(%p, %p) = %s\n",
|
||||
clientName(), pvtCommon, pasynUser, asynStatusStr[status]);
|
||||
debug("AsynDriverInterface::connectToAsynPort(%s): "
|
||||
"status=%s\n",
|
||||
clientName(), asynStatusStr[status]);
|
||||
if (status != asynSuccess)
|
||||
{
|
||||
error("%s connectToAsynPort: pasynCommon->connect() failed: %s\n",
|
||||
clientName(), pasynUser->errorMessage);
|
||||
return false;
|
||||
}
|
||||
reportAsynStatus(status, "connectToAsynPort: pasynCommon->connect");
|
||||
return (status == asynSuccess);
|
||||
}
|
||||
// We probably should set REN=1 prior to sending but this
|
||||
// seems to hang up the device every other time.
|
||||
@ -644,16 +645,11 @@ writeRequest(const void* output, size_t size,
|
||||
ioAction = Write;
|
||||
status = pasynManager->queueRequest(pasynUser, priority(),
|
||||
writeTimeout);
|
||||
if (status != asynSuccess)
|
||||
{
|
||||
error("%s writeRequest: pasynManager->queueRequest() failed: %s\n",
|
||||
clientName(), pasynUser->errorMessage);
|
||||
return false;
|
||||
}
|
||||
reportAsynStatus(status, "writeRequest: pasynManager->queueRequest");
|
||||
return (status == asynSuccess);
|
||||
// continues with:
|
||||
// handleRequest() -> writeHandler() -> lockCallback()
|
||||
// or handleTimeout() -> writeCallback(StreamIoTimeout)
|
||||
return true;
|
||||
}
|
||||
|
||||
// now, we can write (called by asynManager)
|
||||
@ -667,25 +663,28 @@ writeHandler()
|
||||
|
||||
pasynUser->timeout = 0;
|
||||
if (!pasynGpib)
|
||||
// discard any early input, but forward it to potential async records
|
||||
// thus do not use pasynOctet->flush()
|
||||
// unfortunately we cannot do this with GPIB because addressing a device as talker
|
||||
// when it has nothing to say is an error. Also timeout=0 does not help here (would need
|
||||
// a change in asynGPIB), thus use flush() for GPIB.
|
||||
do {
|
||||
char buffer [256];
|
||||
size_t received = 0;
|
||||
int eomReason = 0;
|
||||
debug("AsynDriverInterface::writeHandler(%s): reading old input\n",
|
||||
clientName());
|
||||
status = pasynOctet->read(pvtOctet, pasynUser,
|
||||
buffer, sizeof(buffer), &received, &eomReason);
|
||||
if (status == asynError || received == 0) break;
|
||||
{
|
||||
// discard any early input, but forward it to potential async records
|
||||
// thus do not use pasynOctet->flush()
|
||||
// unfortunately we cannot do this with GPIB because addressing a device as talker
|
||||
// when it has nothing to say is an error. Also timeout=0 does not help here
|
||||
// (would need a change in asynGPIB), thus use flush() for GPIB.
|
||||
do {
|
||||
char buffer [256];
|
||||
size_t received = 0;
|
||||
int eomReason = 0;
|
||||
debug("AsynDriverInterface::writeHandler(%s): reading old input\n",
|
||||
clientName());
|
||||
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 %ld bytes: \"%s\"\n",
|
||||
clientName(), (long)received, StreamBuffer(buffer, received).expand()());
|
||||
if (received) debug("AsynDriverInterface::writeHandler(%s): "
|
||||
"flushing %ld bytes: \"%s\"\n",
|
||||
clientName(), (long)received, StreamBuffer(buffer, received).expand()());
|
||||
#endif
|
||||
} while (status == asynSuccess);
|
||||
} while (status == asynSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("AsynDriverInterface::writeHandler(%s): flushing old input\n",
|
||||
@ -760,11 +759,9 @@ writeHandler()
|
||||
{
|
||||
status = pasynManager->queueRequest(pasynUser,
|
||||
priority(), lockTimeout);
|
||||
reportAsynStatus(status, "writeHandler: pasynManager->queueRequest");
|
||||
if (status != asynSuccess)
|
||||
{
|
||||
error("%s writeHandler: "
|
||||
"pasynManager->queueRequest() failed: %s\n",
|
||||
clientName(), pasynUser->errorMessage);
|
||||
writeCallback(StreamIoFault);
|
||||
}
|
||||
// continues with:
|
||||
@ -844,6 +841,10 @@ readRequest(unsigned long replyTimeout_ms, unsigned long readTimeout_ms,
|
||||
clientName(), priority(), queueTimeout,
|
||||
asynStatusStr[status], async? "true" : "false",
|
||||
status!=asynSuccess ? pasynUser->errorMessage : "");
|
||||
if (!async)
|
||||
{
|
||||
reportAsynStatus(status, "readRequest: pasynManager->queueRequest");
|
||||
}
|
||||
if (status != asynSuccess)
|
||||
{
|
||||
// Not queued for some reason (e.g. disconnected / already queued)
|
||||
@ -853,8 +854,6 @@ readRequest(unsigned long replyTimeout_ms, unsigned long readTimeout_ms,
|
||||
startTimer(replyTimeout);
|
||||
return true;
|
||||
}
|
||||
error("%s readRequest: pasynManager->queueRequest() failed: %s\n",
|
||||
clientName(), pasynUser->errorMessage);
|
||||
return false;
|
||||
}
|
||||
// continues with:
|
||||
@ -1428,16 +1427,11 @@ connectRequest(unsigned long connecttimeout_ms)
|
||||
clientName());
|
||||
status = pasynManager->queueRequest(pasynUser,
|
||||
asynQueuePriorityConnect, queueTimeout);
|
||||
if (status != asynSuccess)
|
||||
{
|
||||
error("%s connectRequest: pasynManager->queueRequest() failed: %s\n",
|
||||
clientName(), pasynUser->errorMessage);
|
||||
return false;
|
||||
}
|
||||
reportAsynStatus(status, "connectRequest: pasynManager->queueRequest");
|
||||
return (status == asynSuccess);
|
||||
// continues with:
|
||||
// handleRequest() -> connectHandler() -> connectCallback()
|
||||
// or handleTimeout() -> connectCallback(StreamIoTimeout)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AsynDriverInterface::
|
||||
@ -1456,15 +1450,10 @@ disconnectRequest()
|
||||
clientName());
|
||||
status = pasynManager->queueRequest(pasynUser,
|
||||
asynQueuePriorityConnect, 0.0);
|
||||
if (status != asynSuccess)
|
||||
{
|
||||
error("%s disconnectRequest: pasynManager->queueRequest() failed: %s\n",
|
||||
clientName(), pasynUser->errorMessage);
|
||||
return false;
|
||||
}
|
||||
reportAsynStatus(status, "disconnectRequest: pasynManager->queueRequest");
|
||||
return (status == asynSuccess);
|
||||
// continues with:
|
||||
// handleRequest() -> disconnectHandler()
|
||||
return true;
|
||||
}
|
||||
|
||||
void AsynDriverInterface::
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define StreamBusInterface_h
|
||||
|
||||
#include <stddef.h>
|
||||
#include <StreamBuffer.h>
|
||||
#include "StreamBuffer.h"
|
||||
|
||||
enum StreamIoStatus {
|
||||
StreamIoSuccess, StreamIoTimeout, StreamIoNoReply,
|
||||
|
@ -139,6 +139,7 @@ StreamCore()
|
||||
StreamCore** pstream;
|
||||
for (pstream = &first; *pstream; pstream = &(*pstream)->next);
|
||||
*pstream = this;
|
||||
activeCommand = NULL;
|
||||
}
|
||||
|
||||
StreamCore::
|
||||
@ -1364,13 +1365,15 @@ normal_format:
|
||||
{
|
||||
int i = 0;
|
||||
while (commandIndex[i] >= ' ') i++;
|
||||
error("%s: Input \"%s%s\" mismatch after %ld byte%s\n",
|
||||
error("%s: Input \"%s%s\" mismatch after %ld byte%s: %c != %c\n",
|
||||
name(),
|
||||
consumedInput > 10 ? "..." : "",
|
||||
inputLine.expand(consumedInput > 10 ?
|
||||
consumedInput-10 : 0,20)(),
|
||||
consumedInput,
|
||||
consumedInput==1 ? "" : "s");
|
||||
consumedInput==1 ? "" : "s",
|
||||
command,
|
||||
inputLine[consumedInput]);
|
||||
|
||||
#ifndef NO_TEMPORARY
|
||||
error("%s: got \"%s\" where \"%s\" was expected\n",
|
||||
@ -1762,7 +1765,7 @@ void StreamCore::
|
||||
printStatus(StreamBuffer& buffer)
|
||||
{
|
||||
buffer.print("active command=%s ",
|
||||
activeCommand ? commandName(*activeCommand) : "NULL");
|
||||
activeCommand ? commandName(*activeCommand) : "none");
|
||||
buffer.print("flags=0x%04lx ", flags);
|
||||
if (flags & IgnoreExtraInput) buffer.append("IgnoreExtraInput ");
|
||||
if (flags & InitRun) buffer.append("InitRun ");
|
||||
|
@ -18,9 +18,6 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "devStream.h"
|
||||
#undef epicsExportSharedSymbols
|
||||
#include "StreamCore.h"
|
||||
#include "StreamError.h"
|
||||
|
||||
@ -63,6 +60,7 @@ extern DBBASE *pdbbase;
|
||||
#include <epicsEvent.h>
|
||||
#include <epicsTime.h>
|
||||
#include <epicsThread.h>
|
||||
#include <epicsString.h>
|
||||
#include <registryFunction.h>
|
||||
#include <iocsh.h>
|
||||
|
||||
@ -79,6 +77,8 @@ epicsShareFunc int epicsShareAPI iocshCmd(const char *command);
|
||||
|
||||
#endif
|
||||
|
||||
#include "devStream.h"
|
||||
|
||||
#if defined(__vxworks) || defined(vxWorks)
|
||||
#include <symLib.h>
|
||||
#include <sysSymTbl.h>
|
||||
@ -93,7 +93,8 @@ enum MoreFlags {
|
||||
|
||||
extern "C" void streamExecuteCommand(CALLBACK *pcallback);
|
||||
extern "C" void streamRecordProcessCallback(CALLBACK *pcallback);
|
||||
extern "C" long streamReload(char* recordname);
|
||||
extern "C" long streamReload(const char* recordname);
|
||||
extern "C" long streamReportRecord(const char* recordname);
|
||||
|
||||
class Stream : protected StreamCore
|
||||
#ifndef EPICS_3_13
|
||||
@ -145,6 +146,7 @@ class Stream : protected StreamCore
|
||||
bool execute();
|
||||
friend void streamExecuteCommand(CALLBACK *pcallback);
|
||||
friend void streamRecordProcessCallback(CALLBACK *pcallback);
|
||||
friend long streamReportRecord(const char* recordname);
|
||||
|
||||
// Stream Epics methods
|
||||
Stream(dbCommon* record, const struct link *ioLink,
|
||||
@ -167,7 +169,7 @@ class Stream : protected StreamCore
|
||||
friend long streamPrintf(dbCommon *record, format_t *format, ...);
|
||||
friend long streamScanfN(dbCommon *record, format_t *format,
|
||||
void*, size_t maxStringSize);
|
||||
friend long streamReload(char* recordname);
|
||||
friend long streamReload(const char* recordname);
|
||||
|
||||
public:
|
||||
long priority() { return record->prio; };
|
||||
@ -185,12 +187,12 @@ epicsExportAddress(int, streamError);
|
||||
#endif
|
||||
|
||||
// for subroutine record
|
||||
extern "C" long streamReloadSub()
|
||||
long streamReloadSub()
|
||||
{
|
||||
return streamReload(NULL);
|
||||
}
|
||||
|
||||
extern "C" long streamReload(char* recordname)
|
||||
long streamReload(const char* recordname)
|
||||
{
|
||||
DBENTRY dbentry;
|
||||
dbCommon* record;
|
||||
@ -242,17 +244,30 @@ static const iocshArg streamReloadArg0 =
|
||||
{ "recordname", iocshArgString };
|
||||
static const iocshArg * const streamReloadArgs[] =
|
||||
{ &streamReloadArg0 };
|
||||
static const iocshFuncDef reloadDef =
|
||||
static const iocshFuncDef streamReloadDef =
|
||||
{ "streamReload", 1, streamReloadArgs };
|
||||
|
||||
extern "C" void streamReloadFunc (const iocshArgBuf *args)
|
||||
void streamReloadFunc (const iocshArgBuf *args)
|
||||
{
|
||||
streamReload(args[0].sval);
|
||||
}
|
||||
|
||||
static const iocshArg streamReportRecordArg0 =
|
||||
{ "recordname", iocshArgString };
|
||||
static const iocshArg * const streamReportRecordArgs[] =
|
||||
{ &streamReportRecordArg0 };
|
||||
static const iocshFuncDef streamReportRecordDef =
|
||||
{ "streamReportRecord", 1, streamReportRecordArgs };
|
||||
|
||||
void streamReportRecordFunc (const iocshArgBuf *args)
|
||||
{
|
||||
streamReportRecord(args[0].sval);
|
||||
}
|
||||
|
||||
static void streamRegistrar ()
|
||||
{
|
||||
iocshRegister(&reloadDef, streamReloadFunc);
|
||||
iocshRegister(&streamReloadDef, streamReloadFunc);
|
||||
iocshRegister(&streamReportRecordDef, streamReportRecordFunc);
|
||||
// make streamReload available for subroutine records
|
||||
registryFunctionAdd("streamReload",
|
||||
(REGISTRYFUNCTION)streamReloadSub);
|
||||
@ -361,6 +376,31 @@ report(int interest)
|
||||
return OK;
|
||||
}
|
||||
|
||||
long streamReportRecord(const char* recordname)
|
||||
{
|
||||
Stream* pstream;
|
||||
for (pstream = static_cast<Stream*>(Stream::first); pstream;
|
||||
pstream = static_cast<Stream*>(pstream->next))
|
||||
{
|
||||
if (!recordname ||
|
||||
#ifdef EPICS_3_13
|
||||
strcmp(pstream->name(), recordname) == 0)
|
||||
#else
|
||||
epicsStrGlobMatch(pstream->name(), recordname))
|
||||
#endif
|
||||
{
|
||||
printf("%s: %s\n", pstream->name(),
|
||||
pstream->ioLink->value.instio.string);
|
||||
StreamBuffer buffer;
|
||||
pstream->printStatus(buffer);
|
||||
printf("%s\n", buffer());
|
||||
pstream->printProtocol();
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
long Stream::
|
||||
drvInit()
|
||||
{
|
||||
@ -969,10 +1009,11 @@ getFieldAddress(const char* fieldname, StreamBuffer& address)
|
||||
}
|
||||
|
||||
static const unsigned char dbfMapping[] =
|
||||
#ifdef DBF_INT64
|
||||
{0, DBF_UINT64, DBF_INT64, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
|
||||
#else
|
||||
{0, DBF_ULONG, DBF_LONG, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
|
||||
static const short typeSize[] =
|
||||
{0, sizeof(epicsUInt32), sizeof(epicsInt32), sizeof(epicsUInt16),
|
||||
sizeof(epicsFloat64), MAX_STRING_SIZE};
|
||||
#endif
|
||||
|
||||
bool Stream::
|
||||
formatValue(const StreamFormat& format, const void* fieldaddress)
|
||||
@ -1020,7 +1061,7 @@ formatValue(const StreamFormat& format, const void* fieldaddress)
|
||||
|
||||
/* convert type to LONG, ENUM, DOUBLE, or STRING */
|
||||
long nelem = pdbaddr->no_elements;
|
||||
size_t size = nelem * typeSize[format.type];
|
||||
size_t size = nelem * dbValueSize(fmt.type);
|
||||
|
||||
/* print (U)CHAR arrays as string */
|
||||
if (format.type == string_format &&
|
||||
@ -1139,7 +1180,7 @@ matchValue(const StreamFormat& format, const void* fieldaddress)
|
||||
DBADDR* pdbaddr = (DBADDR*)fieldaddress;
|
||||
long nord;
|
||||
long nelem = pdbaddr->no_elements;
|
||||
size_t size = nelem * typeSize[format.type];
|
||||
size_t size = nelem * dbValueSize(fmt.type);
|
||||
buffer = fieldBuffer.clear().reserve(size);
|
||||
for (nord = 0; nord < nelem; nord++)
|
||||
{
|
||||
|
@ -656,11 +656,15 @@ printString(StreamBuffer& buffer, const char* s)
|
||||
buffer.append("\\\\");
|
||||
break;
|
||||
case format_field:
|
||||
// <format_field> field <eos> addrLength AddressStructure formatstr <eos> StreamFormat [info <eos>]
|
||||
unsigned short fieldSize;
|
||||
buffer.print("%%(%s)", ++s);
|
||||
while (*s++);
|
||||
s += extract<unsigned short>(s); // skip fieldaddress
|
||||
fieldSize = extract<unsigned short>(s);
|
||||
s += fieldSize; // skip fieldAddress
|
||||
goto format;
|
||||
case format:
|
||||
// <format> formatstr <eos> StreamFormat [info <eos>]
|
||||
buffer.append('%');
|
||||
s++;
|
||||
format: {
|
||||
@ -1057,7 +1061,7 @@ compileNumber(unsigned long& number, const char*& source, unsigned long max)
|
||||
|
||||
bool StreamProtocolParser::Protocol::
|
||||
compileString(StreamBuffer& buffer, const char*& source,
|
||||
FormatType formatType, Client* client, int quoted)
|
||||
FormatType formatType, Client* client, int quoted, int recursionDepth)
|
||||
{
|
||||
bool escaped = false;
|
||||
int newline = 0;
|
||||
@ -1066,8 +1070,8 @@ compileString(StreamBuffer& buffer, const char*& source,
|
||||
line = getLineNumber(source);
|
||||
|
||||
debug("StreamProtocolParser::Protocol::compileString "
|
||||
"line %d source=\"%s\"\n",
|
||||
line, source);
|
||||
"line %d source=\"%s\" recursionDepth=%d\n",
|
||||
line, source, recursionDepth);
|
||||
|
||||
// coding is done in two steps:
|
||||
// 1) read a line from protocol source and code quoted strings,
|
||||
@ -1085,7 +1089,7 @@ compileString(StreamBuffer& buffer, const char*& source,
|
||||
// compile all formats in this line
|
||||
// We do this here after all variables in this line
|
||||
// have been replaced and after string has been coded.
|
||||
if (formatType != NoFormat)
|
||||
if (recursionDepth == 0 && formatType != NoFormat)
|
||||
{
|
||||
int nformats=0;
|
||||
char c;
|
||||
@ -1250,7 +1254,7 @@ compileString(StreamBuffer& buffer, const char*& source,
|
||||
source += strlen(source)+1+sizeof(int);
|
||||
p = value();
|
||||
int saveline = line;
|
||||
if (!compileString(buffer, p, formatType, client))
|
||||
if (!compileString(buffer, p, formatType, client, false, recursionDepth + 1))
|
||||
return false;
|
||||
line = saveline;
|
||||
continue;
|
||||
|
@ -21,8 +21,8 @@
|
||||
#ifndef StreamProtocol_h
|
||||
#define StreamProtocol_h
|
||||
|
||||
#include "StreamBuffer.h"
|
||||
#include <stdio.h>
|
||||
#include "StreamBuffer.h"
|
||||
|
||||
enum FormatType {NoFormat, ScanFormat, PrintFormat};
|
||||
|
||||
@ -59,6 +59,8 @@ public:
|
||||
bool compileCommands(StreamBuffer&, const char*& source, Client*);
|
||||
bool replaceVariable(StreamBuffer&, const char* varname);
|
||||
const Variable* getVariable(const char* name);
|
||||
bool compileString(StreamBuffer& buffer, const char*& source,
|
||||
FormatType formatType, Client*, int quoted, int recursionDepth);
|
||||
|
||||
public:
|
||||
|
||||
@ -73,7 +75,9 @@ public:
|
||||
bool compileNumber(unsigned long& number, const char*& source,
|
||||
unsigned long max = 0xFFFFFFFF);
|
||||
bool compileString(StreamBuffer& buffer, const char*& source,
|
||||
FormatType formatType = NoFormat, Client* = NULL, int quoted = false);
|
||||
FormatType formatType = NoFormat, Client* client = NULL, int quoted = false) {
|
||||
return compileString(buffer, source, formatType, client, quoted, 0);
|
||||
}
|
||||
bool checkUnused();
|
||||
~Protocol();
|
||||
void report();
|
||||
|
@ -49,26 +49,19 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef epicsExportSharedSymbols
|
||||
# define devStream_epicsExportSharedSymbols
|
||||
# undef epicsExportSharedSymbols
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dbCommon.h>
|
||||
#include <dbScan.h>
|
||||
#include <devSup.h>
|
||||
#include <dbAccess.h>
|
||||
|
||||
#ifdef devStream_epicsExportSharedSymbols
|
||||
# define epicsExportSharedSymbols
|
||||
# include "shareLib.h"
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(EPICS_3_13)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef EPICS_3_13
|
||||
#include "shareLib.h"
|
||||
#endif
|
||||
|
||||
typedef const struct format_s {
|
||||
unsigned char type;
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errlog.h>
|
||||
#include <aaiRecord.h>
|
||||
#include "errlog.h"
|
||||
#include "aaiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
|
||||
case DBF_FLOAT:
|
||||
((epicsFloat32 *)aai->bptr)[aai->nord] = (epicsFloat32)lval;
|
||||
break;
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
case DBF_UINT64:
|
||||
((epicsInt64 *)aai->bptr)[aai->nord] = (epicsInt64)lval;
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
case DBF_ULONG:
|
||||
((epicsInt32 *)aai->bptr)[aai->nord] = (epicsInt32)lval;
|
||||
@ -115,8 +121,8 @@ static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
((char*)aai->bptr)[aai->nelm] = 0;
|
||||
for (lval = aai->nelm;
|
||||
((char*)aai->bptr)[aai->nelm-1] = 0;
|
||||
for (lval = aai->nelm-2;
|
||||
lval >= 0 && ((char*)aai->bptr)[lval] == 0;
|
||||
lval--);
|
||||
aai->nord = lval+1;
|
||||
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
case DBF_FLOAT:
|
||||
dval = ((epicsFloat32 *)aai->bptr)[nowd];
|
||||
break;
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
dval = ((epicsInt64 *)aai->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
dval = ((epicsUInt64 *)aai->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
dval = ((epicsInt32 *)aai->bptr)[nowd];
|
||||
break;
|
||||
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
{
|
||||
switch (aai->ftvl)
|
||||
{
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
lval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
lval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
lval = ((epicsInt32 *)aai->bptr)[nowd];
|
||||
break;
|
||||
@ -274,10 +296,9 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
|
||||
static long initRecord (dbCommon *record)
|
||||
{
|
||||
static const int typesize[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
|
||||
aaiRecord *aai = (aaiRecord *) record;
|
||||
|
||||
aai->bptr = calloc(aai->nelm, typesize[aai->ftvl]);
|
||||
aai->bptr = calloc(aai->nelm, dbValueSize(aai->ftvl));
|
||||
if (aai->bptr == NULL)
|
||||
{
|
||||
errlogSevPrintf (errlogFatal,
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errlog.h>
|
||||
#include <aaoRecord.h>
|
||||
#include "errlog.h"
|
||||
#include "aaoRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
|
||||
case DBF_FLOAT:
|
||||
((epicsFloat32 *)aao->bptr)[aao->nord] = (epicsFloat32)lval;
|
||||
break;
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
case DBF_UINT64:
|
||||
((epicsInt64 *)aao->bptr)[aao->nord] = (epicsInt64)lval;
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
case DBF_ULONG:
|
||||
((epicsInt32 *)aao->bptr)[aao->nord] = (epicsInt32)lval;
|
||||
@ -115,8 +121,8 @@ static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
((char*)aao->bptr)[aao->nelm] = 0;
|
||||
for (lval = aao->nelm;
|
||||
((char*)aao->bptr)[aao->nelm-1] = 0;
|
||||
for (lval = aao->nelm-2;
|
||||
lval >= 0 && ((char*)aao->bptr)[lval] == 0;
|
||||
lval--);
|
||||
aao->nord = lval+1;
|
||||
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
case DBF_FLOAT:
|
||||
dval = ((epicsFloat32 *)aao->bptr)[nowd];
|
||||
break;
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
dval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
dval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
dval = ((epicsInt32 *)aao->bptr)[nowd];
|
||||
break;
|
||||
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
{
|
||||
switch (aao->ftvl)
|
||||
{
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
lval = ((epicsInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
lval = ((epicsUInt64 *)aao->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
lval = ((epicsInt32 *)aao->bptr)[nowd];
|
||||
break;
|
||||
@ -274,10 +296,9 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
|
||||
static long initRecord (dbCommon *record)
|
||||
{
|
||||
static const int typesize[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
|
||||
aaoRecord *aao = (aaoRecord *) record;
|
||||
|
||||
aao->bptr = calloc(aao->nelm, typesize[aao->ftvl]);
|
||||
aao->bptr = calloc(aao->nelm, dbValueSize(aao->ftvl));
|
||||
if (aao->bptr == NULL)
|
||||
{
|
||||
errlogSevPrintf (errlogFatal,
|
||||
|
@ -19,9 +19,9 @@
|
||||
***************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <biRecord.h>
|
||||
#include "biRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -19,9 +19,9 @@
|
||||
***************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <boRecord.h>
|
||||
#include "boRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -17,10 +17,10 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <postfix.h>
|
||||
#include <calcoutRecord.h>
|
||||
#include "postfix.h"
|
||||
#include "calcoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -18,9 +18,9 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <longinRecord.h>
|
||||
#include "longinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -19,9 +19,9 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <longoutRecord.h>
|
||||
#include "longoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -19,9 +19,9 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <mbbiDirectRecord.h>
|
||||
#include "mbbiDirectRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -20,9 +20,9 @@
|
||||
***************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <mbbiRecord.h>
|
||||
#include "mbbiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -19,10 +19,10 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <mbboDirectRecord.h>
|
||||
#include "mbboDirectRecord.h"
|
||||
#include "alarm.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -20,9 +20,9 @@
|
||||
***************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <mbboRecord.h>
|
||||
#include "mbboRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -17,18 +17,18 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <devStream.h>
|
||||
#include <sCalcoutRecord.h>
|
||||
#include <epicsExport.h>
|
||||
#include "sCalcoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
|
||||
/* scalcout record has a bug: it never calls init_record
|
||||
/* Up to version 2-6-1 of the SynApps calc module
|
||||
scalcout record has a bug: it never calls init_record
|
||||
of the device support.
|
||||
Fix: sCalcoutRecord.c, end of init_record() add
|
||||
|
||||
if(pscalcoutDSET->init_record ) {
|
||||
return (*pscalcoutDSET->init_record)(pcalc);
|
||||
}
|
||||
The bug has been fixed in version 2-6-1.
|
||||
*/
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
|
@ -18,9 +18,9 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <stringinRecord.h>
|
||||
#include "stringinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -18,9 +18,9 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <stringoutRecord.h>
|
||||
#include "stringoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
|
@ -19,10 +19,10 @@
|
||||
***************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <errlog.h>
|
||||
#include <waveformRecord.h>
|
||||
#include "errlog.h"
|
||||
#include "waveformRecord.h"
|
||||
#include "epicsExport.h"
|
||||
#include "devStream.h"
|
||||
#include <epicsExport.h>
|
||||
|
||||
static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
|
||||
case DBF_FLOAT:
|
||||
((epicsFloat32 *)wf->bptr)[wf->nord] = (epicsFloat32)lval;
|
||||
break;
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
case DBF_UINT64:
|
||||
((epicsInt64 *)wf->bptr)[aao->nord] = (epicsInt64)lval;
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
case DBF_ULONG:
|
||||
((epicsInt32 *)wf->bptr)[wf->nord] = (epicsInt32)lval;
|
||||
@ -115,8 +121,8 @@ static long readData (dbCommon *record, format_t *format)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
((char*)wf->bptr)[wf->nelm] = 0;
|
||||
for (lval = wf->nelm;
|
||||
((char*)wf->bptr)[wf->nelm-1] = 0;
|
||||
for (lval = wf->nelm-2;
|
||||
lval >= 0 && ((char*)wf->bptr)[lval] == 0;
|
||||
lval--);
|
||||
wf->nord = lval+1;
|
||||
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
case DBF_FLOAT:
|
||||
dval = ((epicsFloat32 *)wf->bptr)[nowd];
|
||||
break;
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
dval = ((epicsInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
dval = ((epicsUInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
dval = ((epicsInt32 *)wf->bptr)[nowd];
|
||||
break;
|
||||
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
|
||||
{
|
||||
switch (wf->ftvl)
|
||||
{
|
||||
#ifdef DBF_INT64
|
||||
case DBF_INT64:
|
||||
lval = ((epicsInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
case DBF_UINT64:
|
||||
lval = ((epicsUInt64 *)wf->bptr)[nowd];
|
||||
break;
|
||||
#endif
|
||||
case DBF_LONG:
|
||||
lval = ((epicsInt32 *)wf->bptr)[nowd];
|
||||
break;
|
||||
|
@ -17,9 +17,9 @@
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#include <epicsThread.h>
|
||||
#include <iocsh.h>
|
||||
#include <devStream.h>
|
||||
#include "epicsThread.h"
|
||||
#include "iocsh.h"
|
||||
#include "devStream.h"
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
Reference in New Issue
Block a user